Greasy Fork

Greasy Fork is available in English.

百度云去广告,快捷键倍速,免VIP解锁倍速、画质!全网独家!

删除“复制这段内容后打开百度网盘手机App,操作更方便哦,来自百度会员超级无敌永久svip”,精简部主页广告、邀请,视频添加倍速按钮

目前为 2021-05-19 提交的版本。查看 最新版本

// ==UserScript==
// @icon         https://pan.baidu.com/m-static/base/static/images/favicon.ico
// @name         百度云去广告,快捷键倍速,免VIP解锁倍速、画质!全网独家!
// @namespace    taozhiyu.gitee.io
// @version      0.4.5
// @description  删除“复制这段内容后打开百度网盘手机App,操作更方便哦,来自百度会员超级无敌永久svip”,精简部主页广告、邀请,视频添加倍速按钮
// @author       涛之雨
// @require      https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.6/clipboard.min.js
// @match        *://pan.baidu.com/disk/*
// @match        *://pan.baidu.com/mbox/*
// @match        *://pan.baidu.com/play/*
// @match        *://yun.baidu.com/disk/*
// @match        *://yun.baidu.com/mbox/*
// @match        *://yun.baidu.com/play/*
// @match        *://pan.baidu.com/s/*
// @match        *://yun.baidu.com/s/*
// @match        *://pan.baidu.com/share/*
// @match        *://yun.baidu.com/share/*
// @grant	     GM_addStyle
// @grant	     unsafeWindow
// @grant        GM_getValue
// @grant        GM_setValue
// @home-url	 http://greasyfork.icu/zh-CN/scripts/422814
// @license      GPL-3.0-only
// ==/UserScript==
/**********************************************\
 * 移除小尾巴部分修改自http://greasyfork.icu/zh-CN/scripts/374100
 * 自定义密码部分修改自http://greasyfork.icu/zh-CN/scripts/423146
 * V 0.4.5
 * 修复“画中画”逻辑错误
 * 修复转存文件时界面显示错误
 * V 0.4.4
 * 大版本更新!!!
 * 全!网!独!家!支持百度云【免VIP】解锁倍速和画质!
 * (注:因服务器限制非会员速度,因此非会员会卡顿)
 * 需要看源码的朋友自行格式化。。。
 * 因为太大,把对齐的空格都删掉了(1.69M=>684K)
 * V 0.3.4
 * 悄咪咪修复部分(感觉就只有大萝卜一个)人百度网盘LOGO显示异常的问题(换了个图标)
 * 修复百度云更新造成的脚本无法倍速播放视频(目前仅有百度云VIP方可使用。。。)
 * 修复速率调节快捷键的一个bug(目前仅有百度云VIP方可使用。。。)
 * 添加“画中画”功能(需要浏览器支持),画中画模式快捷键将会失效,全屏自动退出画中画模式
 * V 0.3.3
 * 植入自定义密码功能(修改自【http://greasyfork.icu/zh-CN/scripts/423146】,感谢提供思路,已获得授权)
 * 优化上述脚本
 * 修改默认分享时间为【永久】
 * 新增对于“内测提醒”弹窗的关闭支持
 * 倍速貌似失效了?算了,有空再看吧
 * V 0.3.2
 * 紧急修复误伤压缩包查看的bug
 * V 0.3.1
 * 新增对于【压缩包】、【CAD】和【思维导图】文件打开引导的屏蔽。
 * 新增在播放界面,新增快捷键控制播放速度:
 * -- (shift键无论是否按下,)按数字【0】即可恢复正常速度(原速快捷键)
 * -- 按下数字【1-9】可以分别调整速度为【1.25,1.5,1.75,2,2.4,2.7,4,6,8】(倍速快捷键)
 * -- 按下【shift】后再按下数字【1-9】可以分别调整速度为【0.1,0.15,0.2,0.25,0.3,0.5,0.6,0.8,0.9】(慢速快捷键)
 * -- (shift键无论是否按下,)每次按下【-】,当前速率减小0.1
 * -- (shift键无论是否按下,)每次按下【=】,当前速率增加0.1
 * V 0.3.0
 * 添加 + 自动读取、提交提取码的功能(第一次运行需要授权,有引导界面)
 * V 0.2.9
 * 修复 + 因为图省事,通用匹配导致某些界面被屏蔽的bug
 * V 0.2.8
 * 修复 + 视频倍速播放自动恢复的暗装(涛之雨全网独家的方法,如有借鉴请说明出处)
 * V 0.2.7
 * 调整 + 转存后的布局
 * 修复 + 删除部分遗漏广告
 * 新增 + 对于文件分享界面,的去广告支持
 * V 0.2.6
 * 新增 + 对于分享页的适配(去广告)
 * 新增 + 视频播放页添加倍速按钮(仿原生,贼强)
 * 添加 + 遵循协议 GPL-3.0-only
 * TODO : 默认永久分享(可自定义1-365天和永久)
 * TODO : 自定义分享密码(或公开链接,无密码)
 * TODO : 自定义限制分享次数链接
 * V 0.2.5
 * 新增 + 对于“在线视频”界面的支持
 * TODO : 加上倍速播放按钮
 * V 0.2.4
 * 新增 + 对于“分享”界面的支持
 * V 0.2.3
 * 删除 - 百度文库相关代码,迁移到新项目
 * V 0.2.1
 * 新增 + 百度文库大量垃圾、广告删除
 * TODO : 正在研究非VIP会员免【广告全屏阅读】
 * V 0.1.7
 * 修复 + “个人分享”界面“复制这段内容...”移除失败的bug
 * 新增 + 删除主界面的部分垃圾(可以自行对比)
 * 新增 + 关闭4秒内主动弹出的【设备管理】、【新功能测试】、【在线文档】、【在线解压】、等等。。。窗口
\************************************************/
(function() {
'use strict';
const w=unsafeWindow||window;
let myvideojs;
var $ = $ || window.$ || w.$;
const saveInfo=(a)=>{
GM_setValue("BaiduYunBeautify", JSON.stringify(a));
};
//兼容之前的版本,迁移数据并移除
const getInfo=()=>{
return JSON.parse(localStorage.getItem("taozhiyuPanConfig"));
};
let oldinfo=(getInfo()&&!!getInfo().isfrist)?getInfo().isfrist:true;
localStorage.clear("taozhiyuPanConfig");
let info=GM_getValue("BaiduYunBeautify")?JSON.parse(GM_getValue("BaiduYunBeautify")):{};
if(Object.keys(info).length<3){
!info.SetKey&&(info.SetKey=true);
!info.sharePwd&&(info.sharePwd="");
!info.isFristAutoEnterKey&&(info.isFristAutoEnterKey=oldinfo);
!info.isOldSDK&&(info.isOldSDK=false);
saveInfo(info)
}
GM_addStyle(`.phone-banner,
.button-badge,
.hx-right-bottom,
.title-wrap > .join-vip,
.title-wrap > .info,
.hx-bottom-wrapper,
.hx-recom-wrapper,
.app-btn,.hx-warp,
.relative-doc-ad-wrapper,
.qr-wrapper,
.cert-tip,
.side-doc-tool-wrapper,
.feedback-wrapper,
.popover-container,
.privilege-box,
.vip-pop-wrap,
.red-point,
.wp-side-options,
.module-header-wrapper > dl > dd[node-type='header-union'],
.yike-entrance,
.find-light-icon,
.newIcon,
.app-download,
.app-notice,
.icon-notice,
.icon-feedback,
.app-feedback,
.wp-disk-header__right-item,
.bz-doc-tool-dialog-fix,
.ex-wrapper,
.fixed-activity-bar,
.vip-card-wrap,
.btn-img-tips,
.rights-section,
a[title="举报"],
div[class^="ad-"],
.share-file__link-ad,
.vip-activity-content,
.video-title-right-open-mobile,
.tips{
display:none!important;
width:0!important;
overflow:hidden!important;
}

.after-trans-dialog .info-section {
padding: 99px 0!important;
}

#SetKey{
display: inline-block;
color: #fff;
font-size: 16px;
height: 42px;
line-height: 38px;
margin: 0 25px;
vertical-align: middle;
position: relative;
padding: 0 2px;
cursor: pointer;
}

#SetKey:hover {
opacity: .8;
}

`);
let t = " ", e = "text", o = "去除小尾巴失败o(╥﹏╥)o", a = "body", l = "copy",y=true,f=(a)=>{a.style.display="none";a.style.width=0;a.style.overflow="hidden"};
document.querySelector(a).addEventListener(l, function(a) {try {let l = a.target.value;l = l.split(t).filter((t, e) => {if(!!t.match(/手机App|复制这段/))y=false;return y}).join("").replace("提取码"," 提取码"),a.clipboardData.setData(e, l),a.preventDefault(),y=true; } catch (a) { console.log(o);}});
function autoInputCode(callback){
navigator.clipboard.readText().then(a =>{
callback(true,a)
}) .catch((v) => {
callback(false,v)
});
}

if(location.href.indexOf("/share/my")<0){
$(document).on("DOMNodeInserted", ".share-file__link-expired", function() {
if ($(".nd-input-share-pwd").length == 0) {
setTimeout(()=>{
var o=document.querySelector("#g-select-1");
o.querySelector(".g-select-inner").click()
var event = new CustomEvent("mousedown",{bubbles: 'true'});
o.querySelector('#g-select-1 [data-value="0"]').dispatchEvent(event);
},200);
var html = '<div style="margin:10px;"></div><div class="share-file__link-expired-title">自定义分享密码</div>';
html += '<div class="share-file__link-pwd"><div class="share-file__link-pwd-label">提取码</div>';
html += '<input type="text" class="nd-input-share-pwd" value="' + (info.sharePwd ? info.sharePwd : "") + '" placeholder="为空则随机四位" style="margin-left: 16px; width: 120px; height: 32px; line-height: 28px; border: 1px solid #D4D7DE; border-radius: 8px; text-align: left; padding-left: 12px"></div>';
$(".share-file__link-expired").after(html);
}
});

w.require.async("function-widget-1:share/util/newShare/linkSetting.js", function (a) {
a.a = a.makePrivatePassword;
a.makePrivatePassword = function () {
return info.sharePwd ? info.sharePwd : this.a();
};
});

$(document).on("change", ".nd-input-share-pwd", function () {
var value = this.value;
if (value && !/[^\W_]{4}/.test(value)) {
w.require("system-core:system/uiService/tip/tip.js").show({mode: "failure", msg: "提取码不合规范,只能是四位字母数字组合"});
}else{
info.sharePwd=value;
saveInfo(info);
}
});
}
if(location.href.indexOf("baidu.com/disk/")>=0){
let id=setInterval(()=>{
document.querySelectorAll(".pdf2word-tip-close-btn").forEach(a=>{a.click()});
document.querySelectorAll(".dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".close-mask").forEach(a=>{a.click()});
document.querySelectorAll(".common-dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".wp-guide-dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".wp-tip-close-btn").forEach(a=>{a.click()});
document.querySelectorAll(".guide-dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".wp-disk-header__right-item").forEach((a)=>{if(a.href&&!!a.href.match(/buy|addnew/)){f(a);}});
},1);
setTimeout(()=>{clearInterval(id)},5000)
window.addEventListener("mouseup",a=>{
if(a.target.title!=="分享"){return;}
let id2=setInterval(()=>{
const x=document.querySelectorAll(".share-file__link-ad");
if(!x){return;}
x.forEach((a)=>{f(a);});
setTimeout(()=>{clearInterval(id2)},100);
},10);
});
}else if(location.href.indexOf("play/video")>=0){
var alreadytoast=false;
if(!info.isOldSDK){
var waite4Myvideo=setInterval(()=>{
if(!!w.videoPlayer){
clearInterval(waite4Myvideo);
!function(t) {
w.videoPlayer = t(w, document)
}(function(e, t) {
"use strict";
function i(e) {
return e && "object" == typeof e && "default"in e ? e : {
"default": e
}
}
function n(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e["default"] : e
}
function r(e, t) {
return t = {
exports: {}
},
e(t, t.exports),
t.exports
}
function a(e, t) {
if (null == e)
return {};
var i, n, r = {}, a = Object.keys(e);
for (n = 0; n < a.length; n++)
i = a[n],
t.indexOf(i) >= 0 || (r[i] = e[i]);
return r
}
function s(e) {
if (void 0 === e)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function o(e, t) {
e.prototype = Object.create(t.prototype),
e.prototype.constructor = e,
e.__proto__ = t
}
function u(e, t) {
var i, n = null;
try {
i = JSON.parse(e, t)
} catch (r) {
n = r
}
return [n, i]
}
function l(e) {
if (!e)
return !1;
var t = br.call(e);
return "[object Function]" === t || "function" == typeof e && "[object RegExp]" !== t || "undefined" != typeof window && (e === window.setTimeout || e === window.alert || e === window.confirm || e === window.prompt)
}
function c(e, t) {
for (var i = 0; i < e.length; i++)
t(e[i])
}
function d(e) {
for (var t in e)
if (e.hasOwnProperty(t))
return !1;
return !0
}
function h(e, t, i) {
var n = e;
return _r(t) ? (i = t,
"string" == typeof e && (n = {
uri: e
})) : n = fr({}, t, {
uri: e
}),
n.callback = i,
n
}
function f(e, t, i) {
return t = h(e, t, i),
p(t)
}
function p(e) {
function t() {
4 === o.readyState && setTimeout(r, 0)
}
function i() {
var e = void 0;
if (e = o.response ? o.response : o.responseText || m(o),
_)
try {
e = JSON.parse(e)
} catch (t) {}
return e
}
function n(e) {
return clearTimeout(c),
e instanceof Error || (e = new Error("" + (e || "Unknown XMLHttpRequest Error"))),
e.statusCode = 0,
s(e, b)
}
function r() {
if (!l) {
var t;
clearTimeout(c),
t = e.useXDR && void 0 === o.status ? 200 : 1223 === o.status ? 204 : o.status;
var n = b
, r = null;
return 0 !== t ? (n = {
body: i(),
statusCode: t,
method: p,
headers: {},
url: h,
rawRequest: o
},
o.getAllResponseHeaders && (n.headers = Tr(o.getAllResponseHeaders()))) : r = new Error("Internal XMLHttpRequest Error"),
s(r, n, n.body)
}
}
if ("undefined" == typeof e.callback)
throw new Error("callback argument missing");
var a = !1
, s = function(t, i, n) {
a || (a = !0,
e.callback(t, i, n))
}
, o = e.xhr || null;
o || (o = e.cors || e.useXDR ? new f.XDomainRequest : new f.XMLHttpRequest);
var u, l, c, h = o.url = e.uri || e.url, p = o.method = e.method || "GET", g = e.body || e.data, v = o.headers = e.headers || {}, y = !!e.sync, _ = !1, b = {
body: void 0,
headers: {},
statusCode: 0,
method: p,
url: h,
rawRequest: o
};
if ("json"in e && e.json !== !1 && (_ = !0,
v.accept || v.Accept || (v.Accept = "application/json"),
"GET" !== p && "HEAD" !== p && (v["content-type"] || v["Content-Type"] || (v["Content-Type"] = "application/json"),
g = JSON.stringify(e.json === !0 ? g : e.json))),
o.onreadystatechange = t,
o.onload = r,
o.onerror = n,
o.onprogress = function() {}
,
o.onabort = function() {
l = !0
}
,
o.ontimeout = n,
o.open(p, h, !y, e.username, e.password),
y || (o.withCredentials = !!e.withCredentials),
!y && e.timeout > 0 && (c = setTimeout(function() {
if (!l) {
l = !0,
o.abort("timeout");
var e = new Error("XMLHttpRequest timeout");
e.code = "ETIMEDOUT",
n(e)
}
}, e.timeout)),
o.setRequestHeader)
for (u in v)
v.hasOwnProperty(u) && o.setRequestHeader(u, v[u]);
else if (e.headers && !d(e.headers))
throw new Error("Headers cannot be set on an XDomainRequest object");
return "responseType"in e && (o.responseType = e.responseType),
"beforeSend"in e && "function" == typeof e.beforeSend && e.beforeSend(o),
o.send(g || null),
o
}
function m(e) {
try {
if ("document" === e.responseType)
return e.responseXML;
var t = e.responseXML && "parsererror" === e.responseXML.documentElement.nodeName;
if ("" === e.responseType && !t)
return e.responseXML
} catch (i) {}
return null
}
function g() {}
function v(e, t) {
this.name = "ParsingError",
this.code = e.code,
this.message = t || e.message
}
function y(e) {
function t(e, t, i, n) {
return 3600 * (0 | e) + 60 * (0 | t) + (0 | i) + (0 | n) / 1e3
}
var i = e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
return i ? i[3] ? t(i[1], i[2], i[3].replace(":", ""), i[4]) : i[1] > 59 ? t(i[1], i[2], 0, i[4]) : t(0, i[1], i[2], i[4]) : null
}
function _() {
this.values = Er(null)
}
function b(e, t, i, n) {
var r = n ? e.split(n) : [e];
for (var a in r)
if ("string" == typeof r[a]) {
var s = r[a].split(i);
if (2 === s.length) {
var o = s[0]
, u = s[1];
t(o, u)
}
}
}
function T(e, t, i) {
function n() {
var t = y(e);
if (null === t)
throw new v(v.Errors.BadTimeStamp,"Malformed timestamp: " + s);
return e = e.replace(/^[^\sa-zA-Z-]+/, ""),
t
}
function r(e, t) {
var n = new _;
b(e, function(e, t) {
switch (e) {
case "region":
for (var r = i.length - 1; r >= 0; r--)
if (i[r].id === t) {
n.set(e, i[r].region);
break
}
break;
case "vertical":
n.alt(e, t, ["rl", "lr"]);
break;
case "line":
var a = t.split(",")
, s = a[0];
n.integer(e, s),
n.percent(e, s) ? n.set("snapToLines", !1) : null,
n.alt(e, s, ["auto"]),
2 === a.length && n.alt("lineAlign", a[1], ["start", "center", "end"]);
break;
case "position":
a = t.split(","),
n.percent(e, a[0]),
2 === a.length && n.alt("positionAlign", a[1], ["start", "center", "end"]);
break;
case "size":
n.percent(e, t);
break;
case "align":
n.alt(e, t, ["start", "center", "end", "left", "right"])
}
}, /:/, /\s/),
t.region = n.get("region", null),
t.vertical = n.get("vertical", "");
try {
t.line = n.get("line", "auto")
} catch (r) {}
t.lineAlign = n.get("lineAlign", "start"),
t.snapToLines = n.get("snapToLines", !0),
t.size = n.get("size", 100);
try {
t.align = n.get("align", "center")
} catch (r) {
t.align = n.get("align", "middle")
}
try {
t.position = n.get("position", "auto")
} catch (r) {
t.position = n.get("position", {
start: 0,
left: 0,
center: 50,
middle: 50,
end: 100,
right: 100
}, t.align)
}
t.positionAlign = n.get("positionAlign", {
start: "start",
left: "start",
center: "center",
middle: "center",
end: "end",
right: "end"
}, t.align)
}
function a() {
e = e.replace(/^\s+/, "")
}
var s = e;
if (a(),
t.startTime = n(),
a(),
"-->" !== e.substr(0, 3))
throw new v(v.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): " + s);
e = e.substr(3),
a(),
t.endTime = n(),
a(),
r(e, t)
}
function S(e, t) {
function i() {
function e(e) {
return t = t.substr(e.length),
e
}
if (!t)
return null;
var i = t.match(/^([^<]*)(<[^>]*>?)?/);
return e(i[1] ? i[1] : i[2])
}
function n(e) {
return kr.innerHTML = e,
e = kr.textContent,
kr.textContent = "",
e
}
function r(e, t) {
return !xr[t.localName] || xr[t.localName] === e.localName
}
function a(t, i) {
var n = wr[t];
if (!n)
return null;
var r = e.document.createElement(n)
, a = Ar[t];
return a && i && (r[a] = i.trim()),
r
}
for (var s, o = e.document.createElement("div"), u = o, l = []; null !== (s = i()); )
if ("<" !== s[0])
u.appendChild(e.document.createTextNode(n(s)));
else {
if ("/" === s[1]) {
l.length && l[l.length - 1] === s.substr(2).replace(">", "") && (l.pop(),
u = u.parentNode);
continue
}
var c, d = y(s.substr(1, s.length - 2));
if (d) {
c = e.document.createProcessingInstruction("timestamp", d),
u.appendChild(c);
continue
}
var h = s.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
if (!h)
continue;
if (c = a(h[1], h[3]),
!c)
continue;
if (!r(u, c))
continue;
if (h[2]) {
var f = h[2].split(".");
f.forEach(function(e) {
var t = /^bg_/.test(e)
, i = t ? e.slice(3) : e;
if (Ir.hasOwnProperty(i)) {
var n = t ? "background-color" : "color"
, r = Ir[i];
c.style[n] = r
}
}),
c.className = f.join(" ")
}
l.push(h[1]),
u.appendChild(c),
u = c
}
return o
}
function C(e) {
for (var t = 0; t < Pr.length; t++) {
var i = Pr[t];
if (e >= i[0] && e <= i[1])
return !0
}
return !1
}
function E(e) {
function t(e, t) {
for (var i = t.childNodes.length - 1; i >= 0; i--)
e.push(t.childNodes[i])
}
function i(e) {
if (!e || !e.length)
return null;
var n = e.pop()
, r = n.textContent || n.innerText;
if (r) {
var a = r.match(/^.*(\n|\r)/);
return a ? (e.length = 0,
a[0]) : r
}
return "ruby" === n.tagName ? i(e) : n.childNodes ? (t(e, n),
i(e)) : void 0
}
var n, r = [], a = "";
if (!e || !e.childNodes)
return "ltr";
for (t(r, e); a = i(r); )
for (var s = 0; s < a.length; s++)
if (n = a.charCodeAt(s),
C(n))
return "rtl";
return "ltr"
}
function k(e) {
if ("number" == typeof e.line && (e.snapToLines || e.line >= 0 && e.line <= 100))
return e.line;
if (!e.track || !e.track.textTrackList || !e.track.textTrackList.mediaElement)
return -1;
for (var t = e.track, i = t.textTrackList, n = 0, r = 0; r < i.length && i[r] !== t; r++)
"showing" === i[r].mode && n++;
return -1 * ++n
}
function w() {}
function I(e, t, i) {
w.call(this),
this.cue = t,
this.cueDiv = S(e, t.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: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl",
unicodeBidi: "plaintext"
};
this.applyStyles(n, this.cueDiv),
this.div = e.document.createElement("div"),
n = {
direction: E(this.cueDiv),
writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl",
unicodeBidi: "plaintext",
textAlign: "middle" === t.align ? "center" : t.align,
font: i.font,
whiteSpace: "pre-line",
position: "absolute"
},
this.applyStyles(n),
this.div.appendChild(this.cueDiv);
var r = 0;
switch (t.positionAlign) {
case "start":
r = t.position;
break;
case "center":
r = t.position - t.size / 2;
break;
case "end":
r = t.position - t.size
}
this.applyStyles("" === t.vertical ? {
left: this.formatStyle(r, "%"),
width: this.formatStyle(t.size, "%")
} : {
top: this.formatStyle(r, "%"),
height: this.formatStyle(t.size, "%")
}),
this.move = function(e) {
this.applyStyles({
top: this.formatStyle(e.top, "px"),
bottom: this.formatStyle(e.bottom, "px"),
left: this.formatStyle(e.left, "px"),
right: this.formatStyle(e.right, "px"),
height: this.formatStyle(e.height, "px"),
width: this.formatStyle(e.width, "px")
})
}
}
function A(e) {
var t, i, n, r;
if (e.div) {
i = e.div.offsetHeight,
n = e.div.offsetWidth,
r = e.div.offsetTop;
var a = (a = e.div.childNodes) && (a = a[0]) && a.getClientRects && a.getClientRects();
e = e.div.getBoundingClientRect(),
t = a ? Math.max(a[0] && a[0].height || 0, e.height / a.length) : 0
}
this.left = e.left,
this.right = e.right,
this.top = e.top || r,
this.height = e.height || i,
this.bottom = e.bottom || r + (e.height || i),
this.width = e.width || n,
this.lineHeight = void 0 !== t ? t : e.lineHeight
}
function x(e, t, i, n) {
function r(e, t) {
for (var r, a = new A(e), s = 1, o = 0; o < t.length; o++) {
for (; e.overlapsOppositeAxis(i, t[o]) || e.within(i) && e.overlapsAny(n); )
e.move(t[o]);
if (e.within(i))
return e;
var u = e.intersectPercentage(i);
s > u && (r = new A(e),
s = u),
e = new A(a)
}
return r || a
}
var a = new A(t)
, s = t.cue
, o = k(s)
, u = [];
if (s.snapToLines) {
var l;
switch (s.vertical) {
case "":
u = ["+y", "-y"],
l = "height";
break;
case "rl":
u = ["+x", "-x"],
l = "width";
break;
case "lr":
u = ["-x", "+x"],
l = "width"
}
var c = a.lineHeight
, d = c * Math.round(o)
, h = i[l] + c
, f = u[0];
Math.abs(d) > h && (d = 0 > d ? -1 : 1,
d *= Math.ceil(h / c) * c),
0 > o && (d += "" === s.vertical ? i.height : i.width,
u = u.reverse()),
a.move(f, d)
} else {
var p = a.lineHeight / i.height * 100;
switch (s.lineAlign) {
case "center":
o -= p / 2;
break;
case "end":
o -= p
}
switch (s.vertical) {
case "":
t.applyStyles({
top: t.formatStyle(o, "%")
});
break;
case "rl":
t.applyStyles({
left: t.formatStyle(o, "%")
});
break;
case "lr":
t.applyStyles({
right: t.formatStyle(o, "%")
})
}
u = ["+y", "-x", "+x", "-y"],
a = new A(t)
}
var m = r(a, u);
t.move(m.toCSSCompatValues(i))
}
function P() {}
function L(e) {
if ("string" != typeof e)
return !1;
var t = Rr[e.toLowerCase()];
return t ? e.toLowerCase() : !1
}
function D(e) {
if ("string" != typeof e)
return !1;
var t = Ur[e.toLowerCase()];
return t ? e.toLowerCase() : !1
}
function O(e, t, i) {
this.hasBeenReset = !1;
var n = ""
, r = !1
, a = e
, s = t
, o = i
, u = null
, l = ""
, c = !0
, d = "auto"
, h = "start"
, f = "auto"
, p = "auto"
, m = 100
, g = "center";
Object.defineProperties(this, {
id: {
enumerable: !0,
get: function() {
return n
},
set: function(e) {
n = "" + e
}
},
pauseOnExit: {
enumerable: !0,
get: function() {
return r
},
set: function(e) {
r = !!e
}
},
startTime: {
enumerable: !0,
get: function() {
return a
},
set: function(e) {
if ("number" != typeof e)
throw new TypeError("Start time must be set to a number.");
a = e,
this.hasBeenReset = !0
}
},
endTime: {
enumerable: !0,
get: function() {
return s
},
set: function(e) {
if ("number" != typeof e)
throw new TypeError("End time must be set to a number.");
s = e,
this.hasBeenReset = !0
}
},
text: {
enumerable: !0,
get: function() {
return o
},
set: function(e) {
o = "" + e,
this.hasBeenReset = !0
}
},
region: {
enumerable: !0,
get: function() {
return u
},
set: function(e) {
u = e,
this.hasBeenReset = !0
}
},
vertical: {
enumerable: !0,
get: function() {
return l
},
set: function(e) {
var t = L(e);
if (t === !1)
throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");
l = t,
this.hasBeenReset = !0
}
},
snapToLines: {
enumerable: !0,
get: function() {
return c
},
set: function(e) {
c = !!e,
this.hasBeenReset = !0
}
},
line: {
enumerable: !0,
get: function() {
return d
},
set: function(e) {
if ("number" != typeof e && e !== Mr)
throw new SyntaxError("Line: an invalid number or illegal string was specified.");
d = e,
this.hasBeenReset = !0
}
},
lineAlign: {
enumerable: !0,
get: function() {
return h
},
set: function(e) {
var t = D(e);
t ? (h = t,
this.hasBeenReset = !0) : console.warn("lineAlign: an invalid or illegal string was specified.")
}
},
position: {
enumerable: !0,
get: function() {
return f
},
set: function(e) {
if (0 > e || e > 100)
throw new Error("Position must be between 0 and 100.");
f = e,
this.hasBeenReset = !0
}
},
positionAlign: {
enumerable: !0,
get: function() {
return p
},
set: function(e) {
var t = D(e);
t ? (p = t,
this.hasBeenReset = !0) : console.warn("positionAlign: an invalid or illegal string was specified.")
}
},
size: {
enumerable: !0,
get: function() {
return m
},
set: function(e) {
if (0 > e || e > 100)
throw new Error("Size must be between 0 and 100.");
m = e,
this.hasBeenReset = !0
}
},
align: {
enumerable: !0,
get: function() {
return g
},
set: function(e) {
var t = D(e);
if (!t)
throw new SyntaxError("align: an invalid or illegal alignment string was specified.");
g = t,
this.hasBeenReset = !0
}
}
}),
this.displayState = void 0
}
function N(e) {
if ("string" != typeof e)
return !1;
var t = Br[e.toLowerCase()];
return t ? e.toLowerCase() : !1
}
function M(e) {
return "number" == typeof e && e >= 0 && 100 >= e
}
function R() {
var e = 100
, t = 3
, i = 0
, n = 100
, r = 0
, a = 100
, s = "";
Object.defineProperties(this, {
width: {
enumerable: !0,
get: function() {
return e
},
set: function(t) {
if (!M(t))
throw new Error("Width must be between 0 and 100.");
e = t
}
},
lines: {
enumerable: !0,
get: function() {
return t
},
set: function(e) {
if ("number" != typeof e)
throw new TypeError("Lines must be set to a number.");
t = e
}
},
regionAnchorY: {
enumerable: !0,
get: function() {
return n
},
set: function(e) {
if (!M(e))
throw new Error("RegionAnchorX must be between 0 and 100.");
n = e
}
},
regionAnchorX: {
enumerable: !0,
get: function() {
return i
},
set: function(e) {
if (!M(e))
throw new Error("RegionAnchorY must be between 0 and 100.");
i = e
}
},
viewportAnchorY: {
enumerable: !0,
get: function() {
return a
},
set: function(e) {
if (!M(e))
throw new Error("ViewportAnchorY must be between 0 and 100.");
a = e
}
},
viewportAnchorX: {
enumerable: !0,
get: function() {
return r
},
set: function(e) {
if (!M(e))
throw new Error("ViewportAnchorX must be between 0 and 100.");
r = e
}
},
scroll: {
enumerable: !0,
get: function() {
return s
},
set: function(e) {
var t = N(e);
t === !1 ? console.warn("Scroll: an invalid or illegal string was specified.") : s = t
}
}
})
}
function U() {
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 (e) {
return !1
}
}
function F(e, t) {
if ("function" != typeof t && null !== t)
throw new TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && qr(e, t)
}
function B(e) {
return e && "object" == typeof e && "default"in e ? e["default"] : e
}
function j(e) {
return e && "object" == typeof e && "default"in e ? e["default"] : e
}
function V(e) {
for (var t = ea(e), i = new Uint8Array(t.length), n = 0; n < t.length; n++)
i[n] = t.charCodeAt(n);
return i
}
function q() {}
function H(e, t, i, n, r) {
function a(e) {
if (e > 65535) {
e -= 65536;
var t = 55296 + (e >> 10)
, i = 56320 + (1023 & e);
return String.fromCharCode(t, i)
}
return String.fromCharCode(e)
}
function s(e) {
var t = e.slice(1, -1);
return t in i ? i[t] : "#" === t.charAt(0) ? a(parseInt(t.substr(1).replace("x", "0x"))) : (r.error("entity not found:" + e),
e)
}
function o(t) {
if (t > m) {
var i = e.substring(m, t).replace(/&#?\w+;/g, s);
h && u(m),
n.characters(i, 0, t - m),
m = t
}
}
function u(t, i) {
for (; t >= c && (i = d.exec(e)); )
l = i.index,
c = l + i[0].length,
h.lineNumber++;
h.columnNumber = t - l + 1
}
for (var l = 0, c = 0, d = /.*(?:\r\n?|\n)|.*$/g, h = n.locator, f = [{
currentNSMap: t
}], p = {}, m = 0; ; ) {
try {
var g = e.indexOf("<", m);
if (0 > g) {
if (!e.substr(m).match(/^\s*$/)) {
var v = n.doc
, y = v.createTextNode(e.substr(m));
v.appendChild(y),
n.currentElement = y
}
return
}
switch (g > m && o(g),
e.charAt(g + 1)) {
case "/":
var _ = e.indexOf(">", g + 3)
, b = e.substring(g + 2, _)
, T = f.pop();
0 > _ ? (b = e.substring(g + 2).replace(/[\s<].*/, ""),
r.error("end tag name: " + b + " is not complete:" + T.tagName),
_ = g + 1 + b.length) : b.match(/\s</) && (b = b.replace(/[\s<].*/, ""),
r.error("end tag name: " + b + " maybe not complete"),
_ = g + 1 + b.length);
var S = T.localNSMap
, C = T.tagName == b
, E = C || T.tagName && T.tagName.toLowerCase() == b.toLowerCase();
if (E) {
if (n.endElement(T.uri, T.localName, b),
S)
for (var k in S)
n.endPrefixMapping(k);
C || r.fatalError("end tag name: " + b + " is not match the current start tagName:" + T.tagName)
} else
f.push(T);
_++;
break;
case "?":
h && u(g),
_ = Q(e, g, n);
break;
case "!":
h && u(g),
_ = $(e, g, n, r);
break;
default:
h && u(g);
var w = new J
, I = f[f.length - 1].currentNSMap
, _ = z(e, g, w, I, s, r)
, A = w.length;
if (!w.closed && K(e, _, w.tagName, p) && (w.closed = !0,
i.nbsp || r.warning("unclosed xml attribute")),
h && A) {
for (var x = W(h, {}), P = 0; A > P; P++) {
var L = w[P];
u(L.offset),
L.locator = W(h, {})
}
n.locator = x,
G(w, n, I) && f.push(w),
n.locator = h
} else
G(w, n, I) && f.push(w);
"http://www.w3.org/1999/xhtml" !== w.uri || w.closed ? _++ : _ = X(e, _, w.tagName, s, n)
}
} catch (D) {
r.error("element parse error: " + D),
_ = -1
}
_ > m ? m = _ : o(Math.max(g, m) + 1)
}
}
function W(e, t) {
return t.lineNumber = e.lineNumber,
t.columnNumber = e.columnNumber,
t
}
function z(e, t, i, n, r, a) {
for (var s, o, u = ++t, l = ha; ; ) {
var c = e.charAt(u);
switch (c) {
case "=":
if (l === fa)
s = e.slice(t, u),
l = ma;
else {
if (l !== pa)
throw new Error("attribute equal must after attrName");
l = ma
}
break;
case "'":
case '"':
if (l === ma || l === fa) {
if (l === fa && (a.warning('attribute value must after "="'),
s = e.slice(t, u)),
t = u + 1,
u = e.indexOf(c, t),
!(u > 0))
throw new Error("attribute value no end '" + c + "' match");
o = e.slice(t, u).replace(/&#?\w+;/g, r),
i.add(s, o, t - 1),
l = va
} else {
if (l != ga)
throw new Error('attribute value must after "="');
o = e.slice(t, u).replace(/&#?\w+;/g, r),
i.add(s, o, t),
a.warning('attribute "' + s + '" missed start quot(' + c + ")!!"),
t = u + 1,
l = va
}
break;
case "/":
switch (l) {
case ha:
i.setTagName(e.slice(t, u));
case va:
case ya:
case _a:
l = _a,
i.closed = !0;
case ga:
case fa:
case pa:
break;
default:
throw new Error("attribute invalid close char('/')")
}
break;
case "":
return a.error("unexpected end of input"),
l == ha && i.setTagName(e.slice(t, u)),
u;
case ">":
switch (l) {
case ha:
i.setTagName(e.slice(t, u));
case va:
case ya:
case _a:
break;
case ga:
case fa:
o = e.slice(t, u),
"/" === o.slice(-1) && (i.closed = !0,
o = o.slice(0, -1));
case pa:
l === pa && (o = s),
l == ga ? (a.warning('attribute "' + o + '" missed quot(")!!'),
i.add(s, o.replace(/&#?\w+;/g, r), t)) : ("http://www.w3.org/1999/xhtml" === n[""] && o.match(/^(?:disabled|checked|selected)$/i) || a.warning('attribute "' + o + '" missed value!! "' + o + '" instead!!'),
i.add(o, o, t));
break;
case ma:
throw new Error("attribute value missed!!")
}
return u;
case "€":
c = " ";
default:
if (" " >= c)
switch (l) {
case ha:
i.setTagName(e.slice(t, u)),
l = ya;
break;
case fa:
s = e.slice(t, u),
l = pa;
break;
case ga:
var o = e.slice(t, u).replace(/&#?\w+;/g, r);
a.warning('attribute "' + o + '" missed quot(")!!'),
i.add(s, o, t);
case va:
l = ya
}
else
switch (l) {
case pa:
i.tagName,
"http://www.w3.org/1999/xhtml" === n[""] && s.match(/^(?:disabled|checked|selected)$/i) || a.warning('attribute "' + s + '" missed value!! "' + s + '" instead2!!'),
i.add(s, s, t),
t = u,
l = fa;
break;
case va:
a.warning('attribute space is required"' + s + '"!!');
case ya:
l = fa,
t = u;
break;
case ma:
l = ga,
t = u;
break;
case _a:
throw new Error("elements closed character '/' and '>' must be connected to")
}
}
u++
}
}
function G(e, t, i) {
for (var n = e.tagName, r = null, a = e.length; a--; ) {
var s = e[a]
, o = s.qName
, u = s.value
, l = o.indexOf(":");
if (l > 0)
var c = s.prefix = o.slice(0, l)
, d = o.slice(l + 1)
, h = "xmlns" === c && d;
else
d = o,
c = null,
h = "xmlns" === o && "";
s.localName = d,
h !== !1 && (null == r && (r = {},
Y(i, i = {})),
i[h] = r[h] = u,
s.uri = "http://www.w3.org/2000/xmlns/",
t.startPrefixMapping(h, u))
}
for (var a = e.length; a--; ) {
s = e[a];
var c = s.prefix;
c && ("xml" === c && (s.uri = "http://www.w3.org/XML/1998/namespace"),
"xmlns" !== c && (s.uri = i[c || ""]))
}
var l = n.indexOf(":");
l > 0 ? (c = e.prefix = n.slice(0, l),
d = e.localName = n.slice(l + 1)) : (c = null,
d = e.localName = n);
var f = e.uri = i[c || ""];
if (t.startElement(f, d, n, e),
!e.closed)
return e.currentNSMap = i,
e.localNSMap = r,
!0;
if (t.endElement(f, d, n),
r)
for (c in r)
t.endPrefixMapping(c)
}
function X(e, t, i, n, r) {
if (/^(?:script|textarea)$/i.test(i)) {
var a = e.indexOf("</" + i + ">", t)
, s = e.substring(t + 1, a);
if (/[&<]/.test(s))
return /^script$/i.test(i) ? (r.characters(s, 0, s.length),
a) : (s = s.replace(/&#?\w+;/g, n),
r.characters(s, 0, s.length),
a)
}
return t + 1
}
function K(e, t, i, n) {
var r = n[i];
return null == r && (r = e.lastIndexOf("</" + i + ">"),
t > r && (r = e.lastIndexOf("</" + i)),
n[i] = r),
t > r
}
function Y(e, t) {
for (var i in e)
t[i] = e[i]
}
function $(e, t, i, n) {
var r = e.charAt(t + 2);
switch (r) {
case "-":
if ("-" === e.charAt(t + 3)) {
var a = e.indexOf("-->", t + 4);
return a > t ? (i.comment(e, t + 4, a - t - 4),
a + 3) : (n.error("Unclosed comment"),
-1)
}
return -1;
default:
if ("CDATA[" == e.substr(t + 3, 6)) {
var a = e.indexOf("]]>", t + 9);
return i.startCDATA(),
i.characters(e, t + 9, a - t - 9),
i.endCDATA(),
a + 3
}
var s = et(e, t)
, o = s.length;
if (o > 1 && /!doctype/i.test(s[0][0])) {
var u = s[1][0]
, l = o > 3 && /^public$/i.test(s[2][0]) && s[3][0]
, c = o > 4 && s[4][0]
, d = s[o - 1];
return i.startDTD(u, l && l.replace(/^(['"])(.*?)\1$/, "$2"), c && c.replace(/^(['"])(.*?)\1$/, "$2")),
i.endDTD(),
d.index + d[0].length
}
}
return -1
}
function Q(e, t, i) {
var n = e.indexOf("?>", t);
if (n) {
var r = e.substring(t, n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
return r ? (r[0].length,
i.processingInstruction(r[1], r[2]),
n + 2) : -1
}
return -1
}
function J() {}
function Z(e, t) {
return e.__proto__ = t,
e
}
function et(e, t) {
var i, n = [], r = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
for (r.lastIndex = t,
r.exec(e); i = r.exec(e); )
if (n.push(i),
i[1])
return n
}
function tt(e, t) {
for (var i in e)
t[i] = e[i]
}
function it(e, t) {
var i = e.prototype;
if (Object.create) {
var n = Object.create(t.prototype);
i.__proto__ = n
}
if (!(i instanceof t)) {
var r = function() {};
r.prototype = t.prototype,
r = new r,
tt(i, r),
e.prototype = i = r
}
i.constructor != e && ("function" != typeof e && console.error("unknow Class:" + e),
i.constructor = e)
}
function nt(e, t) {
if (t instanceof Error)
var i = t;
else
i = this,
Error.call(this, Ua[e]),
this.message = Ua[e],
Error.captureStackTrace && Error.captureStackTrace(this, nt);
return i.code = e,
t && (this.message = this.message + ": " + t),
i
}
function rt() {}
function at(e, t) {
this._node = e,
this._refresh = t,
st(this)
}
function st(e) {
var t = e._node._inc || e._node.ownerDocument._inc;
if (e._inc != t) {
var i = e._refresh(e._node);
jt(e, "length", i.length),
tt(i, e),
e._inc = t
}
}
function ot() {}
function ut(e, t) {
for (var i = e.length; i--; )
if (e[i] === t)
return i
}
function lt(e, t, i, n) {
if (n ? t[ut(t, n)] = i : t[t.length++] = i,
e) {
i.ownerElement = e;
var r = e.ownerDocument;
r && (n && vt(r, e, n),
gt(r, e, i))
}
}
function ct(e, t, i) {
var n = ut(t, i);
if (!(n >= 0))
throw nt(Ba, new Error(e.tagName + "@" + i));
for (var r = t.length - 1; r > n; )
t[n] = t[++n];
if (t.length = r,
e) {
var a = e.ownerDocument;
a && (vt(a, e, i),
i.ownerElement = null)
}
}
function dt(e) {
if (this._features = {},
e)
for (var t in e)
this._features = e[t]
}
function ht() {}
function ft(e) {
return "<" == e && "&lt;" || ">" == e && "&gt;" || "&" == e && "&amp;" || '"' == e && "&quot;" || "&#" + e.charCodeAt() + ";"
}
function pt(e, t) {
if (t(e))
return !0;
if (e = e.firstChild)
do
if (pt(e, t))
return !0;
while (e = e.nextSibling)
}
function mt() {}
function gt(e, t, i) {
e && e._inc++;
var n = i.namespaceURI;
"http://www.w3.org/2000/xmlns/" == n && (t._nsMap[i.prefix ? i.localName : ""] = i.value)
}
function vt(e, t, i) {
e && e._inc++;
var n = i.namespaceURI;
"http://www.w3.org/2000/xmlns/" == n && delete t._nsMap[i.prefix ? i.localName : ""]
}
function yt(e, t, i) {
if (e && e._inc) {
e._inc++;
var n = t.childNodes;
if (i)
n[n.length++] = i;
else {
for (var r = t.firstChild, a = 0; r; )
n[a++] = r,
r = r.nextSibling;
n.length = a
}
}
}
function _t(e, t) {
var i = t.previousSibling
, n = t.nextSibling;
return i ? i.nextSibling = n : e.firstChild = n,
n ? n.previousSibling = i : e.lastChild = i,
yt(e.ownerDocument, e),
t
}
function bt(e, t, i) {
var n = t.parentNode;
if (n && n.removeChild(t),
t.nodeType === Na) {
var r = t.firstChild;
if (null == r)
return t;
var a = t.lastChild
} else
r = a = t;
var s = i ? i.previousSibling : e.lastChild;
r.previousSibling = s,
a.nextSibling = i,
s ? s.nextSibling = r : e.firstChild = r,
null == i ? e.lastChild = a : i.previousSibling = a;
do
r.parentNode = e;
while (r !== a && (r = r.nextSibling));
return yt(e.ownerDocument || e, e),
t.nodeType == Na && (t.firstChild = t.lastChild = null),
t
}
function Tt(e, t) {
var i = t.parentNode;
if (i) {
var n = e.lastChild;
i.removeChild(t);
var n = e.lastChild
}
var n = e.lastChild;
return t.parentNode = e,
t.previousSibling = n,
t.nextSibling = null,
n ? n.nextSibling = t : e.firstChild = t,
e.lastChild = t,
yt(e.ownerDocument, e, t),
t
}
function St() {
this._nsMap = {}
}
function Ct() {}
function Et() {}
function kt() {}
function wt() {}
function It() {}
function At() {}
function xt() {}
function Pt() {}
function Lt() {}
function Dt() {}
function Ot() {}
function Nt() {}
function Mt(e, t) {
var i = []
, n = 9 == this.nodeType ? this.documentElement : this
, r = n.prefix
, a = n.namespaceURI;
if (a && null == r) {
var r = n.lookupPrefix(a);
if (null == r)
var s = [{
namespace: a,
prefix: null
}]
}
return Ut(this, i, e, t, s),
i.join("")
}
function Rt(e, t, i) {
var n = e.prefix || ""
, r = e.namespaceURI;
if (!n && !r)
return !1;
if ("xml" === n && "http://www.w3.org/XML/1998/namespace" === r || "http://www.w3.org/2000/xmlns/" == r)
return !1;
for (var a = i.length; a--; ) {
var s = i[a];
if (s.prefix == n)
return s.namespace != r
}
return !0
}
function Ut(e, t, i, n, r) {
if (n) {
if (e = n(e),
!e)
return;
if ("string" == typeof e)
return void t.push(e)
}
switch (e.nodeType) {
case Ea:
r || (r = []),
r.length;
var a = e.attributes
, s = a.length
, o = e.firstChild
, u = e.tagName;
i = Sa === e.namespaceURI || i,
t.push("<", u);
for (var l = 0; s > l; l++) {
var c = a.item(l);
"xmlns" == c.prefix ? r.push({
prefix: c.localName,
namespace: c.value
}) : "xmlns" == c.nodeName && r.push({
prefix: "",
namespace: c.value
})
}
for (var l = 0; s > l; l++) {
var c = a.item(l);
if (Rt(c, i, r)) {
var d = c.prefix || ""
, h = c.namespaceURI
, f = d ? " xmlns:" + d : " xmlns";
t.push(f, '="', h, '"'),
r.push({
prefix: d,
namespace: h
})
}
Ut(c, t, i, n, r)
}
if (Rt(e, i, r)) {
var d = e.prefix || ""
, h = e.namespaceURI
, f = d ? " xmlns:" + d : " xmlns";
t.push(f, '="', h, '"'),
r.push({
prefix: d,
namespace: h
})
}
if (o || i && !/^(?:meta|link|img|br|hr|input)$/i.test(u)) {
if (t.push(">"),
i && /^script$/i.test(u))
for (; o; )
o.data ? t.push(o.data) : Ut(o, t, i, n, r),
o = o.nextSibling;
else
for (; o; )
Ut(o, t, i, n, r),
o = o.nextSibling;
t.push("</", u, ">")
} else
t.push("/>");
return;
case Da:
case Na:
for (var o = e.firstChild; o; )
Ut(o, t, i, n, r),
o = o.nextSibling;
return;
case ka:
return t.push(" ", e.name, '="', e.value.replace(/[<&"]/g, ft), '"');
case wa:
return t.push(e.data.replace(/[<&]/g, ft));
case Ia:
return t.push("<![CDATA[", e.data, "]]>");
case La:
return t.push("<!--", e.data, "-->");
case Oa:
var p = e.publicId
, m = e.systemId;
if (t.push("<!DOCTYPE ", e.name),
p)
t.push(' PUBLIC "', p),
m && "." != m && t.push('" "', m),
t.push('">');
else if (m && "." != m)
t.push(' SYSTEM "', m, '">');
else {
var g = e.internalSubset;
g && t.push(" [", g, "]"),
t.push(">")
}
return;
case Pa:
return t.push("<?", e.target, " ", e.data, "?>");
case Aa:
return t.push("&", e.nodeName, ";");
default:
t.push("??", e.nodeName)
}
}
function Ft(e, t, i) {
var n;
switch (t.nodeType) {
case Ea:
n = t.cloneNode(!1),
n.ownerDocument = e;
case Na:
break;
case ka:
i = !0
}
if (n || (n = t.cloneNode(!1)),
n.ownerDocument = e,
n.parentNode = null,
i)
for (var r = t.firstChild; r; )
n.appendChild(Ft(e, r, i)),
r = r.nextSibling;
return n
}
function Bt(e, t, i) {
var n = new t.constructor;
for (var r in t) {
var a = t[r];
"object" != typeof a && a != n[r] && (n[r] = a)
}
switch (t.childNodes && (n.childNodes = new rt),
n.ownerDocument = e,
n.nodeType) {
case Ea:
var s = t.attributes
, o = n.attributes = new ot
, u = s.length;
o._ownerElement = n;
for (var l = 0; u > l; l++)
n.setAttributeNode(Bt(e, s.item(l), !0));
break;
case ka:
i = !0
}
if (i)
for (var c = t.firstChild; c; )
n.appendChild(Bt(e, c, i)),
c = c.nextSibling;
return n
}
function jt(e, t, i) {
e[t] = i
}
function Vt(e) {
var t, i = "info", n = function() {
for (var e = arguments.length, n = new Array(e), r = 0; e > r; r++)
n[r] = arguments[r];
t("log", i, n)
};
return t = Wu(e, n),
n.createLogger = function(t) {
return Vt(e + ": " + t)
}
,
n.levels = {
all: "debug|log|warn|error",
off: "",
debug: "debug|log|warn|error",
info: "log|warn|error",
warn: "warn|error",
error: "error",
DEFAULT: i
},
n.level = function(e) {
if ("string" == typeof e) {
if (!n.levels.hasOwnProperty(e))
throw new Error('"' + e + '" in not a valid log level');
i = e
}
return i
}
,
n.history = function() {
return Hu ? [].concat(Hu) : []
}
,
n.history.filter = function(e) {
return (Hu || []).filter(function(t) {
return new RegExp(".*" + e + ".*").test(t[0])
})
}
,
n.history.clear = function() {
Hu && (Hu.length = 0)
}
,
n.history.disable = function() {
null !== Hu && (Hu.length = 0,
Hu = null)
}
,
n.history.enable = function() {
null === Hu && (Hu = [])
}
,
n.error = function() {
for (var e = arguments.length, n = new Array(e), r = 0; e > r; r++)
n[r] = arguments[r];
return t("error", i, n)
}
,
n.warn = function() {
for (var e = arguments.length, n = new Array(e), r = 0; e > r; r++)
n[r] = arguments[r];
return t("warn", i, n)
}
,
n.debug = function() {
for (var e = arguments.length, n = new Array(e), r = 0; e > r; r++)
n[r] = arguments[r];
return t("debug", i, n)
}
,
n
}
function qt(e, t) {
Ku(e).forEach(function(i) {
return t(e[i], i)
})
}
function Ht(e, t, i) {
return void 0 === i && (i = 0),
Ku(e).reduce(function(i, n) {
return t(i, e[n], n)
}, i)
}
function Wt(e) {
for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), n = 1; t > n; n++)
i[n - 1] = arguments[n];
return Object.assign ? fr.apply(void 0, [e].concat(i)) : (i.forEach(function(t) {
t && qt(t, function(t, i) {
e[i] = t
})
}),
e)
}
function zt(e) {
return !!e && "object" == typeof e
}
function Gt(e) {
return zt(e) && "[object Object]" === Xu.call(e) && e.constructor === Object
}
function Xt(e, t) {
if (!e || !t)
return "";
if ("function" == typeof dr["default"].getComputedStyle) {
var i = dr["default"].getComputedStyle(e);
return i ? i.getPropertyValue(t) || i[t] : ""
}
return ""
}
function Kt(e) {
return "string" == typeof e && Boolean(e.trim())
}
function Yt(e) {
if (e.indexOf(" ") >= 0)
throw new Error("class has illegal whitespace characters")
}
function $t(e) {
return new RegExp("(^|\\s)" + e + "($|\\s)")
}
function Qt() {
return hr["default"] === dr["default"].document
}
function Jt(e) {
return zt(e) && 1 === e.nodeType
}
function Zt() {
try {
return dr["default"].parent !== dr["default"].self
} catch (e) {
return !0
}
}
function ei(e) {
return function(t, i) {
if (!Kt(t))
return hr["default"][e](null);
Kt(i) && (i = hr["default"].querySelector(i));
var n = Jt(i) ? i : hr["default"];
return n[e] && n[e](t)
}
}
function ti(e, t, i, n) {
void 0 === e && (e = "div"),
void 0 === t && (t = {}),
void 0 === i && (i = {});
var r = hr["default"].createElement(e);
return Object.getOwnPropertyNames(t).forEach(function(e) {
var i = t[e];
-1 !== e.indexOf("aria-") || "role" === e || "type" === e ? (zu.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\n" + ("createEl(type, properties, attributes). Attempting to set " + e + " to " + i + ".")),
r.setAttribute(e, i)) : "textContent" === e ? ii(r, i) : r[e] !== i && (r[e] = i)
}),
Object.getOwnPropertyNames(i).forEach(function(e) {
r.setAttribute(e, i[e])
}),
n && Ti(r, n),
r
}
function ii(e, t) {
return "undefined" == typeof e.textContent ? e.innerText = t : e.textContent = t,
e
}
function ni(e, t) {
t.firstChild ? t.insertBefore(e, t.firstChild) : t.appendChild(e)
}
function ri(e, t) {
return Yt(t),
e.classList ? e.classList.contains(t) : $t(t).test(e.className)
}
function ai(e, t) {
return e.classList ? e.classList.add(t) : ri(e, t) || (e.className = (e.className + " " + t).trim()),
e
}
function si(e, t) {
return e.classList ? e.classList.remove(t) : (Yt(t),
e.className = e.className.split(/\s+/).filter(function(e) {
return e !== t
}).join(" ")),
e
}
function oi(e, t, i) {
var n = ri(e, t);
return "function" == typeof i && (i = i(e, t)),
"boolean" != typeof i && (i = !n),
i !== n ? (i ? ai(e, t) : si(e, t),
e) : void 0
}
function ui(e, t) {
Object.getOwnPropertyNames(t).forEach(function(i) {
var n = t[i];
null === n || "undefined" == typeof n || n === !1 ? e.removeAttribute(i) : e.setAttribute(i, n === !0 ? "" : n)
})
}
function li(e) {
var t = {}
, i = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
if (e && e.attributes && e.attributes.length > 0)
for (var n = e.attributes, r = n.length - 1; r >= 0; r--) {
var a = n[r].name
, s = n[r].value;
("boolean" == typeof e[a] || -1 !== i.indexOf("," + a + ",")) && (s = null !== s ? !0 : !1),
t[a] = s
}
return t
}
function ci(e, t) {
return e.getAttribute(t)
}
function di(e, t, i) {
e.setAttribute(t, i)
}
function hi(e, t) {
e.removeAttribute(t)
}
function fi() {
hr["default"].body.focus(),
hr["default"].onselectstart = function() {
return !1
}
}
function pi() {
hr["default"].onselectstart = function() {
return !0
}
}
function mi(e) {
if (e && e.getBoundingClientRect && e.parentNode) {
var t = e.getBoundingClientRect()
, i = {};
return ["bottom", "height", "left", "right", "top", "width"].forEach(function(e) {
void 0 !== t[e] && (i[e] = t[e])
}),
i.height || (i.height = parseFloat(Xt(e, "height"))),
i.width || (i.width = parseFloat(Xt(e, "width"))),
i
}
}
function gi(e) {
if (!e || e && !e.offsetParent)
return {
left: 0,
top: 0,
width: 0,
height: 0
};
var t = e.offsetWidth
, i = e.offsetHeight
, n = 0
, r = 0;
do
n += e.offsetLeft,
r += e.offsetTop,
e = e.offsetParent;
while (e);
return {
left: n,
top: r,
width: t,
height: i
}
}
function vi(e, t) {
var i = {}
, n = gi(t.target)
, r = gi(e)
, a = r.width
, s = r.height
, o = t.offsetY - (r.top - n.top)
, u = t.offsetX - (r.left - n.left);
return t.changedTouches && (u = t.changedTouches[0].pageX - r.left,
o = t.changedTouches[0].pageY + r.top),
i.y = 1 - Math.max(0, Math.min(1, o / s)),
i.x = Math.max(0, Math.min(1, u / a)),
i
}
function yi(e) {
return zt(e) && 3 === e.nodeType
}
function _i(e) {
for (; e.firstChild; )
e.removeChild(e.firstChild);
return e
}
function bi(e) {
return "function" == typeof e && (e = e()),
(Array.isArray(e) ? e : [e]).map(function(e) {
return "function" == typeof e && (e = e()),
Jt(e) || yi(e) ? e : "string" == typeof e && /\S/.test(e) ? hr["default"].createTextNode(e) : void 0
}).filter(function(e) {
return e
})
}
function Ti(e, t) {
return bi(t).forEach(function(t) {
return e.appendChild(t)
}),
e
}
function Si(e, t) {
return Ti(_i(e), t)
}
function Ci(e) {
return void 0 === e.button && void 0 === e.buttons ? !0 : 0 === e.button && void 0 === e.buttons ? !0 : "mouseup" === e.type && 0 === e.button && 0 === e.buttons ? !0 : 0 !== e.button || 1 !== e.buttons ? !1 : !0
}
function Ei(e, t) {
t && (Vu = t),
dr["default"].setTimeout(Zu, e)
}
function ki() {
Ju = !0,
dr["default"].removeEventListener("load", ki)
}
function wi() {
return rl++
}
function Ii(e, t) {
if (sl.has(e)) {
var i = sl.get(e);
0 === i.handlers[t].length && (delete i.handlers[t],
e.removeEventListener ? e.removeEventListener(t, i.dispatcher, !1) : e.detachEvent && e.detachEvent("on" + t, i.dispatcher)),
Object.getOwnPropertyNames(i.handlers).length <= 0 && (delete i.handlers,
delete i.dispatcher,
delete i.disabled),
0 === Object.getOwnPropertyNames(i).length && sl["delete"](e)
}
}
function Ai(e, t, i, n) {
i.forEach(function(i) {
e(t, i, n)
})
}
function xi(e) {
function t() {
return !0
}
function i() {
return !1
}
if (e.fixed_)
return e;
if (!e || !e.isPropagationStopped) {
var n = e || dr["default"].event;
e = {};
for (var r in n)
"layerX" !== r && "layerY" !== r && "keyLocation" !== r && "webkitMovementX" !== r && "webkitMovementY" !== r && ("returnValue" === r && n.preventDefault || (e[r] = n[r]));
if (e.target || (e.target = e.srcElement || hr["default"]),
e.relatedTarget || (e.relatedTarget = e.fromElement === e.target ? e.toElement : e.fromElement),
e.preventDefault = function() {
n.preventDefault && n.preventDefault(),
e.returnValue = !1,
n.returnValue = !1,
e.defaultPrevented = !0
}
,
e.defaultPrevented = !1,
e.stopPropagation = function() {
n.stopPropagation && n.stopPropagation(),
e.cancelBubble = !0,
n.cancelBubble = !0,
e.isPropagationStopped = t
}
,
e.isPropagationStopped = i,
e.stopImmediatePropagation = function() {
n.stopImmediatePropagation && n.stopImmediatePropagation(),
e.isImmediatePropagationStopped = t,
e.stopPropagation()
}
,
e.isImmediatePropagationStopped = i,
null !== e.clientX && void 0 !== e.clientX) {
var a = hr["default"].documentElement
, s = hr["default"].body;
e.pageX = e.clientX + (a && a.scrollLeft || s && s.scrollLeft || 0) - (a && a.clientLeft || s && s.clientLeft || 0),
e.pageY = e.clientY + (a && a.scrollTop || s && s.scrollTop || 0) - (a && a.clientTop || s && s.clientTop || 0)
}
e.which = e.charCode || e.keyCode,
null !== e.button && void 0 !== e.button && (e.button = 1 & e.button ? 0 : 4 & e.button ? 1 : 2 & e.button ? 2 : 0)
}
return e.fixed_ = !0,
e
}
function Pi(e, t, i) {
if (Array.isArray(t))
return Ai(Pi, e, t, i);
sl.has(e) || sl.set(e, {});
var n = sl.get(e);
if (n.handlers || (n.handlers = {}),
n.handlers[t] || (n.handlers[t] = []),
i.guid || (i.guid = wi()),
n.handlers[t].push(i),
n.dispatcher || (n.disabled = !1,
n.dispatcher = function(t, i) {
if (!n.disabled) {
t = xi(t);
var r = n.handlers[t.type];
if (r)
for (var a = r.slice(0), s = 0, o = a.length; o > s && !t.isImmediatePropagationStopped(); s++)
try {
a[s].call(e, t, i)
} catch (u) {
zu.error(u)
}
}
}
),
1 === n.handlers[t].length)
if (e.addEventListener) {
var r = !1;
ol() && ul.indexOf(t) > -1 && (r = {
passive: !0
}),
e.addEventListener(t, n.dispatcher, r)
} else
e.attachEvent && e.attachEvent("on" + t, n.dispatcher)
}
function Li(e, t, i) {
if (sl.has(e)) {
var n = sl.get(e);
if (n.handlers) {
if (Array.isArray(t))
return Ai(Li, e, t, i);
var r = function(e, t) {
n.handlers[t] = [],
Ii(e, t)
};
if (void 0 !== t) {
var a = n.handlers[t];
if (a) {
if (!i)
return void r(e, t);
if (i.guid)
for (var s = 0; s < a.length; s++)
a[s].guid === i.guid && a.splice(s--, 1);
Ii(e, t)
}
} else
for (var o in n.handlers)
Object.prototype.hasOwnProperty.call(n.handlers || {}, o) && r(e, o)
}
}
}
function Di(e, t, i) {
var n = sl.has(e) ? sl.get(e) : {}
, r = e.parentNode || e.ownerDocument;
if ("string" == typeof t ? t = {
type: t,
target: e
} : t.target || (t.target = e),
t = xi(t),
n.dispatcher && n.dispatcher.call(e, t, i),
r && !t.isPropagationStopped() && t.bubbles === !0)
Di.call(null, r, t, i);
else if (!r && !t.defaultPrevented && t.target && t.target[t.type]) {
sl.has(t.target) || sl.set(t.target, {});
var a = sl.get(t.target);
t.target[t.type] && (a.disabled = !0,
"function" == typeof t.target[t.type] && t.target[t.type](),
a.disabled = !1)
}
return !t.defaultPrevented
}
function Oi(e, t, i) {
if (Array.isArray(t))
return Ai(Oi, e, t, i);
var n = function r() {
Li(e, t, r),
i.apply(this, arguments)
};
n.guid = i.guid = i.guid || wi(),
Pi(e, t, n)
}
function Ni(e, t, i) {
var n = function r() {
Li(e, t, r),
i.apply(this, arguments)
};
n.guid = i.guid = i.guid || wi(),
Pi(e, t, n)
}
function Mi(e, t) {
void 0 === t && (t = {});
var i = t
, n = i.eventBusKey;
if (n) {
if (!e[n].nodeName)
throw new Error('The eventBusKey "' + n + '" does not refer to an element.');
e.eventBusEl_ = e[n]
} else
e.eventBusEl_ = ti("span", {
className: "vjs-event-bus"
});
return Wt(e, El),
e.eventedCallbacks && e.eventedCallbacks.forEach(function(e) {
e()
}),
e.on("dispose", function() {
e.off(),
dr["default"].setTimeout(function() {
e.eventBusEl_ = null
}, 0)
}),
e
}
function Ri(e, t) {
return Wt(e, kl),
e.state = Wt({}, e.state, t),
"function" == typeof e.handleStateChanged && gl(e) && e.on("statechanged", e.handleStateChanged),
e
}
function Ui() {
for (var e = {}, t = arguments.length, i = new Array(t), n = 0; t > n; n++)
i[n] = arguments[n];
return i.forEach(function(t) {
t && qt(t, function(t, i) {
return Gt(t) ? (Gt(e[i]) || (e[i] = {}),
void (e[i] = Ui(e[i], t))) : void (e[i] = t)
})
}),
e
}
function Fi(e, t, i) {
if ("number" != typeof t || 0 > t || t > i)
throw new Error("Failed to execute '" + e + "' on 'TimeRanges': The index provided (" + t + ") is non-numeric or out of bounds (0-" + i + ").")
}
function Bi(e, t, i, n) {
return Fi(e, n, i.length - 1),
i[n][t]
}
function ji(e) {
return void 0 === e || 0 === e.length ? {
length: 0,
start: function() {
throw new Error("This TimeRanges object is empty")
},
end: function() {
throw new Error("This TimeRanges object is empty")
}
} : {
length: e.length,
start: Bi.bind(null, "start", 0, e),
end: Bi.bind(null, "end", 1, e)
}
}
function Vi(e, t) {
return Array.isArray(e) ? ji(e) : void 0 === e || void 0 === t ? ji() : ji([[e, t]])
}
function qi(e, t) {
var i, n, r = 0;
if (!t)
return 0;
e && e.length || (e = Vi(0, 0));
for (var a = 0; a < e.length; a++)
i = e.start(a),
n = e.end(a),
n > t && (n = t),
r += n - i;
return r / t
}
function Hi(e) {
return e instanceof Hi ? e : ("number" == typeof e ? this.code = e : "string" == typeof e ? this.message = e : zt(e) && ("number" == typeof e.code && (this.code = e.code),
Wt(this, e)),
void (this.message || (this.message = Hi.defaultMessages[this.code] || "")))
}
function Wi(e) {
return void 0 !== e && null !== e && "function" == typeof e.then
}
function zi(e) {
Wi(e) && e.then(null, function() {})
}
function Gi(e, t, i, n, r) {
void 0 === r && (r = {});
var a = e.textTracks();
r.kind = t,
i && (r.label = i),
n && (r.language = n),
r.tech = e;
var s = new zc.text.TrackClass(r);
return a.addTrack(s),
s
}
function Xi(e, t) {
Xc[e] = Xc[e] || [],
Xc[e].push(t)
}
function Ki(e, t, i) {
e.setTimeout(function() {
return rn(t, Xc[t.type], i, e)
}, 1)
}
function Yi(e, t) {
e.forEach(function(e) {
return e.setTech && e.setTech(t)
})
}
function $i(e, t, i) {
return e.reduceRight(Zi(i), t[i]())
}
function Qi(e, t, i, n) {
return t[i](e.reduce(Zi(i), n))
}
function Ji(e, t, i, n) {
void 0 === n && (n = null);
var r = "call" + Il(i)
, a = e.reduce(Zi(r), n)
, s = a === Yc
, o = s ? null : t[i](a);
return en(e, i, o, s),
o
}
function Zi(e) {
return function(t, i) {
return t === Yc ? Yc : i[e] ? i[e](t) : t
}
}
function en(e, t, i, n) {
for (var r = e.length - 1; r >= 0; r--) {
var a = e[r];
a[t] && a[t](n, i)
}
}
function tn(e) {
Kc[e.id()] = null
}
function nn(e, t) {
var i = Kc[e.id()]
, n = null;
if (void 0 === i || null === i)
return n = t(e),
Kc[e.id()] = [[t, n]],
n;
for (var r = 0; r < i.length; r++) {
var a = i[r]
, s = a[0]
, o = a[1];
s === t && (n = o)
}
return null === n && (n = t(e),
i.push([t, n])),
n
}
function rn(e, t, i, n, r, a) {
void 0 === e && (e = {}),
void 0 === t && (t = []),
void 0 === r && (r = []),
void 0 === a && (a = !1);
var s = t
, o = s[0]
, u = s.slice(1);
if ("string" == typeof o)
rn(e, Xc[o], i, n, r, a);
else if (o) {
var l = nn(n, o);
if (!l.setSource)
return r.push(l),
rn(e, u, i, n, r, a);
l.setSource(Wt({}, e), function(t, s) {
return t ? rn(e, u, i, n, r, a) : (r.push(l),
void rn(s, e.type === s.type ? u : Xc[s.type], i, n, r, a))
})
} else
u.length ? rn(e, u, i, n, r, a) : a ? i(e, r) : rn(e, Xc["*"], i, n, r, !0)
}
function an(e) {
if (!e.type) {
var t = ed(e.src);
t && (e.type = t)
}
return e
}
function sn(e, t) {
var i;
if (4 === e.length)
i = e[1] + e[1] + e[2] + e[2] + e[3] + e[3];
else {
if (7 !== e.length)
throw new Error("Invalid color code provided, " + e + "; must be formatted as e.g. #f0e or #f604e2.");
i = e.slice(1)
}
return "rgba(" + parseInt(i.slice(0, 2), 16) + "," + parseInt(i.slice(2, 4), 16) + "," + parseInt(i.slice(4, 6), 16) + "," + t + ")"
}
function on(e, t, i) {
try {
e.style[t] = i
} catch (n) {
return
}
}
function un(e) {
gd = e
}
function ln() {
gd = md
}
function cn(e, t) {
return void 0 === t && (t = e),
gd(e, t)
}
function dn(e, t) {
return t && (e = t(e)),
e && "none" !== e ? e : void 0
}
function hn(e, t) {
var i = e.options[e.options.selectedIndex].value;
return dn(i, t)
}
function fn(e, t, i) {
if (t)
for (var n = 0; n < e.options.length; n++)
if (dn(e.options[n].value, i) === t) {
e.selectedIndex = n;
break
}
}
function pn(e, t, i) {
var n = pn.getPlayer(e);
if (n)
return t && zu.warn('Player "' + e + '" is already initialised. Options will not be applied.'),
i && n.ready(i),
n;
var r = "string" == typeof e ? Yu("#" + af(e)) : e;
if (!Jt(r))
throw new TypeError("The element or ID supplied is not valid. (videojs)");
r.ownerDocument.defaultView && r.ownerDocument.body.contains(r) || zu.warn("The element supplied is not included in the DOM"),
t = t || {},
pn.hooks("beforesetup").forEach(function(e) {
var i = e(r, Ui(t));
return !zt(i) || Array.isArray(i) ? void zu.error("please return an object in beforesetup hooks") : void (t = Ui(t, i))
});
var a = Ol.getComponent("Player");
if(!!t.techOrder&&t.techOrder[0]==="html5"){
t.controlBar.children.map(a=>{if(a.text){if(!isVIP){a.title.text="涛之雨破解-"+a.text}else if(a.text==="倍速"){a.title.text="倍速优化(快捷键支持)"}} return a})
}
return n = new a(r,t,i),
pn.hooks("setup").forEach(function(e) {
return e(n)
}),
n
}
function mn(e, t) {
return function(i) {
var n = this;
if (!t)
return new Cm(e);
if (Cm && !i) {
var r = t.toString().replace(/^function.+?{/, "").slice(0, -1)
, a = gn(r);
return this[_m] = new Cm(a),
vn(this[_m], a),
this[_m]
}
var s = {
postMessage: function(e) {
n.onmessage && setTimeout(function() {
n.onmessage({
data: e,
target: s
})
})
}
};
t.call(s),
this.postMessage = function(e) {
setTimeout(function() {
s.onmessage({
data: e,
target: n
})
})
}
,
this.isThisThread = !0
}
}
function gn(e) {
try {
return Sm.createObjectURL(new Blob([e],{
type: bm
}))
} catch (t) {
var i = new Tm;
return i.append(e),
Sm.createObjectURL(i.getBlob(type))
}
}
function vn(e, t) {
if (e && t) {
var i = e.terminate;
e.objURL = t,
e.terminate = function() {
e.objURL && Sm.revokeObjectURL(e.objURL),
i.call(e)
}
}
}
function yn() {}
function _n(e, t) {
var i, n, r, a, s = "", o = {
type: "application/x-shockwave-flash",
width: "100%",
height: "100%"
}, u = {
wmode: "transparent",
menu: !1,
allowScriptAccess: "always"
};
if (!t && e && (t = e,
e = null),
"[object Object]" === Object.prototype.toString.call(t) && t.src) {
if ("object" == typeof e ? n = e : "string" == typeof e && (n = Vv.getElementById(e)),
function(e) {
for (var i, n = e.length, r = {}; n--; )
r[e[n]] = 1;
for (i in t)
r[i] ? o[i] = t[i] : u[i] = t[i]
}(Wv.split(" ")),
$v) {
if (s = Tn(o, u),
parseFloat(t.version || Yv) > $v) {
if (Xv)
return;
a = 2,
Kv = s,
o.id = Gv,
r = t.base || _n.base || "",
r && "/" !== r.slice(-1) && (r += "/"),
u.src = r + zv,
!/%$/.test(o.width) && parseInt(o.width, 10) < 310 && (o.width = "310"),
!/%$/.test(o.height) && parseInt(o.height, 10) < 137 && (o.height = "137"),
i = "MMredirectURL=" + location.href + "&MMplayerType=" + (qv ? "ActiveX" : "PlugIn") + "&MMdoctitle=" + encodeURIComponent(Vv.title.slice(0, 47) + " - Flash Player Installation"),
u.flashvars = u.flashvars ? u.flashvars + "&" + i : i,
s = Tn(o, u),
Xv = !0
}
} else
n && n.firstChild || (s = bn(o)),
a = 1;
return n && s && (n.innerHTML = s),
a && "function" == typeof t.fallback && t.fallback(a),
n.getElementsByTagName("embed")[0]
}
}
function bn(e) {
var t = e.width
, i = e.height
, n = "number" == typeof t ? t + "px" : t
, r = "number" == typeof i ? i + "px" : i
, a = "//www.adobe.com/images/shared/download_buttons/get_flash_player.gif";
return '<a target="_blank" href="//www.adobe.com/go/getflash"><span style="display:block;cursor:pointer;background:#EFEFEF url(//' + a + ") center center no-repeat;width:" + n + ";height:" + r + ';" title="Get Adobe Flash player"></span></a>'
}
function Tn(e, t) {
var i, n = "";
if (qv) {
e.classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
n += "<object" + Sn(e) + ">";
for (i in t)
n += '<param name="' + i + '" value="' + t[i] + '">';
n += "</object>"
} else
n += "<embed" + Sn(t) + Sn(e) + ">";
return n
}
function Sn(e) {
var t, i = "";
for (t in e)
i += " " + t + '="' + e[t] + '"';
return i
}
function Cn(e) {
"string" == typeof e && (e = Vv.getElementById(e).firstChild),
e && e.tagName && (qv && "OBJECT" === e.tagName ? (e.style.display = "none",
function() {
if (4 == e.readyState) {
for (var t in e)
"function" == typeof e[t] && (e[t] = null);
e.parentNode.removeChild(e)
} else
setTimeout(arguments.callee, 15)
}()) : e && e.parentNode && e.parentNode.removeChild(e),
Xv = !1)
}
function En(e) {
var t = e.container
, i = e.unsafeHTML
, n = e.content
, r = e.flashInstallBtn
, a = e.retryBtn
, s = e.onRetry
, o = fr({
className: "vjs-tip-container"
}, e.properties)
, u = Qv.createEl("div", o)
, l = Qv.createEl("div", {
className: "vjs-tip-content"
})
, c = Ev(t) ? Qv.$("#" + wv(t)) : t;
if (i ? l.innerHTML = n : Qv.appendContent(l, n),
r) {
var d = Qv.createEl("a", {
className: "vjs-flash-install-btn",
target: "_blank",
href: "http://get.adobe.com/cn/flashplayer/",
textContent: "下载Flash插件"
});
l.appendChild(d)
}
if (a) {
var h = Qv.createEl("a", {
className: "vjs-tip-retry-btn",
href: "#",
textContent: "重试"
});
h.addEventListener("click", function(e) {
e.preventDefault(),
kv(s) ? s(e) : location.reload()
}),
l.appendChild(h)
}
for ("video" === c.tagName.toLowerCase() && (c = c.parentNode); c.firstChild; )
c.removeChild(c.firstChild);
u.appendChild(l),
c.appendChild(u)
}
function kn(e, t) {
void 0 === t && (t = {});
var i = t.errno
, n = ""
, r = !1;
31346 === i ? (n = "加载失败了,稍候重试一下吧",
r = !0) : 31066 === i || t && 404 === t.status ? n = "文件不存在,换一个吧!" : 31339 === i ? n = "该视频无法播放噢,换一个试试吧!" : 31341 === i ? n = "视频正在转码中,稍后再来试下吧..." : 31346 === i ? n = "抱歉,视频转码失败了,请换一个试试吧!" : 31304 === i ? n = "文件格式不支持转码" : 31347 === i ? n = "视频超长" : 31338 === i ? n = "分辨率或码流太高暂不支持转码" : 31023 === i ? n = "参数错误" : 31391 === i ? n = "文件违规,已根据相关法律法规予以屏蔽" : i || Jv.IS_SAFARI ? (n = "服务器有点儿忙,稍后重试一下吧...",
r = !0) : (n = "无法连接到网络,请连接后再试",
r = !0),
En({
container: e,
retryBtn: r,
content: n
})
}
function wn(e, t) {
t || (t = e,
e = t.container),
this.init = function(t) {
t = t || {},
t.container = Ev(e) ? document.getElementById(e) : e,
t.flashVars = t.flashVars || {},
t.playerID = t.playerID || "flash-player-" + Zv,
this.options = t,
this.run()
}
,
this.run = function() {
var e = this.options
, t = this.createFlashVarsString(e.flashVars);
e.handerError !== !1 && (t = this.ensureErrorVars(t)),
_n(e.container, {
id: e.playerID,
src: e.swfURL,
flashvars: t,
allowFullScreenInteractive: e.allowFullScreenInteractive || !0,
allowFullScreen: e.allowFullScreen || !0,
wmode: e.wmode || "Opaque",
quality: e.quality || "high"
})
}
,
this.createFlashVarsString = function() {
var e = this.options.flashVars
, t = "";
if (Ev(e))
return e;
for (var i in e)
e.hasOwnProperty(i) && (t = t + i + "=" + e[i] + "&");
return t.slice(0, -1)
}
,
this.ensureErrorVars = function(e) {
var t = this
, i = (e.match(/onError=([^&]+)/) || ["", ""])[1];
if (i = decodeURIComponent(i)) {
var n = i.split(".")
, r = n[0]
, a = n[1];
window[r] = window[r] || {};
var s = window[r][a];
window[r][a] = function() {
kv(s) && s.apply(void 0, arguments),
t.handerError.apply(t, arguments)
}
} else
window.vjsFlashEvents = window.vjsFlashEvents || {},
window.vjsFlashEvents.handerError = window.vjsFlashEvents.handerError || t.handerError;
return e
}
,
this.handerError = function(e) {
if (e || (e = {}),
!e.analytics) {
var t = this
, i = e.errno
, n = ""
, r = !1;
e.islive ? (n = "视频正在转码,请稍候重试...",
r = !0) : 31346 === i ? (n = "加载失败了,稍候重试一下吧",
r = !0) : 31066 === i || 404 === e.httpstatus ? n = "文件不存在,换一个吧!" : 31339 === i ? n = "该视频无法播放噢,换一个试试吧!" : 31341 === i ? n = "视频正在转码中,稍后再来试下吧..." : 31346 === i ? n = "抱歉,视频转码失败了,请换一个试试吧!" : 31391 === i ? n = "文件违规,已根据相关法律法规予以屏蔽" : (n = "服务器有点儿忙,稍后重试一下吧...",
r = !0),
En({
container: t.options.container,
retryBtn: r,
content: n
})
}
}
,
this.init(t),
this.player = document.getElementById(wv(t.playerID))
}
function In(e) {
return "[object Array]" === sy.call(e)
}
function An(e) {
return "undefined" == typeof e
}
function xn(e) {
return null !== e && !An(e) && null !== e.constructor && !An(e.constructor) && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
}
function Pn(e) {
return "[object ArrayBuffer]" === sy.call(e)
}
function Ln(e) {
return "undefined" != typeof FormData && e instanceof FormData
}
function Dn(e) {
var t;
return t = "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer
}
function On(e) {
return "string" == typeof e
}
function Nn(e) {
return "number" == typeof e
}
function Mn(e) {
return null !== e && "object" == typeof e
}
function Rn(e) {
if ("[object Object]" !== sy.call(e))
return !1;
var t = Object.getPrototypeOf(e);
return null === t || t === Object.prototype
}
function Un(e) {
return "[object Date]" === sy.call(e)
}
function Fn(e) {
return "[object File]" === sy.call(e)
}
function Bn(e) {
return "[object Blob]" === sy.call(e)
}
function jn(e) {
return "[object Function]" === sy.call(e)
}
function Vn(e) {
return Mn(e) && jn(e.pipe)
}
function qn(e) {
return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams
}
function Hn(e) {
return e.replace(/^\s*/, "").replace(/\s*$/, "")
}
function Wn() {
return "undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product ? "undefined" != typeof window && "undefined" != typeof document : !1
}
function zn(e, t) {
if (null !== e && "undefined" != typeof e)
if ("object" != typeof e && (e = [e]),
In(e))
for (var i = 0, n = e.length; n > i; i++)
t.call(null, e[i], i, e);
else
for (var r in e)
Object.prototype.hasOwnProperty.call(e, r) && t.call(null, e[r], r, e)
}
function Gn() {
function e(e, i) {
t[i] = Rn(t[i]) && Rn(e) ? Gn(t[i], e) : Rn(e) ? Gn({}, e) : In(e) ? e.slice() : e
}
for (var t = {}, i = 0, n = arguments.length; n > i; i++)
zn(arguments[i], e);
return t
}
function Xn(e, t, i) {
return zn(t, function(t, n) {
e[n] = i && "function" == typeof t ? ay(t, i) : t
}),
e
}
function Kn(e) {
return 65279 === e.charCodeAt(0) && (e = e.slice(1)),
e
}
function Yn(e) {
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]")
}
function $n() {
this.handlers = []
}
function Qn(e, t) {
!oy.isUndefined(e) && oy.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t)
}
function Jn() {
var e;
return "undefined" != typeof XMLHttpRequest ? e = Cy : "undefined" != typeof process && "[object process]" === Object.prototype.toString.call(process) && (e = Cy),
e
}
function Zn(e) {
e.cancelToken && e.cancelToken.throwIfRequested()
}
function er(e) {
this.defaults = e,
this.interceptors = {
request: new ly,
response: new ly
}
}
function tr(e) {
this.message = e
}
function ir(e) {
if ("function" != typeof e)
throw new TypeError("executor must be a function.");
var t;
this.promise = new Promise(function(e) {
t = e
}
);
var i = this;
e(function(e) {
i.reason || (i.reason = new Py(e),
t(i.reason))
})
}
function nr(e) {
var t = new xy(e)
, i = ay(xy.prototype.request, t);
return oy.extend(i, xy.prototype, t),
oy.extend(i, t),
i
}
function rr(e) {
Fy.get(e).then(function(e) {
var t = e.data;
if (t && t.list && t.list.length && t.list[0].value) {
var i = JSON.parse(t.list[0].value);
if (Uy = i.m3u8_ts,
Vy.length > 0)
for (var n in Vy) {
var r = Vy[n];
ar(r)
}
}
})["catch"](function(e) {
console.log(e)
})
}
function ar(e) {
var t = e.params;
if (document.getElementById(t.ele)) {
var i = t.ele + "-ad"
, n = document.createElement("video");
n.id = i,
n.autoplay = "autoplay",
n["class"] = "video-js vjs-default-skin vjs-big-play-centered",
document.getElementById(t.ele).parentNode.appendChild(n),
function(e) {
var t = e.params;
sr(t.ele, {
width: t.options.width,
height: t.options.height,
sources: [{
src: Uy,
type: "application/x-mpegURL"
}],
canPlayCb: t.options.canPlayCb
});
var i = setTimeout(function() {
t.options.sources[0].src += "&adToken=" + encodeURIComponent(e.token),
or(t),
clearTimeout(i)
}, 1)
, n = setTimeout(function() {
var e = document.getElementById(t.ele + "-ad");
if (e) {
e.parentNode.removeChild(e);
var i = document.getElementById(t.ele);
i.style.display = "block",
i.getElementsByTagName("video")[0].style.display = "block"
}
clearTimeout(n)
}, 10)
}(e)
}
}
function sr(e, t) {
if (document.getElementById(e)) {
ur(e);
var i = e + "-ad"
, n = cr(i, t)
, r = document.getElementById(i).getElementsByTagName("video")[0];
r.style.width = t.width,
r.style.height = t.height,
t.canPlayCb && t.canPlayCb(),
t.getAdVideo && t.getAdVideo(n);
var a = r.parentNode.querySelector(".vjs-big-play-button");
a && (a.style.display = "none")
}
}
function or(e) {
var t = e.ele
, i = e.options
, n = e.ready;
if (document.getElementById(t)) {
var r = cr(t, fr({}, i, {
needAd: !1
}), n);
i.getVideo && i.getVideo(r)
}
}
function ur(e) {
var t = document.getElementById(e + "-loading");
t && (t.style.display = "none")
}
function lr(e, t, i) {
var n = {
ele: e,
options: t,
ready: i
}
, r = document.getElementById(e).parentNode;
r.style.background = "black",
document.getElementById(e).style.display = "none";
var a = document.createElement("div");
a.id = e + "-loading",
a.innerText = "视频加载中,请稍候...";
var s = t.height
, o = parseInt(s.substring(0, s.length - 2) / 2, 10) - 10;
a.style.cssText = "color: #fff;text-align: center;padding-top: " + o + "px",
r.appendChild(a);
var u = t.sources[0].src;
Fy.get(u).then(function(i) {
var r = i.data;
if (133 === +r.errno && +r.adTime > 0) {
var a = {
time: +r.adTime,
token: r.adToken,
params: n
};
if (Uy)
ar(a);
else {
if (jy) {
var s = t.adUrl || By;
rr(s),
jy = !1
}
Vy.push(a)
}
} else
ur(e),
document.getElementById(e) && (document.getElementById(e).style.display = "block"),
or(n),
t.canPlayCb && t.canPlayCb()
})["catch"](function(e) {
console.log(e)
})
}
function cr(e, t, i) {
void 0 === t && (t = {});
var n = t
, r = n.project
, a = void 0 === r ? "default" : r
, s = pr(n, ["project"])
, o = fr({}, ry[a], s)
, u = o.techOrder
, l = void 0 === u ? [] : u
, c = o.handleError
, d = l.map(function(e) {
return e.toLowerCase()
}).indexOf("flash") > -1;
if (o.needAd)
return new lr(e,o,i);
if (!d || iy) {
var h = pn(e, o, i);
return c !== !1 && h.on("error", function() {
var t = h.vhs && h.vhs.masterPlaylistController_ || {}
, i = t.error && t.error.playlist || t.media && t.media();
if (!i) {
var n = {};
try {
n = JSON.parse(t.error.responseText)
} catch (r) {}
kn(e, n)
}
}),
h
}
return wn.isSupported() ? new wn(e,o).player : void En({
container: e,
content: "安装Flash插件后就可以看视频啦,快来下载安装吧!<br/>(安装成功后,重启浏览器就可以播放啦)<br/>",
unsafeHTML: !0,
flashInstallBtn: !0
})
}
var dr = i(e)
, hr = i(t)
, fr = r(function(e) {
function t() {
return e.exports = t = 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
}
,
t.apply(this, arguments)
}
e.exports = t
})
, pr = a
, mr = s;
r(function(e) {
function t(i) {
"@babel/helpers - typeof";
return e.exports = t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
return typeof e
}
: function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
}
,
t(i)
}
e.exports = t
}),
r(function(e) {
function t(i) {
return e.exports = t = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}
,
t(i)
}
e.exports = t
});
var gr = o
, vr = u
, yr = r(function(e, t) {
function i(e) {
if (e && "object" == typeof e) {
var t = e.which || e.keyCode || e.charCode;
t && (e = t)
}
if ("number" == typeof e)
return s[e];
var i = String(e)
, a = n[i.toLowerCase()];
if (a)
return a;
var a = r[i.toLowerCase()];
return a ? a : 1 === i.length ? i.charCodeAt(0) : void 0
}
i.isEventKey = function(e, t) {
if (e && "object" == typeof e) {
var i = e.which || e.keyCode || e.charCode;
if (null === i || void 0 === i)
return !1;
if ("string" == typeof t) {
var a = n[t.toLowerCase()];
if (a)
return a === i;
var a = r[t.toLowerCase()];
if (a)
return a === i
} else if ("number" == typeof t)
return t === i;
return !1
}
}
,
t = e.exports = i;
var n = t.code = t.codes = {
backspace: 8,
tab: 9,
enter: 13,
shift: 16,
ctrl: 17,
alt: 18,
"pause/break": 19,
"caps lock": 20,
esc: 27,
space: 32,
"page up": 33,
"page down": 34,
end: 35,
home: 36,
left: 37,
up: 38,
right: 39,
down: 40,
insert: 45,
"delete": 46,
command: 91,
"left command": 91,
"right command": 93,
"numpad *": 106,
"numpad +": 107,
"numpad -": 109,
"numpad .": 110,
"numpad /": 111,
"num lock": 144,
"scroll lock": 145,
"my computer": 182,
"my calculator": 183,
";": 186,
"=": 187,
",": 188,
"-": 189,
".": 190,
"/": 191,
"`": 192,
"[": 219,
"\\": 220,
"]": 221,
"'": 222
}
, r = t.aliases = {
windows: 91,
"⇧": 16,
"⌥": 18,
"⌃": 17,
"⌘": 91,
ctl: 17,
control: 17,
option: 18,
pause: 19,
"break": 19,
caps: 20,
"return": 13,
escape: 27,
spc: 32,
spacebar: 32,
pgup: 33,
pgdn: 34,
ins: 45,
del: 46,
cmd: 91
};
for (a = 97; 123 > a; a++)
n[String.fromCharCode(a)] = a - 32;
for (var a = 48; 58 > a; a++)
n[a - 48] = a;
for (a = 1; 13 > a; a++)
n["f" + a] = a + 111;
for (a = 0; 10 > a; a++)
n["numpad " + a] = a + 96;
var s = t.names = t.title = {};
for (a in n)
s[n[a]] = a;
for (var o in r)
n[o] = r[o]
});
yr.code,
yr.codes,
yr.aliases,
yr.names,
yr.title;
var _r = l
, br = Object.prototype.toString
, Tr = function(e) {
var t = {};
return e ? (e.trim().split("\n").forEach(function(e) {
var i = e.indexOf(":")
, n = e.slice(0, i).trim().toLowerCase()
, r = e.slice(i + 1).trim();
"undefined" == typeof t[n] ? t[n] = r : Array.isArray(t[n]) ? t[n].push(r) : t[n] = [t[n], r]
}),
t) : t
}
, Sr = f
, Cr = f;
f.XMLHttpRequest = dr["default"].XMLHttpRequest || g,
f.XDomainRequest = "withCredentials"in new f.XMLHttpRequest ? f.XMLHttpRequest : dr["default"].XDomainRequest,
c(["get", "put", "post", "patch", "head", "delete"], function(e) {
f["delete" === e ? "del" : e] = function(t, i, n) {
return i = h(t, i, n),
i.method = e.toUpperCase(),
p(i)
}
}),
Sr["default"] = Cr;
var Er = 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
}
}();
v.prototype = Er(Error.prototype),
v.prototype.constructor = v,
v.Errors = {
BadSignature: {
code: 0,
message: "Malformed WebVTT signature."
},
BadTimeStamp: {
code: 1,
message: "Malformed time stamp."
}
},
_.prototype = {
set: function(e, t) {
this.get(e) || "" === t || (this.values[e] = t)
},
get: function(e, t, i) {
return i ? this.has(e) ? this.values[e] : t[i] : this.has(e) ? this.values[e] : t
},
has: function(e) {
return e in this.values
},
alt: function(e, t, i) {
for (var n = 0; n < i.length; ++n)
if (t === i[n]) {
this.set(e, t);
break
}
},
integer: function(e, t) {
/^-?\d+$/.test(t) && this.set(e, parseInt(t, 10))
},
percent: function(e, t) {
return t.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (t = parseFloat(t),
t >= 0 && 100 >= t) ? (this.set(e, t),
!0) : !1
}
};
var kr = hr["default"].createElement("textarea")
, wr = {
c: "span",
i: "i",
b: "b",
u: "u",
ruby: "ruby",
rt: "rt",
v: "span",
lang: "span"
}
, Ir = {
white: "rgba(255,255,255,1)",
lime: "rgba(0,255,0,1)",
cyan: "rgba(0,255,255,1)",
red: "rgba(255,0,0,1)",
yellow: "rgba(255,255,0,1)",
magenta: "rgba(255,0,255,1)",
blue: "rgba(0,0,255,1)",
black: "rgba(0,0,0,1)"
}
, Ar = {
v: "title",
lang: "lang"
}
, xr = {
rt: "ruby"
}
, Pr = [[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]];
w.prototype.applyStyles = function(e, t) {
t = t || this.div;
for (var i in e)
e.hasOwnProperty(i) && (t.style[i] = e[i])
}
,
w.prototype.formatStyle = function(e, t) {
return 0 === e ? 0 : e + t
}
,
I.prototype = Er(w.prototype),
I.prototype.constructor = I,
A.prototype.move = function(e, t) {
switch (t = void 0 !== t ? t : this.lineHeight,
e) {
case "+x":
this.left += t,
this.right += t;
break;
case "-x":
this.left -= t,
this.right -= t;
break;
case "+y":
this.top += t,
this.bottom += t;
break;
case "-y":
this.top -= t,
this.bottom -= t
}
}
,
A.prototype.overlaps = function(e) {
return this.left < e.right && this.right > e.left && this.top < e.bottom && this.bottom > e.top
}
,
A.prototype.overlapsAny = function(e) {
for (var t = 0; t < e.length; t++)
if (this.overlaps(e[t]))
return !0;
return !1
}
,
A.prototype.within = function(e) {
return this.top >= e.top && this.bottom <= e.bottom && this.left >= e.left && this.right <= e.right
}
,
A.prototype.overlapsOppositeAxis = function(e, t) {
switch (t) {
case "+x":
return this.left < e.left;
case "-x":
return this.right > e.right;
case "+y":
return this.top < e.top;
case "-y":
return this.bottom > e.bottom
}
}
,
A.prototype.intersectPercentage = function(e) {
var t = Math.max(0, Math.min(this.right, e.right) - Math.max(this.left, e.left))
, i = Math.max(0, Math.min(this.bottom, e.bottom) - Math.max(this.top, e.top))
, n = t * i;
return n / (this.height * this.width)
}
,
A.prototype.toCSSCompatValues = function(e) {
return {
top: this.top - e.top,
bottom: e.bottom - this.bottom,
left: this.left - e.left,
right: e.right - this.right,
height: this.height,
width: this.width
}
}
,
A.getSimpleBoxPosition = function(e) {
var t = e.div ? e.div.offsetHeight : e.tagName ? e.offsetHeight : 0
, i = e.div ? e.div.offsetWidth : e.tagName ? e.offsetWidth : 0
, n = e.div ? e.div.offsetTop : e.tagName ? e.offsetTop : 0;
e = e.div ? e.div.getBoundingClientRect() : e.tagName ? e.getBoundingClientRect() : e;
var r = {
left: e.left,
right: e.right,
top: e.top || n,
height: e.height || t,
bottom: e.bottom || n + (e.height || t),
width: e.width || i
};
return r
}
,
P.StringDecoder = function() {
return {
decode: function(e) {
if (!e)
return "";
if ("string" != typeof e)
throw new Error("Error - expected string data.");
return decodeURIComponent(encodeURIComponent(e))
}
}
}
,
P.convertCueToDOMTree = function(e, t) {
return e && t ? S(e, t) : null
}
;
var Lr = .05
, Dr = "sans-serif"
, Or = "1.5%";
P.processCues = function(e, t, i) {
function n(e) {
for (var t = 0; t < e.length; t++)
if (e[t].hasBeenReset || !e[t].displayState)
return !0;
return !1
}
if (!e || !t || !i)
return null;
for (; i.firstChild; )
i.removeChild(i.firstChild);
var r = e.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 = Or,
i.appendChild(r),
n(t)) {
var a = []
, s = A.getSimpleBoxPosition(r)
, o = Math.round(s.height * Lr * 100) / 100
, u = {
font: o + "px " + Dr
};
!function() {
for (var i, n, o = 0; o < t.length; o++)
n = t[o],
i = new I(e,n,u),
r.appendChild(i.div),
x(e, i, s, a),
n.displayState = i.div,
a.push(A.getSimpleBoxPosition(i))
}()
} else
for (var l = 0; l < t.length; l++)
r.appendChild(t[l].displayState)
}
,
P.Parser = function(e, t, i) {
i || (i = t,
t = {}),
t || (t = {}),
this.window = e,
this.vttjs = t,
this.state = "INITIAL",
this.buffer = "",
this.decoder = i || new TextDecoder("utf8"),
this.regionList = []
}
,
P.Parser.prototype = {
reportOrThrowError: function(e) {
if (!(e instanceof v))
throw e;
this.onparsingerror && this.onparsingerror(e)
},
parse: function(e) {
function t() {
for (var e = a.buffer, t = 0; t < e.length && "\r" !== e[t] && "\n" !== e[t]; )
++t;
var i = e.substr(0, t);
return "\r" === e[t] && ++t,
"\n" === e[t] && ++t,
a.buffer = e.substr(t),
i
}
function i(e) {
var t = new _;
if (b(e, function(e, i) {
switch (e) {
case "id":
t.set(e, i);
break;
case "width":
t.percent(e, i);
break;
case "lines":
t.integer(e, i);
break;
case "regionanchor":
case "viewportanchor":
var n = i.split(",");
if (2 !== n.length)
break;
var r = new _;
if (r.percent("x", n[0]),
r.percent("y", n[1]),
!r.has("x") || !r.has("y"))
break;
t.set(e + "X", r.get("x")),
t.set(e + "Y", r.get("y"));
break;
case "scroll":
t.alt(e, i, ["up"])
}
}, /=/, /\s/),
t.has("id")) {
var i = new (a.vttjs.VTTRegion || a.window.VTTRegion);
i.width = t.get("width", 100),
i.lines = t.get("lines", 3),
i.regionAnchorX = t.get("regionanchorX", 0),
i.regionAnchorY = t.get("regionanchorY", 100),
i.viewportAnchorX = t.get("viewportanchorX", 0),
i.viewportAnchorY = t.get("viewportanchorY", 100),
i.scroll = t.get("scroll", ""),
a.onregion && a.onregion(i),
a.regionList.push({
id: t.get("id"),
region: i
})
}
}
function n(e) {
var t = new _;
b(e, function(e, i) {
switch (e) {
case "MPEGT":
t.integer(e + "S", i);
break;
case "LOCA":
t.set(e + "L", y(i))
}
}, /[^\d]:/, /,/),
a.ontimestampmap && a.ontimestampmap({
MPEGTS: t.get("MPEGTS"),
LOCAL: t.get("LOCAL")
})
}
function r(e) {
e.match(/X-TIMESTAMP-MAP/) ? b(e, function(e, t) {
switch (e) {
case "X-TIMESTAMP-MAP":
n(t)
}
}, /=/) : b(e, function(e, t) {
switch (e) {
case "Region":
i(t)
}
}, /:/)
}
var a = this;
e && (a.buffer += a.decoder.decode(e, {
stream: !0
}));
try {
var s;
if ("INITIAL" === a.state) {
if (!/\r\n|\n/.test(a.buffer))
return this;
s = t();
var o = s.match(/^WEBVTT([ \t].*)?$/);
if (!o || !o[0])
throw new v(v.Errors.BadSignature);
a.state = "HEADER"
}
for (var u = !1; a.buffer; ) {
if (!/\r\n|\n/.test(a.buffer))
return this;
switch (u ? u = !1 : s = t(),
a.state) {
case "HEADER":
/:/.test(s) ? r(s) : s || (a.state = "ID");
continue;
case "NOTE":
s || (a.state = "ID");
continue;
case "ID":
if (/^NOTE($|[ \t])/.test(s)) {
a.state = "NOTE";
break
}
if (!s)
continue;
a.cue = new (a.vttjs.VTTCue || a.window.VTTCue)(0,0,"");
try {
a.cue.align = "center"
} catch (l) {
a.cue.align = "middle"
}
if (a.state = "CUE",
-1 === s.indexOf("-->")) {
a.cue.id = s;
continue
}
case "CUE":
try {
T(s, a.cue, a.regionList)
} catch (l) {
a.reportOrThrowError(l),
a.cue = null,
a.state = "BADCUE";
continue
}
a.state = "CUETEXT";
continue;
case "CUETEXT":
var c = -1 !== s.indexOf("-->");
if (!s || c && (u = !0)) {
a.oncue && a.oncue(a.cue),
a.cue = null,
a.state = "ID";
continue
}
a.cue.text && (a.cue.text += "\n"),
a.cue.text += s.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
continue;
case "BADCUE":
s || (a.state = "ID");
continue
}
}
} catch (l) {
a.reportOrThrowError(l),
"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 v(v.Errors.BadSignature)
} catch (t) {
e.reportOrThrowError(t)
}
return e.onflush && e.onflush(),
this
}
};
var Nr = P
, Mr = "auto"
, Rr = {
"": 1,
lr: 1,
rl: 1
}
, Ur = {
start: 1,
center: 1,
end: 1,
left: 1,
right: 1,
auto: 1,
"line-left": 1,
"line-right": 1
};
O.prototype.getCueAsHTML = function() {
return WebVTT.convertCueToDOMTree(window, this.text)
}
;
var Fr = O
, Br = {
"": !0,
up: !0
}
, jr = R
, Vr = r(function(e) {
var t = e.exports = {
WebVTT: Nr,
VTTCue: Fr,
VTTRegion: jr
};
dr["default"].vttjs = t,
dr["default"].WebVTT = t.WebVTT;
var i = t.VTTCue
, n = t.VTTRegion
, r = dr["default"].VTTCue
, a = dr["default"].VTTRegion;
t.shim = function() {
dr["default"].VTTCue = i,
dr["default"].VTTRegion = n
}
,
t.restore = function() {
dr["default"].VTTCue = r,
dr["default"].VTTRegion = a
}
,
dr["default"].VTTCue || t.shim()
});
Vr.WebVTT,
Vr.VTTCue,
Vr.VTTRegion;
var qr = r(function(e) {
function t(i, n) {
return e.exports = t = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t,
e
}
,
t(i, n)
}
e.exports = t
})
, Hr = U
, Wr = r(function(e) {
function t() {
return e.exports = t = Hr() ? Reflect.construct : function(e, t, i) {
var n = [null];
n.push.apply(n, t);
var r = Function.bind.apply(e, n)
, a = new r;
return i && qr(a, i.prototype),
a
}
,
t.apply(null, arguments)
}
e.exports = t
})
, zr = F
, Gr = r(function(e) {
!function() {
var t = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/
, i = /^([^\/?#]*)(.*)$/
, n = /(?:\/|^)\.(?=\/)/g
, r = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g
, a = {
buildAbsoluteURL: function(e, t, n) {
if (n = n || {},
e = e.trim(),
t = t.trim(),
!t) {
if (!n.alwaysNormalize)
return e;
var r = a.parseURL(e);
if (!r)
throw new Error("Error trying to parse base URL.");
return r.path = a.normalizePath(r.path),
a.buildURLFromParts(r)
}
var s = a.parseURL(t);
if (!s)
throw new Error("Error trying to parse relative URL.");
if (s.scheme)
return n.alwaysNormalize ? (s.path = a.normalizePath(s.path),
a.buildURLFromParts(s)) : t;
var o = a.parseURL(e);
if (!o)
throw new Error("Error trying to parse base URL.");
if (!o.netLoc && o.path && "/" !== o.path[0]) {
var u = i.exec(o.path);
o.netLoc = u[1],
o.path = u[2]
}
o.netLoc && !o.path && (o.path = "/");
var l = {
scheme: o.scheme,
netLoc: s.netLoc,
path: null,
params: s.params,
query: s.query,
fragment: s.fragment
};
if (!s.netLoc && (l.netLoc = o.netLoc,
"/" !== s.path[0]))
if (s.path) {
var c = o.path
, d = c.substring(0, c.lastIndexOf("/") + 1) + s.path;
l.path = a.normalizePath(d)
} else
l.path = o.path,
s.params || (l.params = o.params,
s.query || (l.query = o.query));
return null === l.path && (l.path = n.alwaysNormalize ? a.normalizePath(s.path) : s.path),
a.buildURLFromParts(l)
},
parseURL: function(e) {
var i = t.exec(e);
return i ? {
scheme: i[1] || "",
netLoc: i[2] || "",
path: i[3] || "",
params: i[4] || "",
query: i[5] || "",
fragment: i[6] || ""
} : null
},
normalizePath: function(e) {
for (e = e.split("").reverse().join("").replace(n, ""); e.length !== (e = e.replace(r, "")).length; )
;
return e.split("").reverse().join("")
},
buildURLFromParts: function(e) {
return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment
}
};
e.exports = a
}()
})
, Xr = B(Gr)
, Kr = B(dr["default"])
, Yr = function(e, t) {
return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = Xr.buildAbsoluteURL(Kr.location && Kr.location.href || "", e)),
Xr.buildAbsoluteURL(e, t))
}
, $r = Yr
, Qr = function() {
function e() {
this.listeners = {}
}
var t = e.prototype;
return t.on = function(e, t) {
this.listeners[e] || (this.listeners[e] = []),
this.listeners[e].push(t)
}
,
t.off = function(e, t) {
if (!this.listeners[e])
return !1;
var i = this.listeners[e].indexOf(t);
return this.listeners[e] = this.listeners[e].slice(0),
this.listeners[e].splice(i, 1),
i > -1
}
,
t.trigger = function(e) {
var t = this.listeners[e];
if (t)
if (2 === arguments.length)
for (var i = t.length, n = 0; i > n; ++n)
t[n].call(this, arguments[1]);
else
for (var r = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; a > s; ++s)
t[s].apply(this, r)
}
,
t.dispose = function() {
this.listeners = {}
}
,
t.pipe = function(e) {
this.on("data", function(t) {
e.push(t)
})
}
,
e
}()
, Jr = Qr
, Zr = j(dr["default"])
, ea = function(e) {
return Zr.atob ? Zr.atob(e) : Buffer.from(e, "base64").toString("binary")
}
, ta = V
, ia = function(e) {
function t() {
var t;
return t = e.call(this) || this,
t.buffer = "",
t
}
gr(t, e);
var i = t.prototype;
return i.push = function(e) {
var t;
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
}(Jr)
, na = function() {
var e = "[^=]*"
, t = '"[^"]*"|[^,]*'
, i = "(?:" + e + ")=(?:" + t + ")";
return new RegExp("(?:^|,)(" + i + ")")
}
, ra = function(e) {
for (var t, i = e.split(na()), n = {}, r = i.length; r--; )
"" !== i[r] && (t = /([^=]*)=(.*)/.exec(i[r]).slice(1),
t[0] = t[0].replace(/^\s+|\s+$/g, ""),
t[1] = t[1].replace(/^\s+|\s+$/g, ""),
t[1] = t[1].replace(/^['"](.*)['"]$/g, "$1"),
n[t[0]] = t[1]);
return n
}
, aa = function(e) {
function t() {
var t;
return t = e.call(this) || this,
t.customParsers = [],
t.tagMappers = [],
t
}
gr(t, e);
var i = t.prototype;
return i.push = function(e) {
var t, i, n = this;
if (e = e.trim(),
0 !== e.length) {
if ("#" !== e[0])
return void this.trigger("data", {
type: "uri",
uri: e
});
var r = this.tagMappers.reduce(function(t, i) {
var n = i(e);
return n === e ? t : t.concat([n])
}, [e]);
r.forEach(function(e) {
for (var r = 0; r < n.customParsers.length; r++)
if (n.customParsers[r].call(n, e))
return;
if (0 !== e.indexOf("#EXT"))
return void n.trigger("data", {
type: "comment",
text: e.slice(1)
});
if (e = e.replace("\r", ""),
t = /^#EXTM3U/.exec(e))
return void n.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 n.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 n.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 n.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 n.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 n.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 n.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 n.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 n.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 n.trigger("data", i);
if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) {
if (i = {
type: "tag",
tagType: "map"
},
t[1]) {
var a = ra(t[1]);
if (a.URI && (i.uri = a.URI),
a.BYTERANGE) {
var s = a.BYTERANGE.split("@")
, o = s[0]
, u = s[1];
i.byterange = {},
o && (i.byterange.length = parseInt(o, 10)),
u && (i.byterange.offset = parseInt(u, 10))
}
}
return void n.trigger("data", i)
}
if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) {
if (i = {
type: "tag",
tagType: "stream-inf"
},
t[1]) {
if (i.attributes = ra(t[1]),
i.attributes.RESOLUTION) {
var l = i.attributes.RESOLUTION.split("x")
, c = {};
l[0] && (c.width = parseInt(l[0], 10)),
l[1] && (c.height = parseInt(l[1], 10)),
i.attributes.RESOLUTION = c
}
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 n.trigger("data", i)
}
return (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) ? (i = {
type: "tag",
tagType: "media"
},
t[1] && (i.attributes = ra(t[1])),
void n.trigger("data", i)) : (t = /^#EXT-X-ENDLIST/.exec(e)) ? void n.trigger("data", {
type: "tag",
tagType: "endlist"
}) : (t = /^#EXT-X-DISCONTINUITY/.exec(e)) ? void n.trigger("data", {
type: "tag",
tagType: "discontinuity"
}) : (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) ? (i = {
type: "tag",
tagType: "program-date-time"
},
t[1] && (i.dateTimeString = t[1],
i.dateTimeObject = new Date(t[1])),
void n.trigger("data", i)) : (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) ? (i = {
type: "tag",
tagType: "key"
},
t[1] && (i.attributes = ra(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 n.trigger("data", i)) : (t = /^#EXT-X-START:?(.*)$/.exec(e)) ? (i = {
type: "tag",
tagType: "start"
},
t[1] && (i.attributes = ra(t[1]),
i.attributes["TIME-OFFSET"] = parseFloat(i.attributes["TIME-OFFSET"]),
i.attributes.PRECISE = /YES/.test(i.attributes.PRECISE)),
void n.trigger("data", i)) : (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) ? (i = {
type: "tag",
tagType: "cue-out-cont"
},
i.data = t[1] ? t[1] : "",
void n.trigger("data", i)) : (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) ? (i = {
type: "tag",
tagType: "cue-out"
},
i.data = t[1] ? t[1] : "",
void n.trigger("data", i)) : (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) ? (i = {
type: "tag",
tagType: "cue-in"
},
i.data = t[1] ? t[1] : "",
void n.trigger("data", i)) : void n.trigger("data", {
type: "tag",
data: e.slice(4)
})
})
}
}
,
i.addParser = function(e) {
var t = this
, i = e.expression
, n = e.customType
, r = e.dataParser
, a = e.segment;
"function" != typeof r && (r = function(e) {
return e
}
),
this.customParsers.push(function(e) {
var s = i.exec(e);
return s ? (t.trigger("data", {
type: "custom",
data: r(e),
customType: n,
segment: a
}),
!0) : void 0
})
}
,
i.addTagMapper = function(e) {
var t = e.expression
, i = e.map
, n = function(e) {
return t.test(e) ? i(e) : e
};
this.tagMappers.push(n)
}
,
t
}(Jr)
, sa = function(e) {
function t() {
var t;
t = e.call(this) || this,
t.lineStream = new ia,
t.parseStream = new aa,
t.lineStream.pipe(t.parseStream);
var i, n, r = mr(t), a = [], s = {}, o = function() {}, u = {
AUDIO: {},
VIDEO: {},
"CLOSED-CAPTIONS": {},
SUBTITLES: {}
}, l = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", c = 0;
t.manifest = {
allowCache: !0,
discontinuityStarts: [],
segments: []
};
var d = 0;
return t.parseStream.on("data", function(e) {
var t, h;
({
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 f() {
var f = {};
"length"in e && (s.byterange = f,
f.length = e.length,
"offset"in e || (e.offset = d)),
"offset"in e && (s.byterange = f,
f.offset = e.offset),
d = f.offset + f.length
},
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 = a
},
key: function() {
if (!e.attributes)
return void this.trigger("warn", {
message: "ignoring key declaration without attribute list"
});
if ("NONE" === e.attributes.METHOD)
return void (n = null);
if (!e.attributes.URI)
return void this.trigger("warn", {
message: "ignoring key declaration without URI"
});
if (e.attributes.KEYFORMAT === l) {
var t = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
return -1 === t.indexOf(e.attributes.METHOD) ? void this.trigger("warn", {
message: "invalid key method provided for Widevine"
}) : ("SAMPLE-AES-CENC" === e.attributes.METHOD && this.trigger("warn", {
message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
}),
"data:text/plain;base64," !== e.attributes.URI.substring(0, 23) ? void this.trigger("warn", {
message: "invalid key URI provided for Widevine"
}) : e.attributes.KEYID && "0x" === e.attributes.KEYID.substring(0, 2) ? void (this.manifest.contentProtection = {
"com.widevine.alpha": {
attributes: {
schemeIdUri: e.attributes.KEYFORMAT,
keyId: e.attributes.KEYID.substring(2)
},
pssh: ta(e.attributes.URI.split(",")[1])
}
}) : void this.trigger("warn", {
message: "invalid key ID provided for Widevine"
}))
}
e.attributes.METHOD || this.trigger("warn", {
message: "defaulting key method to AES-128"
}),
n = {
method: e.attributes.METHOD || "AES-128",
uri: e.attributes.URI
},
"undefined" != typeof e.attributes.IV && (n.iv = e.attributes.IV)
},
"media-sequence": function() {
return isFinite(e.number) ? void (this.manifest.mediaSequence = e.number) : void this.trigger("warn", {
message: "ignoring invalid media sequence: " + e.number
})
},
"discontinuity-sequence": function() {
return isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number,
void (c = e.number)) : void this.trigger("warn", {
message: "ignoring invalid discontinuity sequence: " + e.number
})
},
"playlist-type": function() {
return /VOD|EVENT/.test(e.playlistType) ? void (this.manifest.playlistType = e.playlistType) : void this.trigger("warn", {
message: "ignoring unknown playlist type: " + e.playlist
})
},
map: function() {
i = {},
e.uri && (i.uri = e.uri),
e.byterange && (i.byterange = e.byterange)
},
"stream-inf": function() {
return this.manifest.playlists = a,
this.manifest.mediaGroups = this.manifest.mediaGroups || u,
e.attributes ? (s.attributes || (s.attributes = {}),
void fr(s.attributes, e.attributes)) : void this.trigger("warn", {
message: "ignoring empty stream-inf attributes"
})
},
media: function() {
if (this.manifest.mediaGroups = this.manifest.mediaGroups || u,
!(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"]],
h = {
"default": /yes/i.test(e.attributes.DEFAULT)
},
h.autoselect = h["default"] ? !0 : /yes/i.test(e.attributes.AUTOSELECT),
e.attributes.LANGUAGE && (h.language = e.attributes.LANGUAGE),
e.attributes.URI && (h.uri = e.attributes.URI),
e.attributes["INSTREAM-ID"] && (h.instreamId = e.attributes["INSTREAM-ID"]),
e.attributes.CHARACTERISTICS && (h.characteristics = e.attributes.CHARACTERISTICS),
e.attributes.FORCED && (h.forced = /yes/i.test(e.attributes.FORCED)),
t[e.attributes.NAME] = h
},
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() {
return !isFinite(e.duration) || e.duration < 0 ? void this.trigger("warn", {
message: "ignoring invalid target duration: " + e.duration
}) : void (this.manifest.targetDuration = e.duration)
},
totalduration: function() {
return !isFinite(e.duration) || e.duration < 0 ? void this.trigger("warn", {
message: "ignoring invalid total duration: " + e.duration
}) : void (this.manifest.totalDuration = e.duration)
},
start: function() {
return !e.attributes || isNaN(e.attributes["TIME-OFFSET"]) ? void this.trigger("warn", {
message: "ignoring start declaration without appropriate attribute list"
}) : void (this.manifest.start = {
timeOffset: e.attributes["TIME-OFFSET"],
precise: e.attributes.PRECISE
})
},
"cue-out": function() {
s.cueOut = e.data
},
"cue-out-cont": function() {
s.cueOutCont = e.data
},
"cue-in": function() {
s.cueIn = e.data
}
})[e.tagType] || o).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),
n && (s.key = n),
s.timeline = c,
i && (s.map = i),
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
}
gr(t, e);
var i = t.prototype;
return i.push = function(e) {
this.lineStream.push(e)
}
,
i.end = function() {
this.lineStream.push("\n")
}
,
i.addParser = function(e) {
this.parseStream.addParser(e)
}
,
i.addTagMapper = function(e) {
this.parseStream.addTagMapper(e)
}
,
t
}(Jr)
, oa = r(function(e, t) {
Object.defineProperty(t, "__esModule", {
value: !0
});
var i = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i
, n = /^application\/dash\+xml/i
, r = function(e) {
return i.test(e) ? "hls" : n.test(e) ? "dash" : "application/vnd.videojs.vhs+json" === e ? "vhs-json" : null
};
t.simpleTypeFromSourceType = r
});
n(oa);
var ua = oa.simpleTypeFromSourceType
, la = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
, ca = new RegExp("[\\-\\.0-9" + la.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]")
, da = new RegExp("^" + la.source + ca.source + "*(?::" + la.source + ca.source + "*)?$")
, ha = 0
, fa = 1
, pa = 2
, ma = 3
, ga = 4
, va = 5
, ya = 6
, _a = 7;
q.prototype = {
parse: function(e, t, i) {
var n = this.domBuilder;
n.startDocument(),
Y(t, t = {}),
H(e, t, i, n, this.errorHandler),
n.endDocument()
}
},
J.prototype = {
setTagName: function(e) {
if (!da.test(e))
throw new Error("invalid tagName:" + e);
this.tagName = e
},
add: function(e, t, i) {
if (!da.test(e))
throw new Error("invalid attribute:" + e);
this[this.length++] = {
qName: e,
value: t,
offset: i
}
},
length: 0,
getLocalName: function(e) {
return this[e].localName
},
getLocator: function(e) {
return this[e].locator
},
getQName: function(e) {
return this[e].qName
},
getURI: function(e) {
return this[e].uri
},
getValue: function(e) {
return this[e].value
}
},
Z({}, Z.prototype)instanceof Z || (Z = function(e, t) {
function i() {}
i.prototype = t,
i = new i;
for (t in e)
i[t] = e[t];
return i
}
);
var ba = q
, Ta = {
XMLReader: ba
}
, Sa = "http://www.w3.org/1999/xhtml"
, Ca = {}
, Ea = Ca.ELEMENT_NODE = 1
, ka = Ca.ATTRIBUTE_NODE = 2
, wa = Ca.TEXT_NODE = 3
, Ia = Ca.CDATA_SECTION_NODE = 4
, Aa = Ca.ENTITY_REFERENCE_NODE = 5
, xa = Ca.ENTITY_NODE = 6
, Pa = Ca.PROCESSING_INSTRUCTION_NODE = 7
, La = Ca.COMMENT_NODE = 8
, Da = Ca.DOCUMENT_NODE = 9
, Oa = Ca.DOCUMENT_TYPE_NODE = 10
, Na = Ca.DOCUMENT_FRAGMENT_NODE = 11
, Ma = Ca.NOTATION_NODE = 12
, Ra = {}
, Ua = {};
Ra.INDEX_SIZE_ERR = (Ua[1] = "Index size error",
1),
Ra.DOMSTRING_SIZE_ERR = (Ua[2] = "DOMString size error",
2);
var Fa = Ra.HIERARCHY_REQUEST_ERR = (Ua[3] = "Hierarchy request error",
3);
Ra.WRONG_DOCUMENT_ERR = (Ua[4] = "Wrong document",
4),
Ra.INVALID_CHARACTER_ERR = (Ua[5] = "Invalid character",
5),
Ra.NO_DATA_ALLOWED_ERR = (Ua[6] = "No data allowed",
6),
Ra.NO_MODIFICATION_ALLOWED_ERR = (Ua[7] = "No modification allowed",
7);
var Ba = Ra.NOT_FOUND_ERR = (Ua[8] = "Not found",
8);
Ra.NOT_SUPPORTED_ERR = (Ua[9] = "Not supported",
9);
var ja = Ra.INUSE_ATTRIBUTE_ERR = (Ua[10] = "Attribute in use",
10);
Ra.INVALID_STATE_ERR = (Ua[11] = "Invalid state",
11),
Ra.SYNTAX_ERR = (Ua[12] = "Syntax error",
12),
Ra.INVALID_MODIFICATION_ERR = (Ua[13] = "Invalid modification",
13),
Ra.NAMESPACE_ERR = (Ua[14] = "Invalid namespace",
14),
Ra.INVALID_ACCESS_ERR = (Ua[15] = "Invalid access",
15),
nt.prototype = Error.prototype,
tt(Ra, nt),
rt.prototype = {
length: 0,
item: function(e) {
return this[e] || null
},
toString: function(e, t) {
for (var i = [], n = 0; n < this.length; n++)
Ut(this[n], i, e, t);
return i.join("")
}
},
at.prototype.item = function(e) {
return st(this),
this[e]
}
,
it(at, rt),
ot.prototype = {
length: 0,
item: rt.prototype.item,
getNamedItem: function(e) {
for (var t = this.length; t--; ) {
var i = this[t];
if (i.nodeName == e)
return i
}
},
setNamedItem: function(e) {
var t = e.ownerElement;
if (t && t != this._ownerElement)
throw new nt(ja);
var i = this.getNamedItem(e.nodeName);
return lt(this._ownerElement, this, e, i),
i
},
setNamedItemNS: function(e) {
var t, i = e.ownerElement;
if (i && i != this._ownerElement)
throw new nt(ja);
return t = this.getNamedItemNS(e.namespaceURI, e.localName),
lt(this._ownerElement, this, e, t),
t
},
removeNamedItem: function(e) {
var t = this.getNamedItem(e);
return ct(this._ownerElement, this, t),
t
},
removeNamedItemNS: function(e, t) {
var i = this.getNamedItemNS(e, t);
return ct(this._ownerElement, this, i),
i
},
getNamedItemNS: function(e, t) {
for (var i = this.length; i--; ) {
var n = this[i];
if (n.localName == t && n.namespaceURI == e)
return n
}
return null
}
},
dt.prototype = {
hasFeature: function(e, t) {
var i = this._features[e.toLowerCase()];
return i && (!t || t in i) ? !0 : !1
},
createDocument: function(e, t, i) {
var n = new mt;
if (n.implementation = this,
n.childNodes = new rt,
n.doctype = i,
i && n.appendChild(i),
t) {
var r = n.createElementNS(e, t);
n.appendChild(r)
}
return n
},
createDocumentType: function(e, t, i) {
var n = new At;
return n.name = e,
n.nodeName = e,
n.publicId = t,
n.systemId = i,
n
}
},
ht.prototype = {
firstChild: null,
lastChild: null,
previousSibling: null,
nextSibling: null,
attributes: null,
parentNode: null,
childNodes: null,
ownerDocument: null,
nodeValue: null,
namespaceURI: null,
prefix: null,
localName: null,
insertBefore: function(e, t) {
return bt(this, e, t)
},
replaceChild: function(e, t) {
this.insertBefore(e, t),
t && this.removeChild(t)
},
removeChild: function(e) {
return _t(this, e)
},
appendChild: function(e) {
return this.insertBefore(e, null)
},
hasChildNodes: function() {
return null != this.firstChild
},
cloneNode: function(e) {
return Bt(this.ownerDocument || this, this, e)
},
normalize: function() {
for (var e = this.firstChild; e; ) {
var t = e.nextSibling;
t && t.nodeType == wa && e.nodeType == wa ? (this.removeChild(t),
e.appendData(t.data)) : (e.normalize(),
e = t)
}
},
isSupported: function(e, t) {
return this.ownerDocument.implementation.hasFeature(e, t)
},
hasAttributes: function() {
return this.attributes.length > 0
},
lookupPrefix: function(e) {
for (var t = this; t; ) {
var i = t._nsMap;
if (i)
for (var n in i)
if (i[n] == e)
return n;
t = t.nodeType == ka ? t.ownerDocument : t.parentNode
}
return null
},
lookupNamespaceURI: function(e) {
for (var t = this; t; ) {
var i = t._nsMap;
if (i && e in i)
return i[e];
t = t.nodeType == ka ? t.ownerDocument : t.parentNode
}
return null
},
isDefaultNamespace: function(e) {
var t = this.lookupPrefix(e);
return null == t
}
},
tt(Ca, ht),
tt(Ca, ht.prototype),
mt.prototype = {
nodeName: "#document",
nodeType: Da,
doctype: null,
documentElement: null,
_inc: 1,
insertBefore: function(e, t) {
if (e.nodeType == Na) {
for (var i = e.firstChild; i; ) {
var n = i.nextSibling;
this.insertBefore(i, t),
i = n
}
return e
}
return null == this.documentElement && e.nodeType == Ea && (this.documentElement = e),
bt(this, e, t),
e.ownerDocument = this,
e
},
removeChild: function(e) {
return this.documentElement == e && (this.documentElement = null),
_t(this, e)
},
importNode: function(e, t) {
return Ft(this, e, t)
},
getElementById: function(e) {
var t = null;
return pt(this.documentElement, function(i) {
return i.nodeType == Ea && i.getAttribute("id") == e ? (t = i,
!0) : void 0
}),
t
},
createElement: function(e) {
var t = new St;
t.ownerDocument = this,
t.nodeName = e,
t.tagName = e,
t.childNodes = new rt;
var i = t.attributes = new ot;
return i._ownerElement = t,
t
},
createDocumentFragment: function() {
var e = new Dt;
return e.ownerDocument = this,
e.childNodes = new rt,
e
},
createTextNode: function(e) {
var t = new kt;
return t.ownerDocument = this,
t.appendData(e),
t
},
createComment: function(e) {
var t = new wt;
return t.ownerDocument = this,
t.appendData(e),
t
},
createCDATASection: function(e) {
var t = new It;
return t.ownerDocument = this,
t.appendData(e),
t
},
createProcessingInstruction: function(e, t) {
var i = new Ot;
return i.ownerDocument = this,
i.tagName = i.target = e,
i.nodeValue = i.data = t,
i
},
createAttribute: function(e) {
var t = new Ct;
return t.ownerDocument = this,
t.name = e,
t.nodeName = e,
t.localName = e,
t.specified = !0,
t
},
createEntityReference: function(e) {
var t = new Lt;
return t.ownerDocument = this,
t.nodeName = e,
t
},
createElementNS: function(e, t) {
var i = new St
, n = t.split(":")
, r = i.attributes = new ot;
return i.childNodes = new rt,
i.ownerDocument = this,
i.nodeName = t,
i.tagName = t,
i.namespaceURI = e,
2 == n.length ? (i.prefix = n[0],
i.localName = n[1]) : i.localName = t,
r._ownerElement = i,
i
},
createAttributeNS: function(e, t) {
var i = new Ct
, n = t.split(":");
return i.ownerDocument = this,
i.nodeName = t,
i.name = t,
i.namespaceURI = e,
i.specified = !0,
2 == n.length ? (i.prefix = n[0],
i.localName = n[1]) : i.localName = t,
i
}
},
it(mt, ht),
St.prototype = {
nodeType: Ea,
hasAttribute: function(e) {
return null != this.getAttributeNode(e)
},
getAttribute: function(e) {
var t = this.getAttributeNode(e);
return t && t.value || ""
},
getAttributeNode: function(e) {
return this.attributes.getNamedItem(e)
},
setAttribute: function(e, t) {
var i = this.ownerDocument.createAttribute(e);
i.value = i.nodeValue = "" + t,
this.setAttributeNode(i)
},
removeAttribute: function(e) {
var t = this.getAttributeNode(e);
t && this.removeAttributeNode(t)
},
appendChild: function(e) {
return e.nodeType === Na ? this.insertBefore(e, null) : Tt(this, e)
},
setAttributeNode: function(e) {
return this.attributes.setNamedItem(e)
},
setAttributeNodeNS: function(e) {
return this.attributes.setNamedItemNS(e)
},
removeAttributeNode: function(e) {
return this.attributes.removeNamedItem(e.nodeName)
},
removeAttributeNS: function(e, t) {
var i = this.getAttributeNodeNS(e, t);
i && this.removeAttributeNode(i)
},
hasAttributeNS: function(e, t) {
return null != this.getAttributeNodeNS(e, t)
},
getAttributeNS: function(e, t) {
var i = this.getAttributeNodeNS(e, t);
return i && i.value || ""
},
setAttributeNS: function(e, t, i) {
var n = this.ownerDocument.createAttributeNS(e, t);
n.value = n.nodeValue = "" + i,
this.setAttributeNode(n)
},
getAttributeNodeNS: function(e, t) {
return this.attributes.getNamedItemNS(e, t)
},
getElementsByTagName: function(e) {
return new at(this,function(t) {
var i = [];
return pt(t, function(n) {
n === t || n.nodeType != Ea || "*" !== e && n.tagName != e || i.push(n)
}),
i
}
)
},
getElementsByTagNameNS: function(e, t) {
return new at(this,function(i) {
var n = [];
return pt(i, function(r) {
r === i || r.nodeType !== Ea || "*" !== e && r.namespaceURI !== e || "*" !== t && r.localName != t || n.push(r)
}),
n
}
)
}
},
mt.prototype.getElementsByTagName = St.prototype.getElementsByTagName,
mt.prototype.getElementsByTagNameNS = St.prototype.getElementsByTagNameNS,
it(St, ht),
Ct.prototype.nodeType = ka,
it(Ct, ht),
Et.prototype = {
data: "",
substringData: function(e, t) {
return this.data.substring(e, e + t)
},
appendData: function(e) {
e = this.data + e,
this.nodeValue = this.data = e,
this.length = e.length
},
insertData: function(e, t) {
this.replaceData(e, 0, t)
},
appendChild: function() {
throw new Error(Ua[Fa])
},
deleteData: function(e, t) {
this.replaceData(e, t, "")
},
replaceData: function(e, t, i) {
var n = this.data.substring(0, e)
, r = this.data.substring(e + t);
i = n + i + r,
this.nodeValue = this.data = i,
this.length = i.length
}
},
it(Et, ht),
kt.prototype = {
nodeName: "#text",
nodeType: wa,
splitText: function(e) {
var t = this.data
, i = t.substring(e);
t = t.substring(0, e),
this.data = this.nodeValue = t,
this.length = t.length;
var n = this.ownerDocument.createTextNode(i);
return this.parentNode && this.parentNode.insertBefore(n, this.nextSibling),
n
}
},
it(kt, Et),
wt.prototype = {
nodeName: "#comment",
nodeType: La
},
it(wt, Et),
It.prototype = {
nodeName: "#cdata-section",
nodeType: Ia
},
it(It, Et),
At.prototype.nodeType = Oa,
it(At, ht),
xt.prototype.nodeType = Ma,
it(xt, ht),
Pt.prototype.nodeType = xa,
it(Pt, ht),
Lt.prototype.nodeType = Aa,
it(Lt, ht),
Dt.prototype.nodeName = "#document-fragment",
Dt.prototype.nodeType = Na,
it(Dt, ht),
Ot.prototype.nodeType = Pa,
it(Ot, ht),
Nt.prototype.serializeToString = function(e, t, i) {
return Mt.call(e, t, i)
}
,
ht.prototype.toString = Mt;
try {
if (Object.defineProperty) {
var Va = function qy(e) {
switch (e.nodeType) {
case Ea:
case Na:
var t = [];
for (e = e.firstChild; e; )
7 !== e.nodeType && 8 !== e.nodeType && t.push(qy(e)),
e = e.nextSibling;
return t.join("");
default:
return e.nodeValue
}
};
Object.defineProperty(at.prototype, "length", {
get: function() {
return st(this),
this.$$length
}
}),
Object.defineProperty(ht.prototype, "textContent", {
get: function() {
return Va(this)
},
set: function(e) {
switch (this.nodeType) {
case Ea:
case Na:
for (; this.firstChild; )
this.removeChild(this.firstChild);
(e || String(e)) && this.appendChild(this.ownerDocument.createTextNode(e));
break;
default:
this.data = e,
this.value = e,
this.nodeValue = e
}
}
}),
jt = function(e, t, i) {
e["$$" + t] = i
}
}
} catch (qa) {}
var Ha = dt
, Wa = Nt
, za = {
DOMImplementation: Ha,
XMLSerializer: Wa
}
, Ga = r(function(e, t) {
function i(e) {
this.options = e || {
locator: {}
}
}
function n(e, t, i) {
function n(t) {
var n = e[t];
!n && o && (n = 2 == e.length ? function(i) {
e(t, i)
}
: e),
a[t] = n && function(e) {
n("[xmldom " + t + "]	" + e + s(i))
}
|| function() {}
}
if (!e) {
if (t instanceof r)
return t;
e = t
}
var a = {}
, o = e instanceof Function;
return i = i || {},
n("warning"),
n("error"),
n("fatalError"),
a
}
function r() {
this.cdata = !1
}
function a(e, t) {
t.lineNumber = e.lineNumber,
t.columnNumber = e.columnNumber
}
function s(e) {
return e ? "\n@" + (e.systemId || "") + "#[line:" + e.lineNumber + ",col:" + e.columnNumber + "]" : void 0
}
function o(e, t, i) {
return "string" == typeof e ? e.substr(t, i) : e.length >= t + i || t ? new java.lang.String(e,t,i) + "" : e
}
function u(e, t) {
e.currentElement ? e.currentElement.appendChild(t) : e.doc.appendChild(t)
}
i.prototype.parseFromString = function(e, t) {
var i = this.options
, a = new l
, s = i.domBuilder || new r
, o = i.errorHandler
, u = i.locator
, c = i.xmlns || {}
, d = {
lt: "<",
gt: ">",
amp: "&",
quot: '"',
apos: "'"
};
return u && s.setDocumentLocator(u),
a.errorHandler = n(o, s, u),
a.domBuilder = i.domBuilder || s,
/\/x?html?$/.test(t) && (d.nbsp = " ",
d.copy = "©",
c[""] = "http://www.w3.org/1999/xhtml"),
c.xml = c.xml || "http://www.w3.org/XML/1998/namespace",
e ? a.parse(e, c, d) : a.errorHandler.error("invalid doc source"),
s.doc
}
,
r.prototype = {
startDocument: function() {
this.doc = (new c).createDocument(null, null, null),
this.locator && (this.doc.documentURI = this.locator.systemId)
},
startElement: function(e, t, i, n) {
var r = this.doc
, s = r.createElementNS(e, i || t)
, o = n.length;
u(this, s),
this.currentElement = s,
this.locator && a(this.locator, s);
for (var l = 0; o > l; l++) {
var e = n.getURI(l)
, c = n.getValue(l)
, i = n.getQName(l)
, d = r.createAttributeNS(e, i);
this.locator && a(n.getLocator(l), d),
d.value = d.nodeValue = c,
s.setAttributeNode(d)
}
},
endElement: function() {
var e = this.currentElement;
e.tagName,
this.currentElement = e.parentNode
},
startPrefixMapping: function() {},
endPrefixMapping: function() {},
processingInstruction: function(e, t) {
var i = this.doc.createProcessingInstruction(e, t);
this.locator && a(this.locator, i),
u(this, i)
},
ignorableWhitespace: function() {},
characters: function(e) {
if (e = o.apply(this, arguments)) {
if (this.cdata)
var t = this.doc.createCDATASection(e);
else
var t = this.doc.createTextNode(e);
this.currentElement ? this.currentElement.appendChild(t) : /^\s*$/.test(e) && this.doc.appendChild(t),
this.locator && a(this.locator, t)
}
},
skippedEntity: function() {},
endDocument: function() {
this.doc.normalize()
},
setDocumentLocator: function(e) {
(this.locator = e) && (e.lineNumber = 0)
},
comment: function(e) {
e = o.apply(this, arguments);
var t = this.doc.createComment(e);
this.locator && a(this.locator, t),
u(this, t)
},
startCDATA: function() {
this.cdata = !0
},
endCDATA: function() {
this.cdata = !1
},
startDTD: function(e, t, i) {
var n = this.doc.implementation;
if (n && n.createDocumentType) {
var r = n.createDocumentType(e, t, i);
this.locator && a(this.locator, r),
u(this, r)
}
},
warning: function(e) {
console.warn("[xmldom warning]	" + e, s(this.locator))
},
error: function(e) {
console.error("[xmldom error]	" + e, s(this.locator))
},
fatalError: function(e) {
throw console.error("[xmldom fatalError]	" + e, s(this.locator)),
e
}
},
"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(e) {
r.prototype[e] = function() {
return null
}
});
var l = Ta.XMLReader
, c = t.DOMImplementation = za.DOMImplementation;
t.XMLSerializer = za.XMLSerializer,
t.DOMParser = i
});
Ga.DOMImplementation,
Ga.XMLSerializer;
var Xa = Ga.DOMParser
, Ka = function(e) {
return !!e && "object" == typeof e
}
, Ya = function Hy() {
for (var e = arguments.length, t = new Array(e), i = 0; e > i; i++)
t[i] = arguments[i];
return t.reduce(function(e, t) {
return Object.keys(t).forEach(function(i) {
e[i] = Array.isArray(e[i]) && Array.isArray(t[i]) ? e[i].concat(t[i]) : Ka(e[i]) && Ka(t[i]) ? Hy(e[i], t[i]) : t[i]
}),
e
}, {})
}
, $a = function(e) {
return Object.keys(e).map(function(t) {
return e[t]
})
}
, Qa = function(e, t) {
for (var i = [], n = e; t > n; n++)
i.push(n);
return i
}
, Ja = function(e) {
return e.reduce(function(e, t) {
return e.concat(t)
}, [])
}
, Za = function(e) {
if (!e.length)
return [];
for (var t = [], i = 0; i < e.length; i++)
t.push(e[i]);
return t
}
, es = function(e, t) {
return e.reduce(function(e, i, n) {
return i[t] && e.push(n),
e
}, [])
}
, ts = {
INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
DASH_INVALID_XML: "DASH_INVALID_XML",
NO_BASE_URL: "NO_BASE_URL",
MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
}
, is = function(e) {
var t = e.baseUrl
, i = void 0 === t ? "" : t
, n = e.source
, r = void 0 === n ? "" : n
, a = e.range
, s = void 0 === a ? "" : a
, o = e.indexRange
, u = void 0 === o ? "" : o
, l = {
uri: r,
resolvedUri: $r(i || "", r)
};
if (s || u) {
var c = s ? s : u
, d = c.split("-")
, h = parseInt(d[0], 10)
, f = parseInt(d[1], 10);
l.byterange = {
length: f - h + 1,
offset: h
}
}
return l
}
, ns = function(e) {
var t = e.offset + e.length - 1;
return e.offset + "-" + t
}
, rs = {
"static": function(e) {
var t = e.duration
, i = e.timescale
, n = void 0 === i ? 1 : i
, r = e.sourceDuration;
return {
start: 0,
end: Math.ceil(r / (t / n))
}
},
dynamic: function(e) {
var t = e.NOW
, i = e.clientOffset
, n = e.availabilityStartTime
, r = e.timescale
, a = void 0 === r ? 1 : r
, s = e.duration
, o = e.start
, u = void 0 === o ? 0 : o
, l = e.minimumUpdatePeriod
, c = void 0 === l ? 0 : l
, d = e.timeShiftBufferDepth
, h = void 0 === d ? 1 / 0 : d
, f = (t + i) / 1e3
, p = n + u
, m = f + c
, g = m - p
, v = Math.ceil(g * a / s)
, y = Math.floor((f - p - h) * a / s)
, _ = Math.floor((f - p) * a / s);
return {
start: Math.max(0, y),
end: Math.min(v, _)
}
}
}
, as = function(e) {
return function(t, i) {
var n = e.duration
, r = e.timescale
, a = void 0 === r ? 1 : r
, s = e.periodIndex
, o = e.startNumber
, u = void 0 === o ? 1 : o;
return {
number: u + t,
duration: n / a,
timeline: s,
time: i * n
}
}
}
, ss = function(e) {
var t = e.type
, i = void 0 === t ? "static" : t
, n = e.duration
, r = e.timescale
, a = void 0 === r ? 1 : r
, s = e.sourceDuration
, o = rs[i](e)
, u = o.start
, l = o.end
, c = Qa(u, l).map(as(e));
if ("static" === i) {
var d = c.length - 1;
c[d].duration = s - n / a * d
}
return c
}
, os = function(e) {
var t = e.baseUrl
, i = e.initialization
, n = void 0 === i ? {} : i
, r = e.sourceDuration
, a = e.indexRange
, s = void 0 === a ? "" : a
, o = e.duration;
if (!t)
throw new Error(ts.NO_BASE_URL);
var u = is({
baseUrl: t,
source: n.sourceURL,
range: n.range
})
, l = is({
baseUrl: t,
source: t,
indexRange: s
});
if (l.map = u,
o) {
var c = ss(e);
c.length && (l.duration = c[0].duration,
l.timeline = c[0].timeline)
} else
r && (l.duration = r,
l.timeline = 0);
return l.number = 0,
[l]
}
, us = function(e, t, i) {
for (var n = e.sidx.map ? e.sidx.map : null, r = e.sidx.duration, a = e.timeline || 0, s = e.sidx.byterange, o = s.offset + s.length, u = t.timescale, l = t.references.filter(function(e) {
return 1 !== e.referenceType
}), c = [], d = o + t.firstOffset, h = 0; h < l.length; h++) {
var f = t.references[h]
, p = f.referencedSize
, m = f.subsegmentDuration
, g = d + p - 1
, v = d + "-" + g
, y = {
baseUrl: i,
timescale: u,
timeline: a,
periodIndex: a,
duration: m,
sourceDuration: r,
indexRange: v
}
, _ = os(y)[0];
n && (_.map = n),
c.push(_),
d += p
}
return e.segments = c,
e
}
, ls = function(e) {
var t = $a(e.reduce(function(e, t) {
var i = t.attributes.id + (t.attributes.lang || "");
if (e[i]) {
var n;
t.segments[0] && (t.segments[0].discontinuity = !0),
(n = e[i].segments).push.apply(n, t.segments),
t.attributes.contentProtection && (e[i].attributes.contentProtection = t.attributes.contentProtection)
} else
e[i] = t;
return e
}, {}));
return t.map(function(e) {
return e.discontinuityStarts = es(e.segments, "discontinuity"),
e
})
}
, cs = function(e, t) {
if (void 0 === t && (t = {}),
!Object.keys(t).length)
return e;
for (var i in e) {
var n = e[i];
if (n.sidx) {
var r = n.sidx.uri + "-" + ns(n.sidx.byterange)
, a = t[r] && t[r].sidx;
n.sidx && a && us(n, a, n.sidx.resolvedUri)
}
}
return e
}
, ds = function(e) {
var t, i = e.attributes, n = e.segments, r = e.sidx, a = {
attributes: (t = {
NAME: i.id,
BANDWIDTH: i.bandwidth,
CODECS: i.codecs
},
t["PROGRAM-ID"] = 1,
t),
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 && (a.contentProtection = i.contentProtection),
r && (a.sidx = r),
a
}
, hs = function(e) {
var t, i = e.attributes, n = e.segments;
"undefined" == typeof n && (n = [{
uri: i.baseUrl,
timeline: i.periodIndex,
resolvedUri: i.baseUrl || "",
duration: i.sourceDuration,
number: 0
}],
i.duration = i.sourceDuration);
var r = (t = {
NAME: i.id,
BANDWIDTH: i.bandwidth
},
t["PROGRAM-ID"] = 1,
t);
return i.codecs && (r.CODECS = i.codecs),
{
attributes: r,
uri: "",
endList: "static" === (i.type || "static"),
timeline: i.periodIndex,
resolvedUri: i.baseUrl || "",
targetDuration: i.duration,
segments: n,
mediaSequence: n.length ? n[0].number : 1
}
}
, fs = function(e, t) {
void 0 === t && (t = {});
var i, n = e.reduce(function(e, n) {
var r = n.attributes.role && n.attributes.role.value || ""
, a = n.attributes.lang || ""
, s = "main";
if (a) {
var o = r ? " (" + r + ")" : "";
s = "" + n.attributes.lang + o
}
return e[s] && e[s].playlists[0].attributes.BANDWIDTH > n.attributes.bandwidth ? e : (e[s] = {
language: a,
autoselect: !0,
"default": "main" === r,
playlists: cs([ds(n)], t),
uri: ""
},
"undefined" == typeof i && "main" === r && (i = n,
i["default"] = !0),
e)
}, {});
if (!i) {
var r = Object.keys(n)[0];
n[r]["default"] = !0
}
return n
}
, ps = function(e, t) {
return void 0 === t && (t = {}),
e.reduce(function(e, i) {
var n = i.attributes.lang || "text";
return e[n] ? e : (e[n] = {
language: n,
"default": !1,
autoselect: !1,
playlists: cs([hs(i)], t),
uri: ""
},
e)
}, {})
}
, ms = function(e) {
var t, i = e.attributes, n = e.segments, r = e.sidx, a = {
attributes: (t = {
NAME: i.id,
AUDIO: "audio",
SUBTITLES: "subs",
RESOLUTION: {
width: i.width,
height: i.height
},
CODECS: i.codecs,
BANDWIDTH: i.bandwidth
},
t["PROGRAM-ID"] = 1,
t),
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 && (a.contentProtection = i.contentProtection),
r && (a.sidx = r),
a
}
, gs = function(e, t, i) {
var n;
if (void 0 === i && (i = {}),
!e.length)
return {};
var r = e[0].attributes
, a = r.sourceDuration
, s = r.type
, o = void 0 === s ? "static" : s
, u = r.suggestedPresentationDelay
, l = r.minimumUpdatePeriod
, c = function(e) {
var t = e.attributes;
return "video/mp4" === t.mimeType || "video" === t.contentType
}
, d = function(e) {
var t = e.attributes;
return "audio/mp4" === t.mimeType || "audio" === t.contentType
}
, h = function(e) {
var t = e.attributes;
return "text/vtt" === t.mimeType || "text" === t.contentType
}
, f = ls(e.filter(c)).map(ms)
, p = ls(e.filter(d))
, m = e.filter(h)
, g = {
allowCache: !0,
discontinuityStarts: [],
segments: [],
endList: !0,
mediaGroups: (n = {
AUDIO: {},
VIDEO: {}
},
n["CLOSED-CAPTIONS"] = {},
n.SUBTITLES = {},
n),
uri: "",
duration: a,
playlists: cs(f, i)
};
return l >= 0 && (g.minimumUpdatePeriod = 1e3 * l),
t && (g.locations = t),
"dynamic" === o && (g.suggestedPresentationDelay = u),
p.length && (g.mediaGroups.AUDIO.audio = fs(p, i)),
m.length && (g.mediaGroups.SUBTITLES.subs = ps(m, i)),
g
}
, vs = function(e, t, i) {
var n = e.NOW
, r = e.clientOffset
, a = e.availabilityStartTime
, s = e.timescale
, o = void 0 === s ? 1 : s
, u = e.start
, l = void 0 === u ? 0 : u
, c = e.minimumUpdatePeriod
, d = void 0 === c ? 0 : c
, h = (n + r) / 1e3
, f = a + l
, p = h + d
, m = p - f;
return Math.ceil((m * o - t) / i)
}
, ys = function(e, t) {
for (var i = e.type, n = void 0 === i ? "static" : i, r = e.minimumUpdatePeriod, a = void 0 === r ? 0 : r, s = e.media, o = void 0 === s ? "" : s, u = e.sourceDuration, l = e.timescale, c = void 0 === l ? 1 : l, d = e.startNumber, h = void 0 === d ? 1 : d, f = e.periodIndex, p = [], m = -1, g = 0; g < t.length; g++) {
var v = t[g]
, y = v.d
, _ = v.r || 0
, b = v.t || 0;
0 > m && (m = b),
b && b > m && (m = b);
var T = void 0;
if (0 > _) {
var S = g + 1;
T = S === t.length ? "dynamic" === n && a > 0 && o.indexOf("$Number$") > 0 ? vs(e, m, y) : (u * c - m) / y : (t[S].t - m) / y
} else
T = _ + 1;
for (var C = h + p.length + T, E = h + p.length; C > E; )
p.push({
number: E,
duration: y / c,
time: m,
timeline: f
}),
m += y,
E++
}
return p
}
, _s = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g
, bs = function(e) {
return function(t, i, n, r) {
if ("$$" === t)
return "$";
if ("undefined" == typeof e[i])
return t;
var a = "" + e[i];
return "RepresentationID" === i ? a : (r = n ? parseInt(r, 10) : 1,
a.length >= r ? a : "" + new Array(r - a.length + 1).join("0") + a)
}
}
, Ts = function(e, t) {
return e.replace(_s, bs(t))
}
, Ss = function(e, t) {
return e.duration || t ? e.duration ? ss(e) : ys(e, t) : [{
number: e.startNumber || 1,
duration: e.sourceDuration,
time: 0,
timeline: e.periodIndex
}]
}
, Cs = function(e, t) {
var i = {
RepresentationID: e.id,
Bandwidth: e.bandwidth || 0
}
, n = e.initialization
, r = void 0 === n ? {
sourceURL: "",
range: ""
} : n
, a = is({
baseUrl: e.baseUrl,
source: Ts(r.sourceURL, i),
range: r.range
})
, s = Ss(e, t);
return s.map(function(t) {
i.Number = t.number,
i.Time = t.time;
var n = Ts(e.media || "", i);
return {
uri: n,
timeline: t.timeline,
duration: t.duration,
resolvedUri: $r(e.baseUrl || "", n),
map: a,
number: t.number
}
})
}
, Es = function(e, t) {
var i = e.baseUrl
, n = e.initialization
, r = void 0 === n ? {} : n
, a = is({
baseUrl: i,
source: r.sourceURL,
range: r.range
})
, s = is({
baseUrl: i,
source: t.media,
range: t.mediaRange
});
return s.map = a,
s
}
, ks = function(e, t) {
var i = e.duration
, n = e.segmentUrls
, r = void 0 === n ? [] : n;
if (!i && !t || i && t)
throw new Error(ts.SEGMENT_TIME_UNSPECIFIED);
var a, s = r.map(function(t) {
return Es(e, t)
});
i && (a = ss(e)),
t && (a = ys(e, t));
var o = a.map(function(e, t) {
if (s[t]) {
var i = s[t];
return i.timeline = e.timeline,
i.duration = e.duration,
i.number = e.number,
i
}
}).filter(function(e) {
return e
});
return o
}
, ws = function(e) {
var t, i, n = e.attributes, r = e.segmentInfo;
r.template ? (i = Cs,
t = Ya(n, r.template)) : r.base ? (i = os,
t = Ya(n, r.base)) : r.list && (i = ks,
t = Ya(n, r.list));
var a = {
attributes: n
};
if (!i)
return a;
var s = i(t, r.timeline);
if (t.duration) {
var o = t
, u = o.duration
, l = o.timescale
, c = void 0 === l ? 1 : l;
t.duration = u / c
} else
t.duration = s.length ? s.reduce(function(e, t) {
return Math.max(e, Math.ceil(t.duration))
}, 0) : 0;
return a.attributes = t,
a.segments = s,
r.base && t.indexRange && (a.sidx = s[0],
a.segments = []),
a
}
, Is = function(e) {
return e.map(ws)
}
, As = function(e, t) {
return Za(e.childNodes).filter(function(e) {
var i = e.tagName;
return i === t
})
}
, xs = function(e) {
return e.textContent.trim()
}
, Ps = function(e) {
var t = 31536e3
, i = 2592e3
, n = 86400
, r = 3600
, a = 60
, s = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/
, o = s.exec(e);
if (!o)
return 0;
var u = o.slice(1)
, l = u[0]
, c = u[1]
, d = u[2]
, h = u[3]
, f = u[4]
, p = u[5];
return parseFloat(l || 0) * t + parseFloat(c || 0) * i + parseFloat(d || 0) * n + parseFloat(h || 0) * r + parseFloat(f || 0) * a + parseFloat(p || 0)
}
, Ls = function(e) {
var t = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
return t.test(e) && (e += "Z"),
Date.parse(e)
}
, Ds = {
mediaPresentationDuration: function(e) {
return Ps(e)
},
availabilityStartTime: function(e) {
return Ls(e) / 1e3
},
minimumUpdatePeriod: function(e) {
return Ps(e)
},
suggestedPresentationDelay: function(e) {
return Ps(e)
},
type: function(e) {
return e
},
timeShiftBufferDepth: function(e) {
return Ps(e)
},
start: function(e) {
return Ps(e)
},
width: function(e) {
return parseInt(e, 10)
},
height: function(e) {
return parseInt(e, 10)
},
bandwidth: function(e) {
return parseInt(e, 10)
},
startNumber: function(e) {
return parseInt(e, 10)
},
timescale: function(e) {
return parseInt(e, 10)
},
duration: function(e) {
var t = parseInt(e, 10);
return isNaN(t) ? Ps(e) : t
},
d: function(e) {
return parseInt(e, 10)
},
t: function(e) {
return parseInt(e, 10)
},
r: function(e) {
return parseInt(e, 10)
},
DEFAULT: function(e) {
return e
}
}
, Os = function(e) {
return e && e.attributes ? Za(e.attributes).reduce(function(e, t) {
var i = Ds[t.name] || Ds.DEFAULT;
return e[t.name] = i(t.value),
e
}, {}) : {}
}
, Ns = {
"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"
}
, Ms = function(e, t) {
return t.length ? Ja(e.map(function(e) {
return t.map(function(t) {
return $r(e, xs(t))
})
})) : e
}
, Rs = function(e) {
var t = As(e, "SegmentTemplate")[0]
, i = As(e, "SegmentList")[0]
, n = i && As(i, "SegmentURL").map(function(e) {
return Ya({
tag: "SegmentURL"
}, Os(e))
})
, r = As(e, "SegmentBase")[0]
, a = i || t
, s = a && As(a, "SegmentTimeline")[0]
, o = i || r || t
, u = o && As(o, "Initialization")[0]
, l = t && Os(t);
l && u ? l.initialization = u && Os(u) : l && l.initialization && (l.initialization = {
sourceURL: l.initialization
});
var c = {
template: l,
timeline: s && As(s, "S").map(function(e) {
return Os(e)
}),
list: i && Ya(Os(i), {
segmentUrls: n,
initialization: Os(u)
}),
base: r && Ya(Os(r), {
initialization: Os(u)
})
};
return Object.keys(c).forEach(function(e) {
c[e] || delete c[e]
}),
c
}
, Us = function(e, t, i) {
return function(n) {
var r = As(n, "BaseURL")
, a = Ms(t, r)
, s = Ya(e, Os(n))
, o = Rs(n);
return a.map(function(e) {
return {
segmentInfo: Ya(i, o),
attributes: Ya(s, {
baseUrl: e
})
}
})
}
}
, Fs = function(e) {
return e.reduce(function(e, t) {
var i = Os(t)
, n = Ns[i.schemeIdUri];
if (n) {
e[n] = {
attributes: i
};
var r = As(t, "cenc:pssh")[0];
if (r) {
var a = xs(r)
, s = a && ta(a);
e[n].pssh = s
}
}
return e
}, {})
}
, Bs = function(e, t, i) {
return function(n) {
var r = Os(n)
, a = Ms(t, As(n, "BaseURL"))
, s = As(n, "Role")[0]
, o = {
role: Os(s)
}
, u = Ya(e, r, o)
, l = Fs(As(n, "ContentProtection"));
Object.keys(l).length && (u = Ya(u, {
contentProtection: l
}));
var c = Rs(n)
, d = As(n, "Representation")
, h = Ya(i, c);
return Ja(d.map(Us(u, a, h)))
}
}
, js = function(e, t) {
return function(i, n) {
var r = Ms(t, As(i, "BaseURL"))
, a = Os(i)
, s = parseInt(a.id, 10)
, o = dr["default"].isNaN(s) ? n : s
, u = Ya(e, {
periodIndex: o
})
, l = As(i, "AdaptationSet")
, c = Rs(i);
return Ja(l.map(Bs(u, r, c)))
}
}
, Vs = function(e, t) {
void 0 === t && (t = {});
var i = t
, 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 = As(e, "Period");
if (!l.length)
throw new Error(ts.INVALID_NUMBER_OF_PERIOD);
var c = As(e, "Location")
, d = Os(e)
, h = Ms([r], As(e, "BaseURL"));
return d.sourceDuration = d.mediaPresentationDuration || 0,
d.NOW = s,
d.clientOffset = u,
c.length && (d.locations = c.map(xs)),
{
locations: d.locations,
representationInfo: Ja(l.map(js(d, h)))
}
}
, qs = function(e) {
if ("" === e)
throw new Error(ts.DASH_EMPTY_MANIFEST);
var t = new Xa
, i = t.parseFromString(e, "application/xml")
, n = i && "MPD" === i.documentElement.tagName ? i.documentElement : null;
if (!n || n && n.getElementsByTagName("parsererror").length > 0)
throw new Error(ts.DASH_INVALID_XML);
return n
}
, Hs = function(e) {
var t = As(e, "UTCTiming")[0];
if (!t)
return null;
var i = Os(t);
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(ts.UNSUPPORTED_UTC_TIMING_SCHEME)
}
return i
}
, Ws = function(e, t) {
void 0 === t && (t = {});
var i = Vs(qs(e), t)
, n = Is(i.representationInfo);
return gs(n, i.locations, t.sidxMapping)
}
, zs = function(e) {
return Hs(qs(e))
}
, Gs = function(e) {
var t, i = new DataView(e.buffer,e.byteOffset,e.byteLength), n = {
version: e[0],
flags: new Uint8Array(e.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 (t = 24; r; t += 12,
r--)
n.references.push({
referenceType: (128 & e[t]) >>> 7,
referencedSize: 2147483647 & i.getUint32(t),
subsegmentDuration: i.getUint32(t + 4),
startsWithSap: !!(128 & e[t + 8]),
sapType: (112 & e[t + 8]) >>> 4,
sapDeltaTime: 268435455 & i.getUint32(t + 8)
});
return n
}
, Xs = Gs
, Ks = r(function(e, t) {
Object.defineProperty(t, "__esModule", {
value: !0
});
var i = function(e) {
return e instanceof Uint8Array ? e : new Uint8Array(e && e.buffer || e,e && e.byteOffset || 0,e && e.byteLength || 0)
}
, n = function(e) {
if (!e)
return "";
e = Array.prototype.slice.call(e);
var t = String.fromCharCode.apply(null, i(e));
try {
return decodeURIComponent(escape(t))
} catch (n) {}
return t
}
, r = function(e, t) {
void 0 === t && (t = 0),
e = i(e);
var n = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]
, r = e[t + 5]
, a = (16 & r) >> 4;
return a ? n + 20 : n + 10
}
, a = function c(e, t) {
return void 0 === t && (t = 0),
e = i(e),
e.length - t < 10 || "ID3" !== n(e.subarray(t, t + 3)) ? t : (t += r(e, t),
c(e, t))
}
, s = {
aac: function(e) {
var t = a(e);
return e.length >= t + 2 && 255 === (255 & e[t]) && 224 === (224 & e[t + 1]) && 16 === (22 & e[t + 1])
},
mp3: function(e) {
var t = a(e);
return e.length >= t + 2 && 255 === (255 & e[t]) && 224 === (224 & e[t + 1]) && 2 === (6 & e[t + 1])
},
webm: function(e) {
return e.length >= 4 && 26 === (255 & e[0]) && 69 === (255 & e[1]) && 223 === (255 & e[2]) && 163 === (255 & e[3])
},
mp4: function(e) {
return e.length >= 8 && /^(f|s)typ$/.test(n(e.subarray(4, 8))) && !/^ftyp3g$/.test(n(e.subarray(4, 10)))
},
"3gp": function(e) {
return e.length >= 10 && /^ftyp3g$/.test(n(e.subarray(4, 10)))
},
ts: function(e) {
if (e.length < 189 && e.length >= 1)
return 71 === e[0];
for (var t = 0; t + 188 < e.length && 188 > t; ) {
if (71 === e[t] && 71 === e[t + 188])
return !0;
t += 1
}
return !1
},
flac: function(e) {
return e.length >= 4 && /^fLaC$/.test(n(e.subarray(0, 4)))
},
ogg: function(e) {
return e.length >= 4 && /^OggS$/.test(n(e.subarray(0, 4)))
}
}
, o = Object.keys(s).filter(function(e) {
return "ts" !== e
}).concat("ts");
o.forEach(function(e) {
var t = s[e];
s[e] = function(e) {
return t(i(e))
}
});
var u = function(e) {
e = i(e);
for (var t = 0; t < o.length; t++) {
var n = o[t];
if (s[n](e))
return n
}
return ""
}
, l = function(e) {
e = i(e);
for (var t = 0; t < e.length; ) {
var r = (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0
, a = n(e.subarray(t + 4, t + 8));
if ("moof" === a)
return !0;
0 === r || r + t > e.length ? t = e.length : t += r
}
return !1
};
t.detectContainerForBytes = u,
t.getId3Offset = a,
t.id3Size = r,
t.isLikely = s,
t.isLikelyFmp4MediaSegment = l
});
n(Ks);
var Ys = Ks.detectContainerForBytes
, $s = Ks.getId3Offset;
Ks.id3Size,
Ks.isLikely;
var Qs = Ks.isLikelyFmp4MediaSegment
, Js = r(function(e, t) {
Object.defineProperty(t, "__esModule", {
value: !0
});
var i = function(e) {
return ArrayBuffer.isView(e)
}
, n = function(e) {
return e instanceof Uint8Array ? e : new Uint8Array(e && e.buffer || e,e && e.byteOffset || 0,e && e.byteLength || 0)
}
, r = function(e) {
if (!e)
return "";
e = Array.prototype.slice.call(e);
var t = String.fromCharCode.apply(null, n(e));
try {
return decodeURIComponent(escape(t))
} catch (i) {}
return t
}
, a = function(e, t) {
void 0 === t && (t = !1);
var i = [];
return "string" != typeof e && e && "function" == typeof e.toString && (e = e.toString()),
"string" != typeof e ? i : (t || (e = unescape(encodeURIComponent(e))),
e.split("").map(function(e) {
return 255 & e.charCodeAt(0)
}))
}
, s = function() {
for (var e = arguments.length, t = new Array(e), i = 0; e > i; i++)
t[i] = arguments[i];
var r = t.reduce(function(e, t) {
var i = t && (t.byteLength || t.length);
return e += i || 0
}, 0)
, a = new Uint8Array(r)
, s = 0;
return t.forEach(function(e) {
e = n(e),
a.set(e, s),
s += e.byteLength
}),
a
};
t.bytesToString = r,
t.concatTypedArrays = s,
t.isTypedArray = i,
t.stringToBytes = a,
t.toUint8 = n
});
n(Js),
Js.bytesToString;
var Zs = Js.concatTypedArrays;
Js.isTypedArray;
var eo = Js.stringToBytes
, to = Js.toUint8
, io = {
H264_STREAM_TYPE: 27,
ADTS_STREAM_TYPE: 15,
METADATA_STREAM_TYPE: 21
}
, no = 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) : !1
}
,
this.trigger = function(t) {
var i, n, r, a;
if (i = e[t])
if (2 === arguments.length)
for (r = i.length,
n = 0; r > n; ++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; r > n; ++n)
i[n].apply(this, a)
}
}
,
this.dispose = function() {
e = {}
}
}
};
no.prototype.pipe = function(e) {
return this.on("data", function(t) {
e.push(t)
}),
this.on("done", function(t) {
e.flush(t)
}),
this.on("partialdone", function(t) {
e.partialFlush(t)
}),
this.on("endedtimeline", function(t) {
e.endTimeline(t)
}),
this.on("reset", function(t) {
e.reset(t)
}),
e
}
,
no.prototype.push = function(e) {
this.trigger("data", e)
}
,
no.prototype.flush = function(e) {
this.trigger("done", e)
}
,
no.prototype.partialFlush = function(e) {
this.trigger("partialdone", e)
}
,
no.prototype.endTimeline = function(e) {
this.trigger("endedtimeline", e)
}
,
no.prototype.reset = function(e) {
this.trigger("reset", e)
}
;
var ro = no
, ao = 8589934592
, so = 4294967296
, oo = "shared"
, uo = function(e, t) {
var i = 1;
for (e > t && (i = -1); Math.abs(t - e) > so; )
e += i * ao;
return e
}
, lo = function Wy(e) {
var t, i;
Wy.prototype.init.call(this),
this.type_ = e || oo,
this.push = function(e) {
(this.type_ === oo || e.type === this.type_) && (void 0 === i && (i = e.dts),
e.dts = uo(e.dts, i),
e.pts = uo(e.pts, i),
t = e.dts,
this.trigger("data", e))
}
,
this.flush = function() {
i = t,
this.trigger("done")
}
,
this.endTimeline = function() {
this.flush(),
this.trigger("endedtimeline")
}
,
this.discontinuity = function() {
i = void 0,
t = void 0
}
,
this.reset = function() {
this.discontinuity(),
this.trigger("reset")
}
};
lo.prototype = new ro;
var co, ho, fo, po, mo, go, vo, yo = {
TimestampRolloverStream: lo,
handleRollover: uo
}, _o = function(e) {
var t = 31 & e[1];
return t <<= 8,
t |= e[2]
}, bo = function(e) {
return !!(64 & e[1])
}, To = function(e) {
var t = 0;
return (48 & e[3]) >>> 4 > 1 && (t += e[4] + 1),
t
}, So = function(e, t) {
var i = _o(e);
return 0 === i ? "pat" : i === t ? "pmt" : t ? "pes" : null
}, Co = function(e) {
var t = bo(e)
, i = 4 + To(e);
return t && (i += e[i] + 1),
(31 & e[i + 10]) << 8 | e[i + 11]
}, Eo = function(e) {
var t = {}
, i = bo(e)
, n = 4 + To(e);
if (i && (n += e[n] + 1),
1 & e[n + 5]) {
var r, a, s;
r = (15 & e[n + 1]) << 8 | e[n + 2],
a = 3 + r - 4,
s = (15 & e[n + 10]) << 8 | e[n + 11];
for (var o = 12 + s; a > o; ) {
var u = n + o;
t[(31 & e[u + 1]) << 8 | e[u + 2]] = e[u],
o += ((15 & e[u + 3]) << 8 | e[u + 4]) + 5
}
return t
}
}, ko = function(e, t) {
var i = _o(e)
, n = t[i];
switch (n) {
case io.H264_STREAM_TYPE:
return "video";
case io.ADTS_STREAM_TYPE:
return "audio";
case io.METADATA_STREAM_TYPE:
return "timed-metadata";
default:
return null
}
}, wo = function(e) {
var t = bo(e);
if (!t)
return null;
var i = 4 + To(e);
if (i >= e.byteLength)
return null;
var n, r = null;
return n = e[i + 7],
192 & n && (r = {},
r.pts = (14 & e[i + 9]) << 27 | (255 & e[i + 10]) << 20 | (254 & e[i + 11]) << 12 | (255 & e[i + 12]) << 5 | (254 & e[i + 13]) >>> 3,
r.pts *= 4,
r.pts += (6 & e[i + 13]) >>> 1,
r.dts = r.pts,
64 & n && (r.dts = (14 & e[i + 14]) << 27 | (255 & e[i + 15]) << 20 | (254 & e[i + 16]) << 12 | (255 & e[i + 17]) << 5 | (254 & e[i + 18]) >>> 3,
r.dts *= 4,
r.dts += (6 & e[i + 18]) >>> 1)),
r
}, Io = 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
}
}, Ao = function(e) {
for (var t, i = 4 + To(e), n = e.subarray(i), r = 0, a = 0, s = !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 && (t = Io(31 & n[a + 3]),
"slice_layer_without_partitioning_rbsp_idr" === t && (s = !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 = Io(31 & n[a + 3]),
"slice_layer_without_partitioning_rbsp_idr" === t && (s = !0),
a = r - 2,
r += 3;
break;
default:
r += 3
}
return n = n.subarray(a),
r -= a,
a = 0,
n && n.byteLength > 3 && (t = Io(31 & n[a + 3]),
"slice_layer_without_partitioning_rbsp_idr" === t && (s = !0)),
s
}, xo = {
parseType: So,
parsePat: Co,
parsePmt: Eo,
parsePayloadUnitStartIndicator: bo,
parsePesType: ko,
parsePesTime: wo,
videoPacketContainsKeyFrame: Ao
}, Po = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], Lo = function(e, t) {
var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]
, n = e[t + 5]
, r = (16 & n) >> 4;
return i = i >= 0 ? i : 0,
r ? i + 20 : i + 10
}, Do = function zy(e, t) {
return e.length - t < 10 || e[t] !== "I".charCodeAt(0) || e[t + 1] !== "D".charCodeAt(0) || e[t + 2] !== "3".charCodeAt(0) ? t : (t += Lo(e, t),
zy(e, t))
}, Oo = function(e) {
var t = Do(e, 0);
return e.length >= t + 2 && 255 === (255 & e[t]) && 240 === (240 & e[t + 1]) && 16 === (22 & e[t + 1])
}, No = function(e) {
return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
}, Mo = function(e, t, i) {
var n, r = "";
for (n = t; i > n; n++)
r += "%" + ("00" + e[n].toString(16)).slice(-2);
return r
}, Ro = function(e, t, i) {
return unescape(Mo(e, t, i))
}, Uo = function(e, t) {
var i = (224 & e[t + 5]) >> 5
, n = e[t + 4] << 3
, r = 6144 & e[t + 3];
return r | n | i
}, Fo = function(e, t) {
return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3".charCodeAt(0) ? "timed-metadata" : e[t] & !0 && 240 === (240 & e[t + 1]) ? "audio" : null
}, Bo = function(e) {
for (var t = 0; t + 5 < e.length; ) {
if (255 === e[t] && 240 === (246 & e[t + 1]))
return Po[(60 & e[t + 2]) >>> 2];
t++
}
return null
}, jo = function(e) {
var t, i, n, r;
t = 10,
64 & e[5] && (t += 4,
t += No(e.subarray(10, 14)));
do {
if (i = No(e.subarray(t + 4, t + 8)),
1 > i)
return null;
if (r = String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3]),
"PRIV" === r) {
n = e.subarray(t + 10, t + i + 10);
for (var a = 0; a < n.byteLength; a++)
if (0 === n[a]) {
var s = Ro(n, 0, a);
if ("com.apple.streaming.transportStreamTimestamp" === s) {
var o = n.subarray(a + 1)
, u = (1 & o[3]) << 30 | o[4] << 22 | o[5] << 14 | o[6] << 6 | o[7] >>> 2;
return u *= 4,
u += 3 & o[7]
}
break
}
}
t += 10,
t += i
} while (t < e.byteLength);
return null
}, Vo = {
isLikelyAacData: Oo,
parseId3TagSize: Lo,
parseAdtsSize: Uo,
parseType: Fo,
parseSampleRate: Bo,
parseAacTimestamp: jo
}, qo = 9e4;
co = function(e) {
return e * qo
}
,
ho = function(e, t) {
return e * t
}
,
fo = function(e) {
return e / qo
}
,
po = function(e, t) {
return e / t
}
,
mo = function(e, t) {
return co(po(e, t))
}
,
go = function(e, t) {
return ho(fo(e), t)
}
,
vo = function(e, t, i) {
return fo(i ? e : e - t)
}
;
var Ho = {
ONE_SECOND_IN_TS: qo,
secondsToVideoTs: co,
secondsToAudioTs: ho,
videoTsToSeconds: fo,
audioTsToSeconds: po,
audioTsToVideoTs: mo,
videoTsToAudioTs: go,
metadataTsToSeconds: vo
}
, Wo = Ho.ONE_SECOND_IN_TS
, zo = yo.handleRollover
, Go = {};
Go.ts = xo,
Go.aac = Vo;
var Xo, Ko, Yo, $o, Qo, Jo, Zo = Ho.ONE_SECOND_IN_TS, eu = 188, tu = 71, iu = function(e, t) {
for (var i, n, r = 0, a = eu; a < e.byteLength; )
if (e[r] !== tu || e[a] !== tu)
r++,
a++;
else {
switch (i = e.subarray(r, a),
n = Go.ts.parseType(i, t.pid)) {
case "pat":
t.pid || (t.pid = Go.ts.parsePat(i));
break;
case "pmt":
t.table || (t.table = Go.ts.parsePmt(i))
}
if (t.pid && t.table)
return;
r += eu,
a += eu
}
}, nu = function(e, t, i) {
for (var n, r, a, s, o, u = 0, l = eu, c = !1; l <= e.byteLength; )
if (e[u] !== tu || e[l] !== tu && l !== e.byteLength)
u++,
l++;
else {
switch (n = e.subarray(u, l),
r = Go.ts.parseType(n, t.pid)) {
case "pes":
a = Go.ts.parsePesType(n, t.table),
s = Go.ts.parsePayloadUnitStartIndicator(n),
"audio" === a && s && (o = Go.ts.parsePesTime(n),
o && (o.type = "audio",
i.audio.push(o),
c = !0))
}
if (c)
break;
u += eu,
l += eu
}
for (l = e.byteLength,
u = l - eu,
c = !1; u >= 0; )
if (e[u] !== tu || e[l] !== tu && l !== e.byteLength)
u--,
l--;
else {
switch (n = e.subarray(u, l),
r = Go.ts.parseType(n, t.pid)) {
case "pes":
a = Go.ts.parsePesType(n, t.table),
s = Go.ts.parsePayloadUnitStartIndicator(n),
"audio" === a && s && (o = Go.ts.parsePesTime(n),
o && (o.type = "audio",
i.audio.push(o),
c = !0))
}
if (c)
break;
u -= eu,
l -= eu
}
}, ru = function(e, t, i) {
for (var n, r, a, s, o, u, l, c, d = 0, h = eu, f = !1, p = {
data: [],
size: 0
}; h < e.byteLength; )
if (e[d] !== tu || e[h] !== tu)
d++,
h++;
else {
switch (n = e.subarray(d, h),
r = Go.ts.parseType(n, t.pid)) {
case "pes":
if (a = Go.ts.parsePesType(n, t.table),
s = Go.ts.parsePayloadUnitStartIndicator(n),
"video" === a && (s && !f && (o = Go.ts.parsePesTime(n),
o && (o.type = "video",
i.video.push(o),
f = !0)),
!i.firstKeyFrame)) {
if (s && 0 !== p.size) {
for (u = new Uint8Array(p.size),
l = 0; p.data.length; )
c = p.data.shift(),
u.set(c, l),
l += c.byteLength;
if (Go.ts.videoPacketContainsKeyFrame(u)) {
var m = Go.ts.parsePesTime(u);
m ? (i.firstKeyFrame = m,
i.firstKeyFrame.type = "video") : console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")
}
p.size = 0
}
p.data.push(n),
p.size += n.byteLength
}
}
if (f && i.firstKeyFrame)
break;
d += eu,
h += eu
}
for (h = e.byteLength,
d = h - eu,
f = !1; d >= 0; )
if (e[d] !== tu || e[h] !== tu)
d--,
h--;
else {
switch (n = e.subarray(d, h),
r = Go.ts.parseType(n, t.pid)) {
case "pes":
a = Go.ts.parsePesType(n, t.table),
s = Go.ts.parsePayloadUnitStartIndicator(n),
"video" === a && s && (o = Go.ts.parsePesTime(n),
o && (o.type = "video",
i.video.push(o),
f = !0))
}
if (f)
break;
d -= eu,
h -= eu
}
}, au = function(e, t) {
if (e.audio && e.audio.length) {
var i = t;
"undefined" == typeof i && (i = e.audio[0].dts),
e.audio.forEach(function(e) {
e.dts = zo(e.dts, i),
e.pts = zo(e.pts, i),
e.dtsTime = e.dts / Zo,
e.ptsTime = e.pts / Zo
})
}
if (e.video && e.video.length) {
var n = t;
if ("undefined" == typeof n && (n = e.video[0].dts),
e.video.forEach(function(e) {
e.dts = zo(e.dts, n),
e.pts = zo(e.pts, n),
e.dtsTime = e.dts / Zo,
e.ptsTime = e.pts / Zo
}),
e.firstKeyFrame) {
var r = e.firstKeyFrame;
r.dts = zo(r.dts, n),
r.pts = zo(r.pts, n),
r.dtsTime = r.dts / Zo,
r.ptsTime = r.dts / Zo
}
}
}, su = function(e) {
for (var t, i = !1, n = 0, r = null, a = null, s = 0, o = 0; e.length - o >= 3; ) {
var u = Go.aac.parseType(e, o);
switch (u) {
case "timed-metadata":
if (e.length - o < 10) {
i = !0;
break
}
if (s = Go.aac.parseId3TagSize(e, o),
s > e.length) {
i = !0;
break
}
null === a && (t = e.subarray(o, o + s),
a = Go.aac.parseAacTimestamp(t)),
o += s;
break;
case "audio":
if (e.length - o < 7) {
i = !0;
break
}
if (s = Go.aac.parseAdtsSize(e, o),
s > e.length) {
i = !0;
break
}
null === r && (t = e.subarray(o, o + s),
r = Go.aac.parseSampleRate(t)),
n++,
o += s;
break;
default:
o++
}
if (i)
return null
}
if (null === r || null === a)
return null;
var l = Zo / r
, c = {
audio: [{
type: "audio",
dts: a,
pts: a
}, {
type: "audio",
dts: a + 1024 * n * l,
pts: a + 1024 * n * l
}]
};
return c
}, ou = function(e) {
var t = {
pid: null,
table: null
}
, i = {};
iu(e, t);
for (var n in t.table)
if (t.table.hasOwnProperty(n)) {
var r = t.table[n];
switch (r) {
case io.H264_STREAM_TYPE:
i.video = [],
ru(e, t, i),
0 === i.video.length && delete i.video;
break;
case io.ADTS_STREAM_TYPE:
i.audio = [],
nu(e, t, i),
0 === i.audio.length && delete i.audio
}
}
return i
}, uu = function(e, t) {
var i, n = Go.aac.isLikelyAacData(e);
return i = n ? su(e) : ou(e),
i && (i.audio || i.video) ? (au(i, t),
i) : null
}, lu = {
inspect: uu,
parseAudioPes_: nu
}, cu = function(e) {
return e >>> 0
}, du = function(e) {
return ("00" + e.toString(16)).slice(-2)
}, hu = {
toUnsigned: cu,
toHexString: du
}, fu = 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])
}, pu = fu, mu = hu.toUnsigned, gu = function Gy(e, t) {
var i, n, r, a, s, o = [];
if (!t.length)
return null;
for (i = 0; i < e.byteLength; )
n = mu(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]),
r = pu(e.subarray(i + 4, i + 8)),
a = n > 1 ? i + n : e.byteLength,
r === t[0] && (1 === t.length ? o.push(e.subarray(i + 8, a)) : (s = Gy(e.subarray(i + 8, a), t.slice(1)),
s.length && (o = o.concat(s)))),
i = a;
return o
}, vu = gu, yu = function(e) {
var t, i = new DataView(e.buffer,e.byteOffset,e.byteLength), n = {
version: e[0],
flags: new Uint8Array(e.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 t = 8,
r && (t += 4,
n.baseDataOffset = i.getUint32(12),
t += 4),
a && (n.sampleDescriptionIndex = i.getUint32(t),
t += 4),
s && (n.defaultSampleDuration = i.getUint32(t),
t += 4),
o && (n.defaultSampleSize = i.getUint32(t),
t += 4),
u && (n.defaultSampleFlags = i.getUint32(t)),
l && (n.durationIsEmpty = !0),
!r && c && (n.baseDataOffsetIsMoof = !0),
n
}, _u = yu, bu = function(e) {
return {
isLeading: (12 & e[0]) >>> 2,
dependsOn: 3 & e[0],
isDependedOn: (192 & e[1]) >>> 6,
hasRedundancy: (48 & e[1]) >>> 4,
paddingValue: (14 & e[1]) >>> 1,
isNonSyncSample: 1 & e[1],
degradationPriority: e[2] << 8 | e[3]
}
}, Tu = bu, Su = function(e) {
var t, i = {
version: e[0],
flags: new Uint8Array(e.subarray(1, 4)),
samples: []
}, n = new DataView(e.buffer,e.byteOffset,e.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), d = 8;
for (r && (i.dataOffset = n.getInt32(d),
d += 4),
a && c && (t = {
flags: Tu(e.subarray(d, d + 4))
},
d += 4,
s && (t.duration = n.getUint32(d),
d += 4),
o && (t.size = n.getUint32(d),
d += 4),
l && (t.compositionTimeOffset = 1 === i.version ? n.getInt32(d) : n.getUint32(d),
d += 4),
i.samples.push(t),
c--); c--; )
t = {},
s && (t.duration = n.getUint32(d),
d += 4),
o && (t.size = n.getUint32(d),
d += 4),
u && (t.flags = Tu(e.subarray(d, d + 4)),
d += 4),
l && (t.compositionTimeOffset = 1 === i.version ? n.getInt32(d) : n.getUint32(d),
d += 4),
i.samples.push(t);
return i
}, Cu = Su, Eu = hu.toUnsigned, ku = function(e) {
var t = {
version: e[0],
flags: new Uint8Array(e.subarray(1, 4)),
baseMediaDecodeTime: Eu(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7])
};
return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32),
t.baseMediaDecodeTime += Eu(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])),
t
}, wu = ku, Iu = hu.toUnsigned, Au = hu.toHexString;
Xo = function(e) {
var t = {}
, i = vu(e, ["moov", "trak"]);
return i.reduce(function(e, t) {
var i, n, r, a, s;
return (i = vu(t, ["tkhd"])[0]) ? (n = i[0],
r = 0 === n ? 12 : 20,
a = Iu(i[r] << 24 | i[r + 1] << 16 | i[r + 2] << 8 | i[r + 3]),
(s = vu(t, ["mdia", "mdhd"])[0]) ? (n = s[0],
r = 0 === n ? 12 : 20,
e[a] = Iu(s[r] << 24 | s[r + 1] << 16 | s[r + 2] << 8 | s[r + 3]),
e) : null) : null
}, t)
}
,
Ko = function(e, t) {
var i, n, r;
return i = vu(t, ["moof", "traf"]),
n = [].concat.apply([], i.map(function(t) {
return vu(t, ["tfhd"]).map(function(i) {
var n, r, a;
return n = Iu(i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7]),
r = e[n] || 9e4,
a = vu(t, ["tfdt"]).map(function(e) {
var t, i;
return t = e[0],
i = Iu(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]),
1 === t && (i *= Math.pow(2, 32),
i += Iu(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])),
i
})[0],
a = a || 1 / 0,
a / r
})
})),
r = Math.min.apply(null, n),
isFinite(r) ? r : 0
}
,
Yo = function(e, t) {
var i, n = vu(t, ["moof", "traf"]), r = 0, a = 0;
if (n && n.length) {
var s = vu(n[0], ["tfhd"])[0]
, o = vu(n[0], ["trun"])[0]
, u = vu(n[0], ["tfdt"])[0];
if (s) {
var l = _u(s);
i = l.trackId
}
if (u) {
var c = wu(u);
r = c.baseMediaDecodeTime
}
if (o) {
var d = Cu(o);
d.samples && d.samples.length && (a = d.samples[0].compositionTimeOffset || 0)
}
}
var h = e[i] || 9e4;
return (r + a) / h
}
,
$o = function(e) {
var t = vu(e, ["moov", "trak"])
, i = [];
return t.forEach(function(e) {
var t = vu(e, ["mdia", "hdlr"])
, n = vu(e, ["tkhd"]);
t.forEach(function(e, t) {
var r, a, s, o = pu(e.subarray(8, 12)), u = n[t];
"vide" === o && (r = new DataView(u.buffer,u.byteOffset,u.byteLength),
a = r.getUint8(0),
s = r.getUint32(0 === a ? 12 : 20),
i.push(s))
})
}),
i
}
,
Jo = function(e) {
var t = e[0]
, i = 0 === t ? 12 : 20;
return Iu(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3])
}
,
Qo = function(e) {
var t = vu(e, ["moov", "trak"])
, i = [];
return t.forEach(function(e) {
var t, n, r = {}, a = vu(e, ["tkhd"])[0];
a && (t = new DataView(a.buffer,a.byteOffset,a.byteLength),
n = t.getUint8(0),
r.id = t.getUint32(0 === n ? 12 : 20));
var s = vu(e, ["mdia", "hdlr"])[0];
if (s) {
var o = pu(s.subarray(8, 12));
r.type = "vide" === o ? "video" : "soun" === o ? "audio" : o
}
var u = vu(e, ["mdia", "minf", "stbl", "stsd"])[0];
if (u) {
var l = u.subarray(8);
r.codec = pu(l.subarray(4, 8));
var c, d, h = vu(l, [r.codec])[0];
h && (/^[a-z]vc[1-9]$/i.test(r.codec) ? (c = h.subarray(78),
d = pu(c.subarray(4, 8)),
"avcC" === d && c.length > 11 ? (r.codec += ".",
r.codec += Au(c[9]),
r.codec += Au(c[10]),
r.codec += Au(c[11])) : r.codec = "avc1.4d400d") : /^mp4[a,v]$/i.test(r.codec) && (c = h.subarray(28),
d = pu(c.subarray(4, 8)),
"esds" === d && c.length > 20 && 0 !== c[19] ? (r.codec += "." + Au(c[19]),
r.codec += "." + Au(c[20] >>> 2 & 63).replace(/^0/, "")) : r.codec = "mp4a.40.2"))
}
var f = vu(e, ["mdia", "mdhd"])[0];
f && (r.timescale = Jo(f)),
i.push(r)
}),
i
}
;
var xu = {
findBox: vu,
parseType: pu,
timescale: Xo,
startTime: Ko,
compositionStartTime: Yo,
videoTrackIds: $o,
tracks: Qo,
getTimescaleFromMediaHeader: Jo
}
, Pu = r(function(e, t) {
function i(e) {
return e && "object" == typeof e && "default"in e ? e["default"] : e
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var n = i(dr["default"])
, r = {
mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3)/,
text: /^(stpp.ttml.im1t)/,
muxerVideo: /^(avc0?1)/,
muxerAudio: /^(mp4a)/,
muxerText: /a^/
}
, a = ["video", "audio", "text"]
, s = ["Video", "Audio", "Text"]
, o = function(e) {
return e ? e.replace(/avc1\.(\d+)\.(\d+)/i, function(e, t, i) {
var n = ("00" + Number(t).toString(16)).slice(-2)
, r = ("00" + Number(i).toString(16)).slice(-2);
return "avc1." + n + "00" + r
}) : e
}
, u = function(e) {
return e.map(o)
}
, l = function(e) {
return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e) {
return u([e])[0]
})
}
, c = function(e) {
void 0 === e && (e = "");
var t = e.split(",")
, i = {}
, n = [];
return t.forEach(function(e) {
e = e.trim();
var t;
a.forEach(function(n) {
var a = r[n].exec(e.toLowerCase());
if (a && !(a.length <= 1)) {
t = n;
var s = e.substring(0, a[1].length)
, o = e.replace(s, "");
i[n] = {
type: s,
details: o
}
}
}),
t || n.push(e)
}),
n.length && (i.unknown = n),
i
}
, d = function(e, t) {
if (!e.mediaGroups.AUDIO || !t)
return null;
var i = e.mediaGroups.AUDIO[t];
if (!i)
return null;
for (var n in i) {
var r = i[n];
if (r["default"] && r.playlists)
return c(r.playlists[0].attributes.CODECS)
}
return null
}
, h = function(e) {
return void 0 === e && (e = ""),
r.video.test(e.trim().toLowerCase())
}
, f = function(e) {
return void 0 === e && (e = ""),
r.audio.test(e.trim().toLowerCase())
}
, p = function(e) {
return void 0 === e && (e = ""),
r.text.test(e.trim().toLowerCase())
}
, m = function(e) {
if (e && "string" == typeof e) {
var t = e.toLowerCase().split(",").map(function(e) {
return o(e.trim())
})
, i = "video";
1 === t.length && f(t[0]) ? i = "audio" : 1 === t.length && p(t[0]) && (i = "application");
var n = "mp4";
return t.every(function(e) {
return r.mp4.test(e)
}) ? n = "mp4" : t.every(function(e) {
return r.webm.test(e)
}) ? n = "webm" : t.every(function(e) {
return r.ogg.test(e)
}) && (n = "ogg"),
i + "/" + n + ';codecs="' + e + '"'
}
}
, g = function(e) {
return void 0 === e && (e = ""),
n.MediaSource && n.MediaSource.isTypeSupported && n.MediaSource.isTypeSupported(m(e)) || !1
}
, v = function(e) {
return void 0 === e && (e = ""),
e.toLowerCase().split(",").every(function(e) {
e = e.trim();
for (var t = 0; t < s.length; t++) {
var i = s[t];
if (r["muxer" + i].test(e))
return !0
}
return !1
})
}
, y = "mp4a.40.2"
, _ = "avc1.4d400d";
t.DEFAULT_AUDIO_CODEC = y,
t.DEFAULT_VIDEO_CODEC = _,
t.browserSupportsCodec = g,
t.codecsFromDefault = d,
t.getMimeForCodec = m,
t.isAudioCodec = f,
t.isTextCodec = p,
t.isVideoCodec = h,
t.mapLegacyAvcCodecs = l,
t.muxerSupportsCodec = v,
t.parseCodecs = c,
t.translateLegacyCodec = o,
t.translateLegacyCodecs = u
});
n(Pu);
var Lu = Pu.DEFAULT_AUDIO_CODEC
, Du = Pu.DEFAULT_VIDEO_CODEC
, Ou = Pu.browserSupportsCodec
, Nu = Pu.codecsFromDefault
, Mu = Pu.getMimeForCodec
, Ru = Pu.isAudioCodec;
Pu.isTextCodec;
var Uu = Pu.isVideoCodec;
Pu.mapLegacyAvcCodecs;
var Fu = Pu.muxerSupportsCodec
, Bu = Pu.parseCodecs
, ju = Pu.translateLegacyCodec;
Pu.translateLegacyCodecs;
var Vu, qu = "7.10.2", Hu = [], Wu = function(e, t) {
return function(i, n, r) {
var a = t.levels[n]
, s = new RegExp("^(" + a + ")$");
if ("log" !== i && r.unshift(i.toUpperCase() + ":"),
r.unshift(e + ":"),
Hu) {
Hu.push([].concat(r));
var o = Hu.length - 1e3;
Hu.splice(0, o > 0 ? o : 0)
}
if (dr["default"].console) {
var u = dr["default"].console[i];
u || "debug" !== i || (u = dr["default"].console.info || dr["default"].console.log),
u && a && s.test(i) && u[Array.isArray(r) ? "apply" : "call"](dr["default"].console, r)
}
}
}, zu = Vt("VIDEOJS"), Gu = zu.createLogger, Xu = Object.prototype.toString, Ku = function(e) {
return zt(e) ? Object.keys(e) : []
}, Yu = ei("querySelector"), $u = ei("querySelectorAll"), Qu = Object.freeze({
__proto__: null,
isReal: Qt,
isEl: Jt,
isInFrame: Zt,
createEl: ti,
textContent: ii,
prependTo: ni,
hasClass: ri,
addClass: ai,
removeClass: si,
toggleClass: oi,
setAttributes: ui,
getAttributes: li,
getAttribute: ci,
setAttribute: di,
removeAttribute: hi,
blockTextSelection: fi,
unblockTextSelection: pi,
getBoundingClientRect: mi,
findPosition: gi,
getPointerPosition: vi,
isTextNode: yi,
emptyEl: _i,
normalizeContent: bi,
appendContent: Ti,
insertContent: Si,
isSingleLeftClick: Ci,
$: Yu,
$$: $u
}), Ju = !1, Zu = function() {
if (Qt() && Vu.options.autoSetup !== !1) {
var e = Array.prototype.slice.call(hr["default"].getElementsByTagName("video"))
, t = Array.prototype.slice.call(hr["default"].getElementsByTagName("audio"))
, i = Array.prototype.slice.call(hr["default"].getElementsByTagName("video-js"))
, n = e.concat(t, i);
if (n && n.length > 0)
for (var r = 0, a = n.length; a > r; r++) {
var s = n[r];
if (!s || !s.getAttribute) {
Ei(1);
break
}
if (void 0 === s.player) {
var o = s.getAttribute("data-setup");
null !== o && Vu(s)
}
}
else
Ju || Ei(1)
}
};
Qt() && ("complete" === hr["default"].readyState ? ki() : dr["default"].addEventListener("load", ki));
var el, tl = function(e) {
var t = hr["default"].createElement("style");
return t.className = e,
t
}, il = function(e, t) {
e.styleSheet ? e.styleSheet.cssText = t : e.textContent = t
}, nl = 3, rl = nl;
dr["default"].WeakMap || (el = function() {
function e() {
this.vdata = "vdata" + Math.floor(dr["default"].performance && dr["default"].performance.now() || Date.now()),
this.data = {}
}
var t = e.prototype;
return t.set = function(e, t) {
var i = e[this.vdata] || wi();
return e[this.vdata] || (e[this.vdata] = i),
this.data[i] = t,
this
}
,
t.get = function(e) {
var t = e[this.vdata];
return t ? this.data[t] : void zu("We have no data for this element", e)
}
,
t.has = function(e) {
var t = e[this.vdata];
return t in this.data
}
,
t["delete"] = function(e) {
var t = e[this.vdata];
t && (delete this.data[t],
delete e[this.vdata])
}
,
e
}());
var al, sl = dr["default"].WeakMap ? new WeakMap : new el, ol = function() {
if ("boolean" != typeof al) {
al = !1;
try {
var e = Object.defineProperty({}, "passive", {
get: function() {
al = !0
}
});
dr["default"].addEventListener("test", null, e),
dr["default"].removeEventListener("test", null, e)
} catch (t) {}
}
return al
}, ul = ["touchstart", "touchmove"], ll = Object.freeze({
__proto__: null,
fixEvent: xi,
on: Pi,
off: Li,
trigger: Di,
one: Oi,
any: Ni
}), cl = 30, dl = function(e, t, i) {
t.guid || (t.guid = wi());
var n = t.bind(e);
return n.guid = i ? i + "_" + t.guid : t.guid,
n
}, hl = function(e, t) {
var i = dr["default"].performance.now()
, n = function() {
var n = dr["default"].performance.now();
n - i >= t && (e.apply(void 0, arguments),
i = n)
};
return n
}, fl = function(e, t, i, n) {
void 0 === n && (n = dr["default"]);
var r, a = function() {
n.clearTimeout(r),
r = null
}, s = function() {
var a = this
, s = arguments
, o = function() {
r = null,
o = null,
i || e.apply(a, s)
};
!r && i && e.apply(a, s),
n.clearTimeout(r),
r = n.setTimeout(o, t)
};
return s.cancel = a,
s
}, pl = function() {};
pl.prototype.allowedEvents_ = {},
pl.prototype.on = function(e, t) {
var i = this.addEventListener;
this.addEventListener = function() {}
,
Pi(this, e, t),
this.addEventListener = i
}
,
pl.prototype.addEventListener = pl.prototype.on,
pl.prototype.off = function(e, t) {
Li(this, e, t)
}
,
pl.prototype.removeEventListener = pl.prototype.off,
pl.prototype.one = function(e, t) {
var i = this.addEventListener;
this.addEventListener = function() {}
,
Oi(this, e, t),
this.addEventListener = i
}
,
pl.prototype.any = function(e, t) {
var i = this.addEventListener;
this.addEventListener = function() {}
,
Ni(this, e, t),
this.addEventListener = i
}
,
pl.prototype.trigger = function(e) {
var t = e.type || e;
"string" == typeof e && (e = {
type: t
}),
e = xi(e),
this.allowedEvents_[t] && this["on" + t] && this["on" + t](e),
Di(this, e)
}
,
pl.prototype.dispatchEvent = pl.prototype.trigger;
var ml;
pl.prototype.queueTrigger = function(e) {
var t = this;
ml || (ml = new Map);
var i = e.type || e
, n = ml.get(this);
n || (n = new Map,
ml.set(this, n));
var r = n.get(i);
n["delete"](i),
dr["default"].clearTimeout(r);
var a = dr["default"].setTimeout(function() {
0 === n.size && (n = null,
ml["delete"](t)),
t.trigger(e)
}, 0);
n.set(i, a)
}
;
var gl = function(e) {
return e instanceof pl || !!e.eventBusEl_ && ["on", "one", "off", "trigger"].every(function(t) {
return "function" == typeof e[t]
})
}
, vl = function(e, t) {
gl(e) ? t() : (e.eventedCallbacks || (e.eventedCallbacks = []),
e.eventedCallbacks.push(t))
}
, yl = function(e) {
return "string" == typeof e && /\S/.test(e) || Array.isArray(e) && !!e.length
}
, _l = function(e) {
if (!e.nodeName && !gl(e))
throw new Error("Invalid target; must be a DOM node or evented object.")
}
, bl = function(e) {
if (!yl(e))
throw new Error("Invalid event type; must be a non-empty string or array.")
}
, Tl = function(e) {
if ("function" != typeof e)
throw new Error("Invalid listener; must be a function.")
}
, Sl = function(e, t) {
var i, n, r, a = t.length < 3 || t[0] === e || t[0] === e.eventBusEl_;
return a ? (i = e.eventBusEl_,
t.length >= 3 && t.shift(),
n = t[0],
r = t[1]) : (i = t[0],
n = t[1],
r = t[2]),
_l(i),
bl(n),
Tl(r),
r = dl(e, r),
{
isTargetingSelf: a,
target: i,
type: n,
listener: r
}
}
, Cl = function(e, t, i, n) {
_l(e),
e.nodeName ? ll[t](e, i, n) : e[t](i, n)
}
, El = {
on: function() {
for (var e = this, t = arguments.length, i = new Array(t), n = 0; t > n; n++)
i[n] = arguments[n];
var r = Sl(this, i)
, a = r.isTargetingSelf
, s = r.target
, o = r.type
, u = r.listener;
if (Cl(s, "on", o, u),
!a) {
var l = function() {
return e.off(s, o, u)
};
l.guid = u.guid;
var c = function() {
return e.off("dispose", l)
};
c.guid = u.guid,
Cl(this, "on", "dispose", l),
Cl(s, "on", "dispose", c)
}
},
one: function() {
for (var e = this, t = arguments.length, i = new Array(t), n = 0; t > n; n++)
i[n] = arguments[n];
var r = Sl(this, i)
, a = r.isTargetingSelf
, s = r.target
, o = r.type
, u = r.listener;
if (a)
Cl(s, "one", o, u);
else {
var l = function c() {
e.off(s, o, c);
for (var t = arguments.length, i = new Array(t), n = 0; t > n; n++)
i[n] = arguments[n];
u.apply(null, i)
};
l.guid = u.guid,
Cl(s, "one", o, l)
}
},
any: function() {
for (var e = this, t = arguments.length, i = new Array(t), n = 0; t > n; n++)
i[n] = arguments[n];
var r = Sl(this, i)
, a = r.isTargetingSelf
, s = r.target
, o = r.type
, u = r.listener;
if (a)
Cl(s, "any", o, u);
else {
var l = function c() {
e.off(s, o, c);
for (var t = arguments.length, i = new Array(t), n = 0; t > n; n++)
i[n] = arguments[n];
u.apply(null, i)
};
l.guid = u.guid,
Cl(s, "any", o, l)
}
},
off: function(e, t, i) {
if (!e || yl(e))
Li(this.eventBusEl_, e, t);
else {
var n = e
, r = t;
_l(n),
bl(r),
Tl(i),
i = dl(this, i),
this.off("dispose", i),
n.nodeName ? (Li(n, r, i),
Li(n, "dispose", i)) : gl(n) && (n.off(r, i),
n.off("dispose", i))
}
},
trigger: function(e, t) {
return Di(this.eventBusEl_, e, t)
}
}
, kl = {
state: {},
setState: function(e) {
var t = this;
"function" == typeof e && (e = e());
var i;
return qt(e, function(e, n) {
t.state[n] !== e && (i = i || {},
i[n] = {
from: t.state[n],
to: e
}),
t.state[n] = e
}),
i && gl(this) && this.trigger({
changes: i,
type: "statechanged"
}),
i
}
}
, wl = function(e) {
return "string" != typeof e ? e : e.replace(/./, function(e) {
return e.toLowerCase()
})
}
, Il = function(e) {
return "string" != typeof e ? e : e.replace(/./, function(e) {
return e.toUpperCase()
})
}
, Al = function(e, t) {
return Il(e) === Il(t)
}
, xl = function() {
function e() {
this.map_ = {}
}
var t = e.prototype;
return t.has = function(e) {
return e in this.map_
}
,
t["delete"] = function(e) {
var t = this.has(e);
return delete this.map_[e],
t
}
,
t.set = function(e, t) {
return this.set_[e] = t,
this
}
,
t.forEach = function(e, t) {
for (var i in this.map_)
e.call(t, this.map_[i], i, this)
}
,
e
}()
, Pl = dr["default"].Map ? dr["default"].Map : xl
, Ll = function() {
function e() {
this.set_ = {}
}
var t = e.prototype;
return t.has = function(e) {
return e in this.set_
}
,
t["delete"] = function(e) {
var t = this.has(e);
return delete this.set_[e],
t
}
,
t.add = function(e) {
return this.set_[e] = 1,
this
}
,
t.forEach = function(e, t) {
for (var i in this.set_)
e.call(t, i, i, this)
}
,
e
}()
, Dl = dr["default"].Set ? dr["default"].Set : Ll
, Ol = function() {
function e(e, t, i) {
if (this.player_ = !e && this.play ? e = this : e,
this.isDisposed_ = !1,
this.parentComponent_ = null,
this.options_ = Ui({}, this.options_),
t = this.options_ = Ui(this.options_, t),
this.id_ = t.id || t.el && t.el.id,
!this.id_) {
var n = e && e.id && e.id() || "no_player";
this.id_ = n + "_component_" + wi()
}
this.name_ = t.name || null,
t.el ? this.el_ = t.el : t.createEl !== !1 && (this.el_ = this.createEl()),
t.evented !== !1 && Mi(this, {
eventBusKey: this.el_ ? "el_" : null
}),
Ri(this, this.constructor.defaultState),
this.children_ = [],
this.childIndex_ = {},
this.childNameIndex_ = {},
this.setTimeoutIds_ = new Dl,
this.setIntervalIds_ = new Dl,
this.rafIds_ = new Dl,
this.namedRafs_ = new Pl,
this.clearingTimersOnDispose_ = !1,
t.initChildren !== !1 && this.initChildren(),
this.ready(i),
t.reportTouchActivity !== !1 && this.enableTouchActivity()
}
var t = e.prototype;
return t.dispose = function() {
if (!this.isDisposed_) {
if (this.trigger({
type: "dispose",
bubbles: !1
}),
this.isDisposed_ = !0,
this.children_)
for (var e = this.children_.length - 1; e >= 0; e--)
this.children_[e].dispose && this.children_[e].dispose();
this.children_ = null,
this.childIndex_ = null,
this.childNameIndex_ = null,
this.parentComponent_ = null,
this.el_ && (this.el_.parentNode && this.el_.parentNode.removeChild(this.el_),
sl.has(this.el_) && sl["delete"](this.el_),
this.el_ = null),
this.player_ = null
}
}
,
t.isDisposed = function() {
return Boolean(this.isDisposed_)
}
,
t.player = function() {
return this.player_
}
,
t.options = function(e) {
return e ? (this.options_ = Ui(this.options_, e),
this.options_) : this.options_
}
,
t.el = function() {
return this.el_
}
,
t.createEl = function(e, t, i) {
return ti(e, t, i)
}
,
t.localize = function(e, t, i) {
void 0 === i && (i = e);
var n = this.player_.language && this.player_.language()
, r = this.player_.languages && this.player_.languages()
, a = r && r[n]
, s = n && n.split("-")[0]
, o = r && r[s]
, u = i;
return a && a[e] ? u = a[e] : o && o[e] && (u = o[e]),
t && (u = u.replace(/\{(\d+)\}/g, function(e, i) {
var n = t[i - 1]
, r = n;
return "undefined" == typeof n && (r = e),
r
})),
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(e) {
return this.childIndex_[e]
}
,
t.getChild = function(e) {
return e ? this.childNameIndex_[e] : void 0
}
,
t.getDescendant = function() {
for (var e = arguments.length, t = new Array(e), i = 0; e > i; i++)
t[i] = arguments[i];
t = t.reduce(function(e, t) {
return e.concat(t)
}, []);
for (var n = this, r = 0; r < t.length; r++)
if (n = n.getChild(t[r]),
!n || !n.getChild)
return;
return n
}
,
t.addChild = function(t, i, n) {
void 0 === i && (i = {}),
void 0 === n && (n = this.children_.length);
var r, a;
if ("string" == typeof t) {
a = Il(t);
var s = i.componentClass || a;
i.name = a;
var o = e.getComponent(s);
if (!o)
throw new Error("Component " + s + " does not exist");
if ("function" != typeof o)
return null;
r = new o(this.player_ || this,i)
} else
r = t;
if (r.parentComponent_ && r.parentComponent_.removeChild(r),
this.children_.splice(n, 0, r),
r.parentComponent_ = this,
"function" == typeof r.id && (this.childIndex_[r.id()] = r),
a = a || r.name && Il(r.name()),
a && (this.childNameIndex_[a] = r,
this.childNameIndex_[wl(a)] = r),
"function" == typeof r.el && r.el()) {
var u = null;
this.children_[n + 1] && (this.children_[n + 1].el_ ? u = this.children_[n + 1].el_ : Jt(this.children_[n + 1]) && (u = this.children_[n + 1])),
this.contentEl().insertBefore(r.el(), u)
}
return r
}
,
t.removeChild = function(e) {
if ("string" == typeof e && (e = this.getChild(e)),
e && this.children_) {
for (var t = !1, i = this.children_.length - 1; i >= 0; i--)
if (this.children_[i] === e) {
t = !0,
this.children_.splice(i, 1);
break
}
if (t) {
e.parentComponent_ = null,
this.childIndex_[e.id()] = null,
this.childNameIndex_[Il(e.name())] = null,
this.childNameIndex_[wl(e.name())] = null;
var n = e.el();
n && n.parentNode === this.contentEl() && this.contentEl().removeChild(e.el())
}
}
}
,
t.initChildren = function() {
var t = this
, i = this.options_.children;
if (i) {
var n, r = this.options_, a = function(e) {
var i = e.name
, n = e.opts;
if (void 0 !== r[i] && (n = r[i]),
n !== !1) {
n === !0 && (n = {}),
n.playerOptions = t.options_.playerOptions;
var a = t.addChild(i, n);
a && (t[i] = a)
}
}, s = e.getComponent("Tech");
n = Array.isArray(i) ? i : Object.keys(i),
n.concat(Object.keys(this.options_).filter(function(e) {
return !n.some(function(t) {
return "string" == typeof t ? e === t : e === t.name
})
})).map(function(e) {
var n, r;
return "string" == typeof e ? (n = e,
r = i[n] || t.options_[n] || {}) : (n = e.name,
r = e),
{
name: n,
opts: r
}
}).filter(function(t) {
var i = e.getComponent(t.opts.componentClass || Il(t.name));
return i && !s.isTech(i)
}).forEach(a)
}
}
,
t.buildCSSClass = function() {
return ""
}
,
t.ready = function(e, t) {
return void 0 === t && (t = !1),
e ? this.isReady_ ? void (t ? e.call(this) : this.setTimeout(e, 1)) : (this.readyQueue_ = this.readyQueue_ || [],
void this.readyQueue_.push(e)) : void 0
}
,
t.triggerReady = function() {
this.isReady_ = !0,
this.setTimeout(function() {
var e = this.readyQueue_;
this.readyQueue_ = [],
e && e.length > 0 && e.forEach(function(e) {
e.call(this)
}, this),
this.trigger("ready")
}, 1)
}
,
t.$ = function(e, t) {
return Yu(e, t || this.contentEl())
}
,
t.$$ = function(e, t) {
return $u(e, t || this.contentEl())
}
,
t.hasClass = function(e) {
return ri(this.el_, e)
}
,
t.addClass = function(e) {
ai(this.el_, e)
}
,
t.removeClass = function(e) {
si(this.el_, e)
}
,
t.toggleClass = function(e, t) {
oi(this.el_, e, t)
}
,
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(e) {
return ci(this.el_, e)
}
,
t.setAttribute = function(e, t) {
di(this.el_, e, t)
}
,
t.removeAttribute = function(e) {
hi(this.el_, e)
}
,
t.width = function(e, t) {
return this.dimension("width", e, t)
}
,
t.height = function(e, t) {
return this.dimension("height", e, t)
}
,
t.dimensions = function(e, t) {
this.width(e, !0),
this.height(t)
}
,
t.dimension = function(e, t, i) {
if (void 0 !== t)
return (null === t || t !== t) && (t = 0),
this.el_.style[e] = -1 !== ("" + t).indexOf("%") || -1 !== ("" + t).indexOf("px") ? t : "auto" === t ? "" : t + "px",
void (i || this.trigger("componentresize"));
if (!this.el_)
return 0;
var n = this.el_.style[e]
, r = n.indexOf("px");
return -1 !== r ? parseInt(n.slice(0, r), 10) : parseInt(this.el_["offset" + Il(e)], 10)
}
,
t.currentDimension = function(e) {
var t = 0;
if ("width" !== e && "height" !== e)
throw new Error("currentDimension only accepts width or height value");
if (t = Xt(this.el_, e),
t = parseFloat(t),
0 === t || isNaN(t)) {
var i = "offset" + Il(e);
t = this.el_[i]
}
return t
}
,
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.handleKeyDown = function(e) {
this.player_ && (e.stopPropagation(),
this.player_.handleKeyDown(e))
}
,
t.handleKeyPress = function(e) {
this.handleKeyDown(e)
}
,
t.emitTapEvents = function() {
var e, t = 0, i = null, n = 10, r = 200;
this.on("touchstart", function(n) {
1 === n.touches.length && (i = {
pageX: n.touches[0].pageX,
pageY: n.touches[0].pageY
},
t = dr["default"].performance.now(),
e = !0)
}),
this.on("touchmove", function(t) {
if (t.touches.length > 1)
e = !1;
else if (i) {
var r = t.touches[0].pageX - i.pageX
, a = t.touches[0].pageY - i.pageY
, s = Math.sqrt(r * r + a * a);
s > n && (e = !1)
}
});
var a = function() {
e = !1
};
this.on("touchleave", a),
this.on("touchcancel", a),
this.on("touchend", function(n) {
if (i = null,
e === !0) {
var a = dr["default"].performance.now() - t;
r > a && (n.preventDefault(),
this.trigger("tap"))
}
})
}
,
t.enableTouchActivity = function() {
if (this.player() && this.player().reportUserActivity) {
var e, t = dl(this.player(), this.player().reportUserActivity);
this.on("touchstart", function() {
t(),
this.clearInterval(e),
e = this.setInterval(t, 250)
});
var i = function() {
t(),
this.clearInterval(e)
};
this.on("touchmove", t),
this.on("touchend", i),
this.on("touchcancel", i)
}
}
,
t.setTimeout = function(e, t) {
var i, n = this;
return e = dl(this, e),
this.clearTimersOnDispose_(),
i = dr["default"].setTimeout(function() {
n.setTimeoutIds_.has(i) && n.setTimeoutIds_["delete"](i),
e()
}, t),
this.setTimeoutIds_.add(i),
i
}
,
t.clearTimeout = function(e) {
return this.setTimeoutIds_.has(e) && (this.setTimeoutIds_["delete"](e),
dr["default"].clearTimeout(e)),
e
}
,
t.setInterval = function(e, t) {
e = dl(this, e),
this.clearTimersOnDispose_();
var i = dr["default"].setInterval(e, t);
return this.setIntervalIds_.add(i),
i
}
,
t.clearInterval = function(e) {
return this.setIntervalIds_.has(e) && (this.setIntervalIds_["delete"](e),
dr["default"].clearInterval(e)),
e
}
,
t.requestAnimationFrame = function(e) {
var t = this;
if (!this.supportsRaf_)
return this.setTimeout(e, 1e3 / 60);
this.clearTimersOnDispose_();
var i;
return e = dl(this, e),
i = dr["default"].requestAnimationFrame(function() {
t.rafIds_.has(i) && t.rafIds_["delete"](i),
e()
}),
this.rafIds_.add(i),
i
}
,
t.requestNamedAnimationFrame = function(e, t) {
var i = this;
if (!this.namedRafs_.has(e)) {
this.clearTimersOnDispose_(),
t = dl(this, t);
var n = this.requestAnimationFrame(function() {
t(),
i.namedRafs_.has(e) && i.namedRafs_["delete"](e)
});
return this.namedRafs_.set(e, n),
e
}
}
,
t.cancelNamedAnimationFrame = function(e) {
this.namedRafs_.has(e) && (this.cancelAnimationFrame(this.namedRafs_.get(e)),
this.namedRafs_["delete"](e))
}
,
t.cancelAnimationFrame = function(e) {
return this.supportsRaf_ ? (this.rafIds_.has(e) && (this.rafIds_["delete"](e),
dr["default"].cancelAnimationFrame(e)),
e) : this.clearTimeout(e)
}
,
t.clearTimersOnDispose_ = function() {
var e = this;
this.clearingTimersOnDispose_ || (this.clearingTimersOnDispose_ = !0,
this.one("dispose", function() {
[["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(function(t) {
var i = t[0]
, n = t[1];
e[i].forEach(function(t, i) {
return e[n](i)
})
}),
e.clearingTimersOnDispose_ = !1
}))
}
,
e.registerComponent = function(t, i) {
if ("string" != typeof t || !t)
throw new Error('Illegal component name, "' + t + '"; must be a non-empty string.');
var n = e.getComponent("Tech")
, r = n && n.isTech(i)
, a = e === i || e.prototype.isPrototypeOf(i.prototype);
if (r || !a) {
var s;
throw s = r ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass",
new Error('Illegal component, "' + t + '"; ' + s + ".")
}
t = Il(t),
e.components_ || (e.components_ = {});
var o = e.getComponent("Player");
if ("Player" === t && o && o.players) {
var u = o.players
, l = Object.keys(u);
if (u && l.length > 0 && l.map(function(e) {
return u[e]
}).every(Boolean))
throw new Error("Can not register Player component after player has been created.")
}
return e.components_[t] = i,
e.components_[wl(t)] = i,
i
}
,
e.getComponent = function(t) {
return t && e.components_ ? e.components_[t] : void 0
}
,
e
}();
Ol.prototype.supportsRaf_ = "function" == typeof dr["default"].requestAnimationFrame && "function" == typeof dr["default"].cancelAnimationFrame,
Ol.registerComponent("Component", Ol);
for (var Nl, Ml = dr["default"].navigator && dr["default"].navigator.userAgent || "", Rl = /AppleWebKit\/([\d.]+)/i.exec(Ml), Ul = Rl ? parseFloat(Rl.pop()) : null, Fl = /iPod/i.test(Ml), Bl = function() {
var e = Ml.match(/OS (\d+)_/i);
return e && e[1] ? e[1] : null
}(), jl = /Android/i.test(Ml), Vl = function() {
var e = Ml.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
if (!e)
return null;
var t = e[1] && parseFloat(e[1])
, i = e[2] && parseFloat(e[2]);
return t && i ? parseFloat(e[1] + "." + e[2]) : t ? t : null
}(), ql = jl && 5 > Vl && 537 > Ul, Hl = /Firefox/i.test(Ml), Wl = /Edg/i.test(Ml), zl = !Wl && (/Chrome/i.test(Ml) || /CriOS/i.test(Ml)), Gl = function() {
var e = Ml.match(/(Chrome|CriOS)\/(\d+)/);
return e && e[2] ? parseFloat(e[2]) : null
}(), Xl = function() {
var e = /MSIE\s(\d+)\.\d/.exec(Ml)
, t = e && parseFloat(e[1]);
return !t && /Trident\/7.0/i.test(Ml) && /rv:11.0/.test(Ml) && (t = 11),
t
}(), Kl = /Safari/i.test(Ml) && !zl && !jl && !Wl, Yl = /Windows/i.test(Ml), $l = (Qt() && ("ontouchstart"in dr["default"] || dr["default"].navigator.maxTouchPoints || dr["default"].DocumentTouch && dr["default"].document instanceof dr["default"].DocumentTouch)), Ql = /iPad/i.test(Ml) || Kl && $l && !/iPhone/i.test(Ml), Jl = /iPhone/i.test(Ml) && !Ql, Zl = Jl || Ql || Fl, ec = (Kl || Zl) && !zl, tc = Object.freeze({
__proto__: null,
IS_IPOD: Fl,
IOS_VERSION: Bl,
IS_ANDROID: jl,
ANDROID_VERSION: Vl,
IS_NATIVE_ANDROID: ql,
IS_FIREFOX: Hl,
IS_EDGE: Wl,
IS_CHROME: zl,
CHROME_VERSION: Gl,
IE_VERSION: Xl,
IS_SAFARI: Kl,
IS_WINDOWS: Yl,
TOUCH_ENABLED: $l,
IS_IPAD: Ql,
IS_IPHONE: Jl,
IS_IOS: Zl,
IS_ANY_SAFARI: ec
}), ic = {
prefixed: !0
}, nc = [["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"], ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"], ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"], ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]], rc = nc[0], ac = 0; ac < nc.length; ac++)
if (nc[ac][1]in hr["default"]) {
Nl = nc[ac];
break
}
if (Nl) {
for (var sc = 0; sc < Nl.length; sc++)
ic[rc[sc]] = Nl[sc];
ic.prefixed = Nl[0] !== rc[0]
}
Hi.prototype.code = 0,
Hi.prototype.message = "",
Hi.prototype.status = null,
Hi.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"],
Hi.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 oc = 0; oc < Hi.errorTypes.length; oc++)
Hi[Hi.errorTypes[oc]] = oc,
Hi.prototype[Hi.errorTypes[oc]] = oc;
var uc = function(e) {
var t = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function(t, i) {
return e[i] && (t[i] = e[i]),
t
}, {
cues: e.cues && Array.prototype.map.call(e.cues, function(e) {
return {
startTime: e.startTime,
endTime: e.endTime,
text: e.text,
id: e.id
}
})
});
return t
}
, lc = function(e) {
var t = e.$$("track")
, i = Array.prototype.map.call(t, function(e) {
return e.track
})
, n = Array.prototype.map.call(t, function(e) {
var t = uc(e.track);
return e.src && (t.src = e.src),
t
});
return n.concat(Array.prototype.filter.call(e.textTracks(), function(e) {
return -1 === i.indexOf(e)
}).map(uc))
}
, cc = function(e, t) {
return e.forEach(function(e) {
var i = t.addRemoteTextTrack(e).track;
!e.src && e.cues && e.cues.forEach(function(e) {
return i.addCue(e)
})
}),
t.textTracks()
}
, dc = {
textTracksToJson: lc,
jsonToTextTracks: cc,
trackToJson_: uc
}
, hc = "vjs-modal-dialog"
, fc = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.opened_ = n.hasBeenOpened_ = n.hasBeenFilled_ = !1,
n.closeable(!n.options_.uncloseable),
n.content(n.options_.content),
n.contentEl_ = ti("div", {
className: hc + "-content"
}, {
role: "document"
}),
n.descEl_ = ti("p", {
className: hc + "-description vjs-control-text",
id: n.el().getAttribute("aria-describedby")
}),
ii(n.descEl_, n.description()),
n.el_.appendChild(n.descEl_),
n.el_.appendChild(n.contentEl_),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: this.buildCSSClass(),
tabIndex: -1
}, {
"aria-describedby": this.id() + "_description",
"aria-hidden": "true",
"aria-label": this.label(),
role: "dialog"
})
}
,
i.dispose = function() {
this.contentEl_ = null,
this.descEl_ = null,
this.previouslyActiveEl_ = null,
e.prototype.dispose.call(this)
}
,
i.buildCSSClass = function() {
return hc + " vjs-hidden " + e.prototype.buildCSSClass.call(this)
}
,
i.label = function() {
return this.localize(this.options_.label || "Modal Window")
}
,
i.description = function() {
var e = this.options_.description || this.localize("This is a modal window.");
return this.closeable() && (e += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),
e
}
,
i.open = function() {
if (!this.opened_) {
var e = this.player();
this.trigger("beforemodalopen"),
this.opened_ = !0,
(this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) && this.fill(),
this.wasPlaying_ = !e.paused(),
this.options_.pauseOnOpen && this.wasPlaying_ && e.pause(),
this.on("keydown", this.handleKeyDown),
this.hadControls_ = e.controls(),
e.controls(!1),
this.show(),
this.conditionalFocus_(),
this.el().setAttribute("aria-hidden", "false"),
this.trigger("modalopen"),
this.hasBeenOpened_ = !0
}
}
,
i.opened = function(e) {
return "boolean" == typeof e && this[e ? "open" : "close"](),
this.opened_
}
,
i.close = function() {
if (this.opened_) {
var e = this.player();
this.trigger("beforemodalclose"),
this.opened_ = !1,
this.wasPlaying_ && this.options_.pauseOnOpen && e.play(),
this.off("keydown", this.handleKeyDown),
this.hadControls_ && e.controls(!0),
this.hide(),
this.el().setAttribute("aria-hidden", "true"),
this.trigger("modalclose"),
this.conditionalBlur_(),
this.options_.temporary && this.dispose()
}
}
,
i.closeable = function n(e) {
if ("boolean" == typeof e) {
var n = this.closeable_ = !!e
, t = this.getChild("closeButton");
if (n && !t) {
var i = this.contentEl_;
this.contentEl_ = this.el_,
t = this.addChild("closeButton", {
controlText: "Close Modal Dialog"
}),
this.contentEl_ = i,
this.on(t, "close", this.close)
}
!n && t && (this.off(t, "close", this.close),
this.removeChild(t),
t.dispose())
}
return this.closeable_
}
,
i.fill = function() {
this.fillWith(this.content())
}
,
i.fillWith = function(e) {
var t = this.contentEl()
, i = t.parentNode
, n = t.nextSibling;
this.trigger("beforemodalfill"),
this.hasBeenFilled_ = !0,
i.removeChild(t),
this.empty(),
Si(t, e),
this.trigger("modalfill"),
n ? i.insertBefore(t, n) : i.appendChild(t);
var r = this.getChild("closeButton");
r && i.appendChild(r.el_)
}
,
i.empty = function() {
this.trigger("beforemodalempty"),
_i(this.contentEl()),
this.trigger("modalempty")
}
,
i.content = function(e) {
return "undefined" != typeof e && (this.content_ = e),
this.content_
}
,
i.conditionalFocus_ = function() {
var e = hr["default"].activeElement
, t = this.player_.el_;
this.previouslyActiveEl_ = null,
(t.contains(e) || t === e) && (this.previouslyActiveEl_ = e,
this.focus())
}
,
i.conditionalBlur_ = function() {
this.previouslyActiveEl_ && (this.previouslyActiveEl_.focus(),
this.previouslyActiveEl_ = null)
}
,
i.handleKeyDown = function(e) {
if (e.stopPropagation(),
yr.isEventKey(e, "Escape") && this.closeable())
return e.preventDefault(),
void this.close();
if (yr.isEventKey(e, "Tab")) {
for (var t, i = this.focusableEls_(), n = this.el_.querySelector(":focus"), r = 0; r < i.length; r++)
if (n === i[r]) {
t = r;
break
}
hr["default"].activeElement === this.el_ && (t = 0),
e.shiftKey && 0 === t ? (i[i.length - 1].focus(),
e.preventDefault()) : e.shiftKey || t !== i.length - 1 || (i[0].focus(),
e.preventDefault())
}
}
,
i.focusableEls_ = function() {
var e = this.el_.querySelectorAll("*");
return Array.prototype.filter.call(e, function(e) {
return (e instanceof dr["default"].HTMLAnchorElement || e instanceof dr["default"].HTMLAreaElement) && e.hasAttribute("href") || (e instanceof dr["default"].HTMLInputElement || e instanceof dr["default"].HTMLSelectElement || e instanceof dr["default"].HTMLTextAreaElement || e instanceof dr["default"].HTMLButtonElement) && !e.hasAttribute("disabled") || e instanceof dr["default"].HTMLIFrameElement || e instanceof dr["default"].HTMLObjectElement || e instanceof dr["default"].HTMLEmbedElement || e.hasAttribute("tabindex") && -1 !== e.getAttribute("tabindex") || e.hasAttribute("contenteditable")
})
}
,
t
}(Ol);
fc.prototype.options_ = {
pauseOnOpen: !0,
temporary: !0
},
Ol.registerComponent("ModalDialog", fc);
var pc = function(e) {
function t(t) {
var i;
void 0 === t && (t = []),
i = e.call(this) || this,
i.tracks_ = [],
Object.defineProperty(mr(i), "length", {
get: function() {
return this.tracks_.length
}
});
for (var n = 0; n < t.length; n++)
i.addTrack(t[n]);
return i
}
gr(t, e);
var i = t.prototype;
return i.addTrack = function(e) {
var t = this.tracks_.length;
"" + t in this || Object.defineProperty(this, t, {
get: function() {
return this.tracks_[t]
}
}),
-1 === this.tracks_.indexOf(e) && (this.tracks_.push(e),
this.trigger({
track: e,
type: "addtrack",
target: this
}))
}
,
i.removeTrack = function(e) {
for (var t, i = 0, n = this.length; n > i; i++)
if (this[i] === e) {
t = this[i],
t.off && t.off(),
this.tracks_.splice(i, 1);
break
}
t && this.trigger({
track: t,
type: "removetrack",
target: this
})
}
,
i.getTrackById = function(e) {
for (var t = null, i = 0, n = this.length; n > i; i++) {
var r = this[i];
if (r.id === e) {
t = r;
break
}
}
return t
}
,
t
}(pl);
pc.prototype.allowedEvents_ = {
change: "change",
addtrack: "addtrack",
removetrack: "removetrack"
};
for (var mc in pc.prototype.allowedEvents_)
pc.prototype["on" + mc] = null;
var gc = function(e, t) {
for (var i = 0; i < e.length; i++)
Object.keys(e[i]).length && t.id !== e[i].id && (e[i].enabled = !1)
}
, vc = function(e) {
function t(t) {
var i;
void 0 === t && (t = []);
for (var n = t.length - 1; n >= 0; n--)
if (t[n].enabled) {
gc(t, t[n]);
break
}
return i = e.call(this, t) || this,
i.changing_ = !1,
i
}
gr(t, e);
var i = t.prototype;
return i.addTrack = function(t) {
var i = this;
t.enabled && gc(this, t),
e.prototype.addTrack.call(this, t),
t.addEventListener && (t.enabledChange_ = function() {
i.changing_ || (i.changing_ = !0,
gc(i, t),
i.changing_ = !1,
i.trigger("change"))
}
,
t.addEventListener("enabledchange", t.enabledChange_))
}
,
i.removeTrack = function(t) {
e.prototype.removeTrack.call(this, t),
t.removeEventListener && t.enabledChange_ && (t.removeEventListener("enabledchange", t.enabledChange_),
t.enabledChange_ = null)
}
,
t
}(pc)
, yc = function(e, t) {
for (var i = 0; i < e.length; i++)
Object.keys(e[i]).length && t.id !== e[i].id && (e[i].selected = !1)
}
, _c = function(e) {
function t(t) {
var i;
void 0 === t && (t = []);
for (var n = t.length - 1; n >= 0; n--)
if (t[n].selected) {
yc(t, t[n]);
break
}
return i = e.call(this, t) || this,
i.changing_ = !1,
Object.defineProperty(mr(i), "selectedIndex", {
get: function() {
for (var e = 0; e < this.length; e++)
if (this[e].selected)
return e;
return -1
},
set: function() {}
}),
i
}
gr(t, e);
var i = t.prototype;
return i.addTrack = function(t) {
var i = this;
t.selected && yc(this, t),
e.prototype.addTrack.call(this, t),
t.addEventListener && (t.selectedChange_ = function() {
i.changing_ || (i.changing_ = !0,
yc(i, t),
i.changing_ = !1,
i.trigger("change"))
}
,
t.addEventListener("selectedchange", t.selectedChange_))
}
,
i.removeTrack = function(t) {
e.prototype.removeTrack.call(this, t),
t.removeEventListener && t.selectedChange_ && (t.removeEventListener("selectedchange", t.selectedChange_),
t.selectedChange_ = null)
}
,
t
}(pc)
, bc = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.addTrack = function(t) {
var i = this;
e.prototype.addTrack.call(this, t),
this.queueChange_ || (this.queueChange_ = function() {
return i.queueTrigger("change")
}
),
this.triggerSelectedlanguagechange || (this.triggerSelectedlanguagechange_ = function() {
return i.trigger("selectedlanguagechange")
}
),
t.addEventListener("modechange", this.queueChange_);
var n = ["metadata", "chapters"];
-1 === n.indexOf(t.kind) && t.addEventListener("modechange", this.triggerSelectedlanguagechange_)
}
,
i.removeTrack = function(t) {
e.prototype.removeTrack.call(this, t),
t.removeEventListener && (this.queueChange_ && t.removeEventListener("modechange", this.queueChange_),
this.selectedlanguagechange_ && t.removeEventListener("modechange", this.triggerSelectedlanguagechange_))
}
,
t
}(pc)
, Tc = function() {
function e(e) {
void 0 === e && (e = []),
this.trackElements_ = [],
Object.defineProperty(this, "length", {
get: function() {
return this.trackElements_.length
}
});
for (var t = 0, i = e.length; i > t; t++)
this.addTrackElement_(e[t])
}
var t = e.prototype;
return t.addTrackElement_ = function(e) {
var t = this.trackElements_.length;
"" + t in this || Object.defineProperty(this, t, {
get: function() {
return this.trackElements_[t]
}
}),
-1 === this.trackElements_.indexOf(e) && this.trackElements_.push(e)
}
,
t.getTrackElementByTrack_ = function(e) {
for (var t, i = 0, n = this.trackElements_.length; n > i; i++)
if (e === this.trackElements_[i].track) {
t = this.trackElements_[i];
break
}
return t
}
,
t.removeTrackElement_ = function(e) {
for (var t = 0, i = this.trackElements_.length; i > t; t++)
if (e === this.trackElements_[t]) {
this.trackElements_[t].track && "function" == typeof this.trackElements_[t].track.off && this.trackElements_[t].track.off(),
"function" == typeof this.trackElements_[t].off && this.trackElements_[t].off(),
this.trackElements_.splice(t, 1);
break
}
}
,
e
}()
, Sc = 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(e) {
var t = this.length || 0
, i = 0
, n = e.length;
this.cues_ = e,
this.length_ = e.length;
var r = function(e) {
"" + e in this || Object.defineProperty(this, "" + e, {
get: function() {
return this.cues_[e]
}
})
};
if (n > t)
for (i = t; n > i; i++)
r.call(this, i)
}
,
t.getCueById = function(e) {
for (var t = null, i = 0, n = this.length; n > i; i++) {
var r = this[i];
if (r.id === e) {
t = r;
break
}
}
return t
}
,
e
}()
, Cc = {
alternative: "alternative",
captions: "captions",
main: "main",
sign: "sign",
subtitles: "subtitles",
commentary: "commentary"
}
, Ec = {
alternative: "alternative",
descriptions: "descriptions",
main: "main",
"main-desc": "main-desc",
translation: "translation",
commentary: "commentary"
}
, kc = {
subtitles: "subtitles",
captions: "captions",
descriptions: "descriptions",
chapters: "chapters",
metadata: "metadata"
}
, wc = {
disabled: "disabled",
hidden: "hidden",
showing: "showing"
}
, Ic = function(e) {
function t(t) {
var i;
void 0 === t && (t = {}),
i = e.call(this) || this;
var n = {
id: t.id || "vjs_track_" + wi(),
kind: t.kind || "",
label: t.label || "",
language: t.language || ""
}
, r = function(e) {
Object.defineProperty(mr(i), e, {
get: function() {
return n[e]
},
set: function() {}
})
};
for (var a in n)
r(a);
return i
}
return gr(t, e),
t
}(pl)
, Ac = function(e) {
var t = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"]
, i = hr["default"].createElement("a");
i.href = e;
var n, r = "" === i.host && "file:" !== i.protocol;
r && (n = hr["default"].createElement("div"),
n.innerHTML = '<a href="' + e + '"></a>',
i = n.firstChild,
n.setAttribute("style", "display:none; position:absolute;"),
hr["default"].body.appendChild(n));
for (var a = {}, s = 0; s < t.length; s++)
a[t[s]] = i[t[s]];
return "http:" === a.protocol && (a.host = a.host.replace(/:80$/, "")),
"https:" === a.protocol && (a.host = a.host.replace(/:443$/, "")),
a.protocol || (a.protocol = dr["default"].location.protocol),
r && hr["default"].body.removeChild(n),
a
}
, xc = function(e) {
if (!e.match(/^https?:\/\//)) {
var t = hr["default"].createElement("div");
t.innerHTML = '<a href="' + e + '">x</a>',
e = t.firstChild.href
}
return e
}
, Pc = function(e) {
if ("string" == typeof e) {
var t = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/
, i = t.exec(e);
if (i)
return i.pop().toLowerCase()
}
return ""
}
, Lc = function(e, t) {
void 0 === t && (t = dr["default"].location);
var i = Ac(e)
, n = ":" === i.protocol ? t.protocol : i.protocol
, r = n + i.host !== t.protocol + t.host;
return r
}
, Dc = Object.freeze({
__proto__: null,
parseUrl: Ac,
getAbsoluteURL: xc,
getFileExtension: Pc,
isCrossOrigin: Lc
})
, Oc = function(e, t) {
var i = new dr["default"].WebVTT.Parser(dr["default"],dr["default"].vttjs,dr["default"].WebVTT.StringDecoder())
, n = [];
i.oncue = function(e) {
t.addCue(e)
}
,
i.onparsingerror = function(e) {
n.push(e)
}
,
i.onflush = function() {
t.trigger({
type: "loadeddata",
target: t
})
}
,
i.parse(e),
n.length > 0 && (dr["default"].console && dr["default"].console.groupCollapsed && dr["default"].console.groupCollapsed("Text Track parsing errors for " + t.src),
n.forEach(function(e) {
return zu.error(e)
}),
dr["default"].console && dr["default"].console.groupEnd && dr["default"].console.groupEnd()),
i.flush()
}
, Nc = function(e, t) {
var i = {
uri: e
}
, n = Lc(e);
n && (i.cors = n);
var r = "use-credentials" === t.tech_.crossOrigin();
r && (i.withCredentials = r),
Sr(i, dl(this, function(e, i, n) {
return e ? zu.error(e, i) : (t.loaded_ = !0,
void ("function" != typeof dr["default"].WebVTT ? t.tech_ && t.tech_.any(["vttjsloaded", "vttjserror"], function(e) {
return "vttjserror" === e.type ? void zu.error("vttjs failed to load, stopping trying to process " + t.src) : Oc(n, t)
}) : Oc(n, t)))
}))
}
, Mc = function(e) {
function t(t) {
var i;
if (void 0 === t && (t = {}),
!t.tech)
throw new Error("A tech was not provided.");
var n = Ui(t, {
kind: kc[t.kind] || "subtitles",
language: t.language || t.srclang || ""
})
, r = wc[n.mode] || "disabled"
, a = n["default"];
("metadata" === n.kind || "chapters" === n.kind) && (r = "hidden"),
i = e.call(this, n) || this,
i.tech_ = n.tech,
i.cues_ = [],
i.activeCues_ = [],
i.preload_ = i.tech_.preloadTextTracks !== !1;
var s = new Sc(i.cues_)
, o = new Sc(i.activeCues_)
, u = !1
, l = dl(mr(i), function() {
this.activeCues = this.activeCues,
u && (this.trigger("cuechange"),
u = !1)
});
return "disabled" !== r && i.tech_.ready(function() {
i.tech_.on("timeupdate", l)
}, !0),
Object.defineProperties(mr(i), {
"default": {
get: function() {
return a
},
set: function() {}
},
mode: {
get: function() {
return r
},
set: function(e) {
var t = this;
wc[e] && (r = e,
this.preload_ || "disabled" === r || 0 !== this.cues.length || Nc(this.src, this),
"disabled" !== r ? this.tech_.ready(function() {
t.tech_.on("timeupdate", l)
}, !0) : this.tech_.off("timeupdate", l),
this.trigger("modechange"))
}
},
cues: {
get: function() {
return this.loaded_ ? s : null
},
set: function() {}
},
activeCues: {
get: function() {
if (!this.loaded_)
return null;
if (0 === this.cues.length)
return o;
for (var e = this.tech_.currentTime(), t = [], i = 0, n = this.cues.length; n > i; i++) {
var r = this.cues[i];
r.startTime <= e && r.endTime >= e ? t.push(r) : r.startTime === r.endTime && r.startTime <= e && r.startTime + .5 >= e && t.push(r)
}
if (u = !1,
t.length !== this.activeCues_.length)
u = !0;
else
for (var a = 0; a < t.length; a++)
-1 === this.activeCues_.indexOf(t[a]) && (u = !0);
return this.activeCues_ = t,
o.setCues_(this.activeCues_),
o
},
set: function() {}
}
}),
n.src ? (i.src = n.src,
i.preload_ || (i.loaded_ = !0),
(i.preload_ || a || "subtitles" !== n.kind && "captions" !== n.kind) && Nc(i.src, mr(i))) : i.loaded_ = !0,
i
}
gr(t, e);
var i = t.prototype;
return i.addCue = function(e) {
var t = e;
if (dr["default"].vttjs && !(e instanceof dr["default"].vttjs.VTTCue)) {
t = new dr["default"].vttjs.VTTCue(e.startTime,e.endTime,e.text);
for (var i in e)
i in t || (t[i] = e[i]);
t.id = e.id,
t.originalCue_ = e
}
for (var n = this.tech_.textTracks(), r = 0; r < n.length; r++)
n[r] !== this && n[r].removeCue(t);
this.cues_.push(t),
this.cues.setCues_(this.cues_)
}
,
i.removeCue = function(e) {
for (var t = this.cues_.length; t--; ) {
var i = this.cues_[t];
if (i === e || i.originalCue_ && i.originalCue_ === e) {
this.cues_.splice(t, 1),
this.cues.setCues_(this.cues_);
break
}
}
}
,
t
}(Ic);
Mc.prototype.allowedEvents_ = {
cuechange: "cuechange"
};
var Rc = function(e) {
function t(t) {
var i;
void 0 === t && (t = {});
var n = Ui(t, {
kind: Ec[t.kind] || ""
});
i = e.call(this, n) || this;
var r = !1;
return Object.defineProperty(mr(i), "enabled", {
get: function() {
return r
},
set: function(e) {
"boolean" == typeof e && e !== r && (r = e,
this.trigger("enabledchange"))
}
}),
n.enabled && (i.enabled = n.enabled),
i.loaded_ = !0,
i
}
return gr(t, e),
t
}(Ic)
, Uc = function(e) {
function t(t) {
var i;
void 0 === t && (t = {});
var n = Ui(t, {
kind: Cc[t.kind] || ""
});
i = e.call(this, n) || this;
var r = !1;
return Object.defineProperty(mr(i), "selected", {
get: function() {
return r
},
set: function(e) {
"boolean" == typeof e && e !== r && (r = e,
this.trigger("selectedchange"))
}
}),
n.selected && (i.selected = n.selected),
i
}
return gr(t, e),
t
}(Ic)
, Fc = 0
, Bc = 1
, jc = 2
, Vc = 3
, qc = function(e) {
function t(t) {
var i;
void 0 === t && (t = {}),
i = e.call(this) || this;
var n, r = new Mc(t);
return i.kind = r.kind,
i.src = r.src,
i.srclang = r.language,
i.label = r.label,
i["default"] = r["default"],
Object.defineProperties(mr(i), {
readyState: {
get: function() {
return n
}
},
track: {
get: function() {
return r
}
}
}),
n = Fc,
r.addEventListener("loadeddata", function() {
n = jc,
i.trigger({
type: "load",
target: mr(i)
})
}),
i
}
return gr(t, e),
t
}(pl);
qc.prototype.allowedEvents_ = {
load: "load"
},
qc.NONE = Fc,
qc.LOADING = Bc,
qc.LOADED = jc,
qc.ERROR = Vc;
var Hc = {
audio: {
ListClass: vc,
TrackClass: Rc,
capitalName: "Audio"
},
video: {
ListClass: _c,
TrackClass: Uc,
capitalName: "Video"
},
text: {
ListClass: bc,
TrackClass: Mc,
capitalName: "Text"
}
};
Object.keys(Hc).forEach(function(e) {
Hc[e].getterName = e + "Tracks",
Hc[e].privateName = e + "Tracks_"
});
var Wc = {
remoteText: {
ListClass: bc,
TrackClass: Mc,
capitalName: "RemoteText",
getterName: "remoteTextTracks",
privateName: "remoteTextTracks_"
},
remoteTextEl: {
ListClass: Tc,
TrackClass: qc,
capitalName: "RemoteTextTrackEls",
getterName: "remoteTextTrackEls",
privateName: "remoteTextTrackEls_"
}
}
, zc = fr({}, Hc, Wc);
Wc.names = Object.keys(Wc),
Hc.names = Object.keys(Hc),
zc.names = [].concat(Wc.names).concat(Hc.names);
var Gc = function(e) {
function t(t, i) {
var n;
return void 0 === t && (t = {}),
void 0 === i && (i = function() {}
),
t.reportTouchActivity = !1,
n = e.call(this, null, t, i) || this,
n.hasStarted_ = !1,
n.on("playing", function() {
this.hasStarted_ = !0
}),
n.on("loadstart", function() {
this.hasStarted_ = !1
}),
zc.names.forEach(function(e) {
var i = zc[e];
t && t[i.getterName] && (n[i.privateName] = t[i.getterName])
}),
n.featuresProgressEvents || n.manualProgressOn(),
n.featuresTimeupdateEvents || n.manualTimeUpdatesOn(),
["Text", "Audio", "Video"].forEach(function(e) {
t["native" + e + "Tracks"] === !1 && (n["featuresNative" + e + "Tracks"] = !1)
}),
t.nativeCaptions === !1 || t.nativeTextTracks === !1 ? n.featuresNativeTextTracks = !1 : (t.nativeCaptions === !0 || t.nativeTextTracks === !0) && (n.featuresNativeTextTracks = !0),
n.featuresNativeTextTracks || n.emulateTextTracks(),
n.preloadTextTracks = t.preloadTextTracks !== !1,
n.autoRemoteTextTracks_ = new zc.text.ListClass,
n.initTrackListeners(),
t.nativeControlsForTouch || n.emitTapEvents(),
n.constructor && (n.name_ = n.constructor.name || "Unknown Tech"),
n
}
gr(t, e);
var i = t.prototype;
return i.triggerSourceset = function(e) {
var t = this;
this.isReady_ || this.one("ready", function() {
return t.setTimeout(function() {
return t.triggerSourceset(e)
}, 1)
}),
this.trigger({
src: e,
type: "sourceset"
})
}
,
i.manualProgressOn = function() {
this.on("durationchange", this.onDurationChange),
this.manualProgress = !0,
this.one("ready", this.trackProgress)
}
,
i.manualProgressOff = function() {
this.manualProgress = !1,
this.stopTrackingProgress(),
this.off("durationchange", this.onDurationChange)
}
,
i.trackProgress = function() {
this.stopTrackingProgress(),
this.progressInterval = this.setInterval(dl(this, function() {
var e = this.bufferedPercent();
this.bufferedPercent_ !== e && this.trigger("progress"),
this.bufferedPercent_ = e,
1 === e && this.stopTrackingProgress()
}), 500)
}
,
i.onDurationChange = function() {
this.duration_ = this.duration()
}
,
i.buffered = function() {
return Vi(0, 0)
}
,
i.bufferedPercent = function() {
return qi(this.buffered(), this.duration_)
}
,
i.stopTrackingProgress = function() {
this.clearInterval(this.progressInterval)
}
,
i.manualTimeUpdatesOn = function() {
this.manualTimeUpdates = !0,
this.on("play", this.trackCurrentTime),
this.on("pause", this.stopTrackingCurrentTime)
}
,
i.manualTimeUpdatesOff = function() {
this.manualTimeUpdates = !1,
this.stopTrackingCurrentTime(),
this.off("play", this.trackCurrentTime),
this.off("pause", this.stopTrackingCurrentTime)
}
,
i.trackCurrentTime = function() {
this.currentTimeInterval && this.stopTrackingCurrentTime(),
this.currentTimeInterval = this.setInterval(function() {
this.trigger({
type: "timeupdate",
target: this,
manuallyTriggered: !0
})
}, 250)
}
,
i.stopTrackingCurrentTime = function() {
this.clearInterval(this.currentTimeInterval),
this.trigger({
type: "timeupdate",
target: this,
manuallyTriggered: !0
})
}
,
i.dispose = function() {
this.clearTracks(Hc.names),
this.manualProgress && this.manualProgressOff(),
this.manualTimeUpdates && this.manualTimeUpdatesOff(),
e.prototype.dispose.call(this)
}
,
i.clearTracks = function(e) {
var t = this;
e = [].concat(e),
e.forEach(function(e) {
for (var i = t[e + "Tracks"]() || [], n = i.length; n--; ) {
var r = i[n];
"text" === e && t.removeRemoteTextTrack(r),
i.removeTrack(r)
}
})
}
,
i.cleanupAutoTextTracks = function() {
for (var e = this.autoRemoteTextTracks_ || [], t = e.length; t--; ) {
var i = e[t];
this.removeRemoteTextTrack(i)
}
}
,
i.reset = function() {}
,
i.crossOrigin = function() {}
,
i.setCrossOrigin = function() {}
,
i.error = function(e) {
return void 0 !== e && (this.error_ = new Hi(e),
this.trigger("error")),
this.error_
}
,
i.played = function() {
return this.hasStarted_ ? Vi(0, 0) : Vi()
}
,
i.setScrubbing = function() {}
,
i.setCurrentTime = function() {
this.manualTimeUpdates && this.trigger({
type: "timeupdate",
target: this,
manuallyTriggered: !0
})
}
,
i.initTrackListeners = function() {
var e = this;
Hc.names.forEach(function(t) {
var i = Hc[t]
, n = function() {
e.trigger(t + "trackchange")
}
, r = e[i.getterName]();
r.addEventListener("removetrack", n),
r.addEventListener("addtrack", n),
e.on("dispose", function() {
r.removeEventListener("removetrack", n),
r.removeEventListener("addtrack", n)
})
})
}
,
i.addWebVttScript_ = function() {
var e = this;
if (!dr["default"].WebVTT)
if (hr["default"].body.contains(this.el())) {
if (!this.options_["vtt.js"] && Gt(Vr) && Object.keys(Vr).length > 0)
return void this.trigger("vttjsloaded");
var t = hr["default"].createElement("script");
t.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",
t.onload = function() {
e.trigger("vttjsloaded")
}
,
t.onerror = function() {
e.trigger("vttjserror")
}
,
this.on("dispose", function() {
t.onload = null,
t.onerror = null
}),
dr["default"].WebVTT = !0,
this.el().parentNode.appendChild(t)
} else
this.ready(this.addWebVttScript_)
}
,
i.emulateTextTracks = function() {
var e = this
, t = this.textTracks()
, i = this.remoteTextTracks()
, n = function(e) {
return t.addTrack(e.track)
}
, r = function(e) {
return t.removeTrack(e.track)
};
i.on("addtrack", n),
i.on("removetrack", r),
this.addWebVttScript_();
var a = function() {
return e.trigger("texttrackchange")
}
, s = function() {
a();
for (var e = 0; e < t.length; e++) {
var i = t[e];
i.removeEventListener("cuechange", a),
"showing" === i.mode && i.addEventListener("cuechange", a)
}
};
s(),
t.addEventListener("change", s),
t.addEventListener("addtrack", s),
t.addEventListener("removetrack", s),
this.on("dispose", function() {
i.off("addtrack", n),
i.off("removetrack", r),
t.removeEventListener("change", s),
t.removeEventListener("addtrack", s),
t.removeEventListener("removetrack", s);
for (var e = 0; e < t.length; e++) {
var o = t[e];
o.removeEventListener("cuechange", a)
}
})
}
,
i.addTextTrack = function(e, t, i) {
if (!e)
throw new Error("TextTrack kind is required but was not provided");
return Gi(this, e, t, i)
}
,
i.createRemoteTextTrack = function(e) {
var t = Ui(e, {
tech: this
});
return new Wc.remoteTextEl.TrackClass(t)
}
,
i.addRemoteTextTrack = function(e, t) {
var i = this;
void 0 === e && (e = {});
var n = this.createRemoteTextTrack(e);
return t !== !0 && t !== !1 && (zu.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),
t = !0),
this.remoteTextTrackEls().addTrackElement_(n),
this.remoteTextTracks().addTrack(n.track),
t !== !0 && this.ready(function() {
return i.autoRemoteTextTracks_.addTrack(n.track)
}),
n
}
,
i.removeRemoteTextTrack = function(e) {
var t = this.remoteTextTrackEls().getTrackElementByTrack_(e);
this.remoteTextTrackEls().removeTrackElement_(t),
this.remoteTextTracks().removeTrack(e),
this.autoRemoteTextTracks_.removeTrack(e)
}
,
i.getVideoPlaybackQuality = function() {
return {}
}
,
i.requestPictureInPicture = function() {
var e = this.options_.Promise || dr["default"].Promise;
return e ? e.reject() : void 0
}
,
i.disablePictureInPicture = function() {
return !0
}
,
i.setDisablePictureInPicture = function() {}
,
i.setPoster = function() {}
,
i.playsinline = function() {}
,
i.setPlaysinline = function() {}
,
i.overrideNativeAudioTracks = function() {}
,
i.overrideNativeVideoTracks = function() {}
,
i.canPlayType = function() {
return ""
}
,
t.canPlayType = function() {
return ""
}
,
t.canPlaySource = function(e) {
return t.canPlayType(e.type)
}
,
t.isTech = function(e) {
return e.prototype instanceof t || e instanceof t || e === t
}
,
t.registerTech = function(e, i) {
if (t.techs_ || (t.techs_ = {}),
!t.isTech(i))
throw new Error("Tech " + e + " must be a Tech");
if (!t.canPlayType)
throw new Error("Techs must have a static canPlayType method on them");
if (!t.canPlaySource)
throw new Error("Techs must have a static canPlaySource method on them");
return e = Il(e),
t.techs_[e] = i,
t.techs_[wl(e)] = i,
"Tech" !== e && t.defaultTechOrder_.push(e),
i
}
,
t.getTech = function(e) {
return e ? t.techs_ && t.techs_[e] ? t.techs_[e] : (e = Il(e),
dr["default"] && dr["default"].videojs && dr["default"].videojs[e] ? (zu.warn("The " + e + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),
dr["default"].videojs[e]) : void 0) : void 0
}
,
t
}(Ol);
zc.names.forEach(function(e) {
var t = zc[e];
Gc.prototype[t.getterName] = function() {
return this[t.privateName] = this[t.privateName] || new t.ListClass,
this[t.privateName]
}
}),
Gc.prototype.featuresVolumeControl = !0,
Gc.prototype.featuresMuteControl = !0,
Gc.prototype.featuresFullscreenResize = !1,
Gc.prototype.featuresPlaybackRate = !1,
Gc.prototype.featuresProgressEvents = !1,
Gc.prototype.featuresSourceset = !1,
Gc.prototype.featuresTimeupdateEvents = !1,
Gc.prototype.featuresNativeTextTracks = !1,
Gc.withSourceHandlers = function(e) {
e.registerSourceHandler = function(t, i) {
var n = e.sourceHandlers;
n || (n = e.sourceHandlers = []),
void 0 === i && (i = n.length),
n.splice(i, 0, t)
}
,
e.canPlayType = function(t) {
for (var i, n = e.sourceHandlers || [], r = 0; r < n.length; r++)
if (i = n[r].canPlayType(t))
return i;
return ""
}
,
e.selectSourceHandler = function(t, i) {
for (var n, r = e.sourceHandlers || [], a = 0; a < r.length; a++)
if (n = r[a].canHandleSource(t, i))
return r[a];
return null
}
,
e.canPlaySource = function(t, i) {
var n = e.selectSourceHandler(t, i);
return n ? n.canHandleSource(t, i) : ""
}
;
var t = ["seekable", "seeking", "duration"];
t.forEach(function(e) {
var t = this[e];
"function" == typeof t && (this[e] = function() {
return this.sourceHandler_ && this.sourceHandler_[e] ? this.sourceHandler_[e].apply(this.sourceHandler_, arguments) : t.apply(this, arguments)
}
)
}, e.prototype),
e.prototype.setSource = function(t) {
var i = e.selectSourceHandler(t, this.options_);
i || (e.nativeSourceHandler ? i = e.nativeSourceHandler : zu.error("No source handler found for the current source.")),
this.disposeSourceHandler(),
this.off("dispose", this.disposeSourceHandler),
i !== e.nativeSourceHandler && (this.currentSource_ = t),
this.sourceHandler_ = i.handleSource(t, this, this.options_),
this.one("dispose", this.disposeSourceHandler)
}
,
e.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)
}
}
,
Ol.registerComponent("Tech", Gc),
Gc.registerTech("Tech", Gc),
Gc.defaultTechOrder_ = [];
var Xc = {}
, Kc = {}
, Yc = {}
, $c = {
buffered: 1,
currentTime: 1,
duration: 1,
muted: 1,
played: 1,
paused: 1,
seekable: 1,
volume: 1
}
, Qc = {
setCurrentTime: 1,
setMuted: 1,
setVolume: 1
}
, Jc = {
play: 1,
pause: 1
}
, Zc = {
opus: "video/ogg",
ogv: "video/ogg",
mp4: "video/mp4",
mov: "video/mp4",
m4v: "video/mp4",
mkv: "video/x-matroska",
m4a: "audio/mp4",
mp3: "audio/mpeg",
aac: "audio/aac",
caf: "audio/x-caf",
flac: "audio/flac",
oga: "audio/ogg",
wav: "audio/wav",
m3u8: "application/x-mpegURL",
jpg: "image/jpeg",
jpeg: "image/jpeg",
gif: "image/gif",
png: "image/png",
svg: "image/svg+xml",
webp: "image/webp"
}
, ed = function(e) {
void 0 === e && (e = "");
var t = Pc(e)
, i = Zc[t.toLowerCase()];
return i || ""
}
, td = function(e, t) {
if (!t)
return "";
if (e.cache_.source.src === t && e.cache_.source.type)
return e.cache_.source.type;
var i = e.cache_.sources.filter(function(e) {
return e.src === t
});
if (i.length)
return i[0].type;
for (var n = e.$$("source"), r = 0; r < n.length; r++) {
var a = n[r];
if (a.type && a.src && a.src === t)
return a.type
}
return ed(t)
}
, id = function Xy(e) {
if (Array.isArray(e)) {
var t = [];
e.forEach(function(e) {
e = Xy(e),
Array.isArray(e) ? t = t.concat(e) : zt(e) && t.push(e)
}),
e = t
} else
e = "string" == typeof e && e.trim() ? [an({
src: e
})] : zt(e) && "string" == typeof e.src && e.src && e.src.trim() ? [an(e)] : [];
return e
}
, nd = function(e) {
function t(t, i, n) {
var r, a = Ui({
createEl: !1
}, i);
if (r = e.call(this, t, a, n) || this,
i.playerOptions.sources && 0 !== i.playerOptions.sources.length)
t.src(i.playerOptions.sources);
else
for (var s = 0, o = i.playerOptions.techOrder; s < o.length; s++) {
var u = Il(o[s])
, l = Gc.getTech(u);
if (u || (l = Ol.getComponent(u)),
l && l.isSupported()) {
t.loadTech_(u);
break
}
}
return r
}
return gr(t, e),
t
}(Ol);
Ol.registerComponent("MediaLoader", nd);
var rd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.emitTapEvents(),
n.enable(),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function(t, i, n) {
void 0 === t && (t = "div"),
void 0 === i && (i = {}),
void 0 === n && (n = {}),
i = Wt({
innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>',
className: this.buildCSSClass(),
tabIndex: 0
}, i),
"button" === t && zu.error("Creating a ClickableComponent with an HTML element of " + t + " is not supported; use a Button instead."),
n = Wt({
role: "button"
}, n),
this.tabIndex_ = i.tabIndex;
var r = e.prototype.createEl.call(this, t, i, n);
return this.createControlTextEl(r),
r
}
,
i.dispose = function() {
this.controlTextEl_ = null,
e.prototype.dispose.call(this)
}
,
i.createControlTextEl = function(e) {
return this.controlTextEl_ = ti("span", {
className: "vjs-control-text"
}, {
"aria-live": "polite"
}),
e && e.appendChild(this.controlTextEl_),
this.controlText(this.controlText_, e),
this.controlTextEl_
}
,
i.controlText = function(e, t) {
if (void 0 === t && (t = this.el()),
void 0 === e)
return this.controlText_ || "Need Text";
var i = this.localize(e);
this.controlText_ = e,
ii(this.controlTextEl_, i),
this.nonIconControl || t.setAttribute("title", i)
}
,
i.buildCSSClass = function() {
return "vjs-control vjs-button " + e.prototype.buildCSSClass.call(this)
}
,
i.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("keydown", this.handleKeyDown))
}
,
i.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("mouseover", this.handleMouseOver),
this.off("mouseout", this.handleMouseOut),
this.off(["tap", "click"], this.handleClick),
this.off("keydown", this.handleKeyDown)
}
,
i.handleClick = function() {
this.options_.clickHandler && this.options_.clickHandler.call(this, arguments)
}
,
i.handleKeyDown = function(t) {
yr.isEventKey(t, "Space") || yr.isEventKey(t, "Enter") ? (t.preventDefault(),
t.stopPropagation(),
this.trigger("click")) : e.prototype.handleKeyDown.call(this, t)
}
,
t
}(Ol);
Ol.registerComponent("ClickableComponent", rd);
var ad = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.update(),
t.on("posterchange", dl(mr(n), n.update)),
n
}
gr(t, e);
var i = t.prototype;
return i.dispose = function() {
this.player().off("posterchange", this.update),
e.prototype.dispose.call(this)
}
,
i.createEl = function() {
var e = ti("div", {
className: "vjs-poster",
tabIndex: -1
});
return e
}
,
i.update = function() {
var e = this.player().poster();
this.setSrc(e),
e ? this.show() : this.hide()
}
,
i.setSrc = function(e) {
var t = "";
e && (t = 'url("' + e + '")'),
this.el_.style.backgroundImage = t
}
,
i.handleClick = function() {
if (this.player_.controls()) {
var e = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
!this.player_.tech(!0) || (Xl || Wl) && e || this.player_.tech(!0).focus(),
this.player_.paused() ? zi(this.player_.play()) : this.player_.pause()
}
}
,
t
}(rd);
Ol.registerComponent("PosterImage", ad);
var sd = "#222"
, od = "#ccc"
, ud = {
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'
}
, ld = function(e) {
function t(t, i, n) {
var r;
r = e.call(this, t, i, n) || this;
var a = dl(mr(r), r.updateDisplay);
return t.on("loadstart", dl(mr(r), r.toggleDisplay)),
t.on("texttrackchange", a),
t.on("loadedmetadata", dl(mr(r), r.preselectTrack)),
t.ready(dl(mr(r), function() {
if (t.tech_ && t.tech_.featuresNativeTextTracks)
return void this.hide();
t.on("fullscreenchange", a),
t.on("playerresize", a),
dr["default"].addEventListener("orientationchange", a),
t.on("dispose", function() {
return dr["default"].removeEventListener("orientationchange", a)
});
for (var e = this.options_.playerOptions.tracks || [], i = 0; i < e.length; i++)
this.player_.addRemoteTextTrack(e[i], !0);
this.preselectTrack()
})),
r
}
gr(t, e);
var i = t.prototype;
return i.preselectTrack = function() {
for (var e, t, 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 && a.language === o.language && o.kind in n ? o.kind === a.kind ? i = o : i || (i = o) : a && !a.enabled ? (i = null,
e = null,
t = null) : o["default"] && ("descriptions" !== o.kind || e ? o.kind in n && !t && (t = o) : e = o)
}
i ? i.mode = "showing" : t ? t.mode = "showing" : e && (e.mode = "showing")
}
,
i.toggleDisplay = function() {
this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks ? this.hide() : this.show()
}
,
i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-text-track-display"
}, {
"aria-live": "off",
"aria-atomic": "true"
})
}
,
i.clearDisplay = function() {
"function" == typeof dr["default"].WebVTT && dr["default"].WebVTT.processCues(dr["default"], [], this.el_)
}
,
i.updateDisplay = function() {
var e = this.player_.textTracks()
, t = this.options_.allowMultipleShowingTracks;
if (this.clearDisplay(),
t) {
for (var i = [], n = 0; n < e.length; ++n) {
var r = e[n];
"showing" === r.mode && i.push(r)
}
return void this.updateForTrack(i)
}
for (var a = null, s = null, o = e.length; o--; ) {
var u = e[o];
"showing" === u.mode && ("descriptions" === u.kind ? a = u : s = u)
}
s ? ("off" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "off"),
this.updateForTrack(s)) : a && ("assertive" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "assertive"),
this.updateForTrack(a))
}
,
i.updateDisplayState = function(e) {
for (var t = this.player_.textTrackSettings.getValues(), i = e.activeCues, n = i.length; n--; ) {
var r = i[n];
if (r) {
var a = r.displayState;
if (t.color && (a.firstChild.style.color = t.color),
t.textOpacity && on(a.firstChild, "color", sn(t.color || "#fff", t.textOpacity)),
t.backgroundColor && (a.firstChild.style.backgroundColor = t.backgroundColor),
t.backgroundOpacity && on(a.firstChild, "backgroundColor", sn(t.backgroundColor || "#000", t.backgroundOpacity)),
t.windowColor && (t.windowOpacity ? on(a, "backgroundColor", sn(t.windowColor, t.windowOpacity)) : a.style.backgroundColor = t.windowColor),
t.edgeStyle && ("dropshadow" === t.edgeStyle ? a.firstChild.style.textShadow = "2px 2px 3px " + sd + ", 2px 2px 4px " + sd + ", 2px 2px 5px " + sd : "raised" === t.edgeStyle ? a.firstChild.style.textShadow = "1px 1px " + sd + ", 2px 2px " + sd + ", 3px 3px " + sd : "depressed" === t.edgeStyle ? a.firstChild.style.textShadow = "1px 1px " + od + ", 0 1px " + od + ", -1px -1px " + sd + ", 0 -1px " + sd : "uniform" === t.edgeStyle && (a.firstChild.style.textShadow = "0 0 4px " + sd + ", 0 0 4px " + sd + ", 0 0 4px " + sd + ", 0 0 4px " + sd)),
t.fontPercent && 1 !== t.fontPercent) {
var s = dr["default"].parseFloat(a.style.fontSize);
a.style.fontSize = s * t.fontPercent + "px",
a.style.height = "auto",
a.style.top = "auto"
}
t.fontFamily && "default" !== t.fontFamily && ("small-caps" === t.fontFamily ? a.firstChild.style.fontVariant = "small-caps" : a.firstChild.style.fontFamily = ud[t.fontFamily])
}
}
}
,
i.updateForTrack = function(e) {
if (Array.isArray(e) || (e = [e]),
"function" == typeof dr["default"].WebVTT && !e.every(function(e) {
return !e.activeCues
})) {
for (var t = [], i = 0; i < e.length; ++i)
for (var n = e[i], r = 0; r < n.activeCues.length; ++r)
t.push(n.activeCues[r]);
dr["default"].WebVTT.processCues(dr["default"], t, this.el_);
for (var a = 0; a < e.length; ++a) {
for (var s = e[a], o = 0; o < s.activeCues.length; ++o) {
var u = s.activeCues[o].displayState;
ai(u, "vjs-text-track-cue"),
ai(u, "vjs-text-track-cue-" + (s.language ? s.language : a))
}
this.player_.textTrackSettings && this.updateDisplayState(s)
}
}
}
,
t
}(Ol);
Ol.registerComponent("TextTrackDisplay", ld);
var cd = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = this.player_.isAudio()
, i = this.localize(t ? "Audio Player" : "Video Player")
, n = ti("span", {
className: "vjs-control-text",
innerHTML: this.localize("{1} is loading.", [i])
})
, r = e.prototype.createEl.call(this, "div", {
className: "vjs-loading-spinner",
dir: "ltr"
});
return r.appendChild(n),
r
}
,
t
}(Ol);
Ol.registerComponent("LoadingSpinner", cd);
var dd = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.createEl = function(e, t, i) {
void 0 === t && (t = {}),
void 0 === i && (i = {}),
e = "button",
t = Wt({
innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>',
className: this.buildCSSClass()
}, t),
i = Wt({
type: "button"
}, i);
var n = Ol.prototype.createEl.call(this, e, t, i);
return this.createControlTextEl(n),
n
}
,
i.addChild = function(e, t) {
void 0 === t && (t = {});
var i = this.constructor.name;
return zu.warn("Adding an actionable (user controllable) child to a Button (" + i + ") is not supported; use a ClickableComponent instead."),
Ol.prototype.addChild.call(this, e, t)
}
,
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.handleKeyDown = function(t) {
return yr.isEventKey(t, "Space") || yr.isEventKey(t, "Enter") ? void t.stopPropagation() : void e.prototype.handleKeyDown.call(this, t)
}
,
t
}(rd);
Ol.registerComponent("Button", dd);
var hd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.mouseused_ = !1,
n.on("mousedown", n.handleMouseDown),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-big-play-button"
}
,
i.handleClick = function(e) {
var t = this.player_.play();
if (this.mouseused_ && e.clientX && e.clientY) {
var i = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
return zi(t),
void (!this.player_.tech(!0) || (Xl || Wl) && i || this.player_.tech(!0).focus())
}
var n = this.player_.getChild("controlBar")
, r = n && n.getChild("playToggle");
if (!r)
return void this.player_.tech(!0).focus();
var a = function() {
return r.focus()
};
Wi(t) ? t.then(a, function() {}) : this.setTimeout(a, 1)
}
,
i.handleKeyDown = function(t) {
this.mouseused_ = !1,
e.prototype.handleKeyDown.call(this, t)
}
,
i.handleMouseDown = function() {
this.mouseused_ = !0
}
,
t
}(dd);
hd.prototype.controlText_ = isVIP?"只是为了添加快捷键才替换的官方按钮":"播放速率,\n涛之雨独家解锁VIP\n非VIP服务器限速,因此最大速率为3倍,\n购买百度云会员解锁更高倍率(可以通过快捷键调整尝试改高)",
Ol.registerComponent("BigPlayButton", hd);
var fd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.controlText(i && i.controlText || n.localize("Close")),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-close-button " + e.prototype.buildCSSClass.call(this)
}
,
i.handleClick = function() {
this.trigger({
type: "close",
bubbles: !1
})
}
,
i.handleKeyDown = function(t) {
yr.isEventKey(t, "Esc") ? (t.preventDefault(),
t.stopPropagation(),
this.trigger("click")) : e.prototype.handleKeyDown.call(this, t)
}
,
t
}(dd);
Ol.registerComponent("CloseButton", fd);
var pd = function(e) {
function t(t, i) {
var n;
return void 0 === i && (i = {}),
n = e.call(this, t, i) || this,
i.replay = void 0 === i.replay || i.replay,
n.on(t, "play", n.handlePlay),
n.on(t, "pause", n.handlePause),
i.replay && n.on(t, "ended", n.handleEnded),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-play-control " + e.prototype.buildCSSClass.call(this)
}
,
i.handleClick = function() {
this.player_.paused() ? this.player_.play() : this.player_.pause()
}
,
i.handleSeeked = function(e) {
this.removeClass("vjs-ended"),
this.player_.paused() ? this.handlePause(e) : this.handlePlay(e)
}
,
i.handlePlay = function() {
this.removeClass("vjs-ended"),
this.removeClass("vjs-paused"),
this.addClass("vjs-playing"),
this.controlText("Pause")
}
,
i.handlePause = function() {
this.removeClass("vjs-playing"),
this.addClass("vjs-paused"),
this.controlText("Play")
}
,
i.handleEnded = function() {
this.removeClass("vjs-playing"),
this.addClass("vjs-ended"),
this.controlText("Replay"),
this.one(this.player_, "seeked", this.handleSeeked)
}
,
t
}(dd);
pd.prototype.controlText_ = "Play",
Ol.registerComponent("PlayToggle", pd);
var md = function(e, t) {
e = 0 > e ? 0 : e;
var i = Math.floor(e % 60)
, n = Math.floor(e / 60 % 60)
, r = Math.floor(e / 3600)
, a = Math.floor(t / 60 % 60)
, s = Math.floor(t / 3600);
return (isNaN(e) || 1 / 0 === e) && (r = n = i = "-"),
r = r > 0 || s > 0 ? r + ":" : "",
n = ((r || a >= 10) && 10 > n ? "0" + n : n) + ":",
i = 10 > i ? "0" + i : i,
r + n + i
}
, gd = md
, vd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on(t, ["timeupdate", "ended"], n.updateContent),
n.updateTextNode_(),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = this.buildCSSClass()
, i = e.prototype.createEl.call(this, "div", {
className: t + " vjs-time-control vjs-control",
innerHTML: '<span class="vjs-control-text" role="presentation">' + this.localize(this.labelText_) + " </span>"
});
return this.contentEl_ = ti("span", {
className: t + "-display"
}, {
"aria-live": "off",
role: "presentation"
}),
i.appendChild(this.contentEl_),
i
}
,
i.dispose = function() {
this.contentEl_ = null,
this.textNode_ = null,
e.prototype.dispose.call(this)
}
,
i.updateTextNode_ = function(e) {
var t = this;
void 0 === e && (e = 0),
e = cn(e),
this.formattedTime_ !== e && (this.formattedTime_ = e,
this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", function() {
if (t.contentEl_) {
var e = t.textNode_;
t.textNode_ = hr["default"].createTextNode(t.formattedTime_),
t.textNode_ && (e ? t.contentEl_.replaceChild(t.textNode_, e) : t.contentEl_.appendChild(t.textNode_))
}
}))
}
,
i.updateContent = function() {}
,
t
}(Ol);
vd.prototype.labelText_ = "Time",
vd.prototype.controlText_ = "Time",
Ol.registerComponent("TimeDisplay", vd);
var yd = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-current-time"
}
,
i.updateContent = function() {
var e;
e = this.player_.ended() ? this.player_.duration() : this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(),
this.updateTextNode_(e)
}
,
t
}(vd);
yd.prototype.labelText_ = "Current Time",
yd.prototype.controlText_ = "Current Time",
Ol.registerComponent("CurrentTimeDisplay", yd);
var _d = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on(t, "durationchange", n.updateContent),
n.on(t, "loadstart", n.updateContent),
n.on(t, "loadedmetadata", n.updateContent),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-duration"
}
,
i.updateContent = function() {
var e = this.player_.duration();
this.updateTextNode_(e)
}
,
t
}(vd);
_d.prototype.labelText_ = "Duration",
_d.prototype.controlText_ = "Duration",
Ol.registerComponent("DurationDisplay", _d);
var bd = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-time-control vjs-time-divider",
innerHTML: "<div><span>/</span></div>"
}, {
"aria-hidden": !0
})
}
,
t
}(Ol);
Ol.registerComponent("TimeDivider", bd);
var Td = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on(t, "durationchange", n.updateContent),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-remaining-time"
}
,
i.createEl = function() {
var t = e.prototype.createEl.call(this);
return t.insertBefore(ti("span", {}, {
"aria-hidden": !0
}, "-"), this.contentEl_),
t
}
,
i.updateContent = function() {
if ("number" == typeof this.player_.duration()) {
var e;
e = this.player_.ended() ? 0 : this.player_.remainingTimeDisplay ? this.player_.remainingTimeDisplay() : this.player_.remainingTime(),
this.updateTextNode_(e)
}
}
,
t
}(vd);
Td.prototype.labelText_ = "Remaining Time",
Td.prototype.controlText_ = "Remaining Time",
Ol.registerComponent("RemainingTimeDisplay", Td);
var Sd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.updateShowing(),
n.on(n.player(), "durationchange", n.updateShowing),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = e.prototype.createEl.call(this, "div", {
className: "vjs-live-control vjs-control"
});
return this.contentEl_ = ti("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
}
,
i.dispose = function() {
this.contentEl_ = null,
e.prototype.dispose.call(this)
}
,
i.updateShowing = function() {
1 / 0 === this.player().duration() ? this.show() : this.hide()
}
,
t
}(Ol);
Ol.registerComponent("LiveDisplay", Sd);
var Cd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.updateLiveEdgeStatus(),
n.player_.liveTracker && n.on(n.player_.liveTracker, "liveedgechange", n.updateLiveEdgeStatus),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = e.prototype.createEl.call(this, "button", {
className: "vjs-seek-to-live-control vjs-control"
});
return this.textEl_ = ti("span", {
className: "vjs-seek-to-live-text",
innerHTML: this.localize("LIVE")
}, {
"aria-hidden": "true"
}),
t.appendChild(this.textEl_),
t
}
,
i.updateLiveEdgeStatus = function() {
!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge() ? (this.setAttribute("aria-disabled", !0),
this.addClass("vjs-at-live-edge"),
this.controlText("Seek to live, currently playing live")) : (this.setAttribute("aria-disabled", !1),
this.removeClass("vjs-at-live-edge"),
this.controlText("Seek to live, currently behind live"))
}
,
i.handleClick = function() {
this.player_.liveTracker.seekToLiveEdge()
}
,
i.dispose = function() {
this.player_.liveTracker && this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatus),
this.textEl_ = null,
e.prototype.dispose.call(this)
}
,
t
}(dd);
Cd.prototype.controlText_ = "Seek to live, currently playing live",
Ol.registerComponent("SeekToLive", Cd);
var Ed = function(e, t, i) {
return e = Number(e),
Math.min(i, Math.max(t, isNaN(e) ? t : e))
}
, kd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.bar = n.getChild(n.options_.barName),
n.vertical(!!n.options_.vertical),
n.enable(),
n
}
gr(t, e);
var i = t.prototype;
return i.enabled = function() {
return this.enabled_
}
,
i.enable = function() {
this.enabled() || (this.on("mousedown", this.handleMouseDown),
this.on("touchstart", this.handleMouseDown),
this.on("keydown", this.handleKeyDown),
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)
}
,
i.disable = function() {
if (this.enabled()) {
var e = this.bar.el_.ownerDocument;
this.off("mousedown", this.handleMouseDown),
this.off("touchstart", this.handleMouseDown),
this.off("keydown", this.handleKeyDown),
this.off("click", this.handleClick),
this.off(this.player_, "controlsvisible", this.update),
this.off(e, "mousemove", this.handleMouseMove),
this.off(e, "mouseup", this.handleMouseUp),
this.off(e, "touchmove", this.handleMouseMove),
this.off(e, "touchend", this.handleMouseUp),
this.removeAttribute("tabindex"),
this.addClass("disabled"),
this.playerEvent && this.off(this.player_, this.playerEvent, this.update),
this.enabled_ = !1
}
}
,
i.createEl = function(t, i, n) {
return void 0 === i && (i = {}),
void 0 === n && (n = {}),
i.className = i.className + " vjs-slider",
i = Wt({
tabIndex: 0
}, i),
n = Wt({
role: "slider",
"aria-valuenow": 0,
"aria-valuemin": 0,
"aria-valuemax": 100,
tabIndex: 0
}, n),
e.prototype.createEl.call(this, t, i, n)
}
,
i.handleMouseDown = function(e) {
var t = this.bar.el_.ownerDocument;
"mousedown" === e.type && e.preventDefault(),
"touchstart" !== e.type || zl || e.preventDefault(),
fi(),
this.addClass("vjs-sliding"),
this.trigger("slideractive"),
this.on(t, "mousemove", this.handleMouseMove),
this.on(t, "mouseup", this.handleMouseUp),
this.on(t, "touchmove", this.handleMouseMove),
this.on(t, "touchend", this.handleMouseUp),
this.handleMouseMove(e)
}
,
i.handleMouseMove = function() {}
,
i.handleMouseUp = function() {
var e = this.bar.el_.ownerDocument;
pi(),
this.removeClass("vjs-sliding"),
this.trigger("sliderinactive"),
this.off(e, "mousemove", this.handleMouseMove),
this.off(e, "mouseup", this.handleMouseUp),
this.off(e, "touchmove", this.handleMouseMove),
this.off(e, "touchend", this.handleMouseUp),
this.update()
}
,
i.update = function() {
var e = this;
if (this.el_ && this.bar) {
var t = this.getProgress();
return t === this.progress_ ? t : (this.progress_ = t,
this.requestNamedAnimationFrame("Slider#update", function() {
var i = e.vertical() ? "height" : "width";
e.bar.el().style[i] = (100 * t).toFixed(2) + "%"
}),
t)
}
}
,
i.getProgress = function() {
return Number(Ed(this.getPercent(), 0, 1).toFixed(4))
}
,
i.calculateDistance = function(e) {
var t = vi(this.el_, e);
return this.vertical() ? t.y : t.x
}
,
i.handleKeyDown = function(t) {
yr.isEventKey(t, "Left") || yr.isEventKey(t, "Down") ? (t.preventDefault(),
t.stopPropagation(),
this.stepBack()) : yr.isEventKey(t, "Right") || yr.isEventKey(t, "Up") ? (t.preventDefault(),
t.stopPropagation(),
this.stepForward()) : e.prototype.handleKeyDown.call(this, t)
}
,
i.handleClick = function(e) {
e.stopPropagation(),
e.preventDefault()
}
,
i.vertical = function(e) {
return void 0 === e ? this.vertical_ || !1 : (this.vertical_ = !!e,
void this.addClass(this.vertical_ ? "vjs-slider-vertical" : "vjs-slider-horizontal"))
}
,
t
}(Ol);
Ol.registerComponent("Slider", kd);
var wd = function(e, t) {
return Ed(e / t * 100, 0, 100).toFixed(2) + "%"
}
, Id = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.partEls_ = [],
n.on(t, "progress", n.update),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = e.prototype.createEl.call(this, "div", {
className: "vjs-load-progress"
})
, i = ti("span", {
className: "vjs-control-text"
})
, n = ti("span", {
textContent: this.localize("Loaded")
})
, r = hr["default"].createTextNode(": ");
return this.percentageEl_ = ti("span", {
className: "vjs-control-text-loaded-percentage",
textContent: "0%"
}),
t.appendChild(i),
i.appendChild(n),
i.appendChild(r),
i.appendChild(this.percentageEl_),
t
}
,
i.dispose = function() {
this.partEls_ = null,
this.percentageEl_ = null,
e.prototype.dispose.call(this)
}
,
i.update = function() {
var e = this;
this.requestNamedAnimationFrame("LoadProgressBar#update", function() {
var t = e.player_.liveTracker
, i = e.player_.buffered()
, n = t && t.isLive() ? t.seekableEnd() : e.player_.duration()
, r = e.player_.bufferedEnd()
, a = e.partEls_
, s = wd(r, n);
e.percent_ !== s && (e.el_.style.width = s,
ii(e.percentageEl_, s),
e.percent_ = s);
for (var o = 0; o < i.length; o++) {
var u = i.start(o)
, l = i.end(o)
, c = a[o];
c || (c = e.el_.appendChild(ti()),
a[o] = c),
(c.dataset.start !== u || c.dataset.end !== l) && (c.dataset.start = u,
c.dataset.end = l,
c.style.left = wd(u, r),
c.style.width = wd(l - u, r))
}
for (var d = a.length; d > i.length; d--)
e.el_.removeChild(a[d - 1]);
a.length = i.length
})
}
,
t
}(Ol);
Ol.registerComponent("LoadProgressBar", Id);
var Ad = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.update = hl(dl(mr(n), n.update), cl),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-time-tooltip"
}, {
"aria-hidden": "true"
})
}
,
i.update = function(e, t, i) {
var n = gi(this.el_)
, r = mi(this.player_.el())
, a = e.width * t;
if (r && n) {
var s = e.left - r.left + a
, o = e.width - a + (r.right - e.right)
, u = n.width / 2;
u > s ? u += u - s : u > o && (u = o),
0 > u ? u = 0 : u > n.width && (u = n.width),
this.el_.style.right = "-" + u + "px",
this.write(i)
}
}
,
i.write = function(e) {
ii(this.el_, e)
}
,
i.updateTime = function(e, t, i, n) {
var r = this;
this.requestNamedAnimationFrame("TimeTooltip#updateTime", function() {
var a, s = r.player_.duration();
if (r.player_.liveTracker && r.player_.liveTracker.isLive()) {
var o = r.player_.liveTracker.liveWindow()
, u = o - t * o;
a = (1 > u ? "" : "-") + cn(u, o)
} else
a = cn(i, s);
r.update(e, t, a),
n && n()
})
}
,
t
}(Ol);
Ol.registerComponent("TimeTooltip", Ad);
var xd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.update = hl(dl(mr(n), n.update), cl),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-play-progress vjs-slider-bar"
}, {
"aria-hidden": "true"
})
}
,
i.update = function(e, t) {
var i = this.getChild("timeTooltip");
if (i) {
var n = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
i.updateTime(e, t, n)
}
}
,
t
}(Ol);
xd.prototype.options_ = {
children: []
},
Zl || jl || xd.prototype.options_.children.push("timeTooltip"),
Ol.registerComponent("PlayProgressBar", xd);
var Pd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.update = hl(dl(mr(n), n.update), cl),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-mouse-display"
})
}
,
i.update = function(e, t) {
var i = this
, n = t * this.player_.duration();
this.getChild("timeTooltip").updateTime(e, t, n, function() {
i.el_.style.left = e.width * t + "px"
})
}
,
t
}(Ol);
Pd.prototype.options_ = {
children: ["timeTooltip"]
},
Ol.registerComponent("MouseTimeDisplay", Pd);
var Ld = 5
, Dd = 12
, Od = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.setEventHandlers_(),
n
}
gr(t, e);
var i = t.prototype;
return i.setEventHandlers_ = function() {
this.update_ = dl(this, this.update),
this.update = hl(this.update_, cl),
this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update),
this.player_.liveTracker && this.on(this.player_.liveTracker, "liveedgechange", this.update),
this.updateInterval = null,
this.on(this.player_, ["playing"], this.enableInterval_),
this.on(this.player_, ["ended", "pause", "waiting"], this.disableInterval_),
"hidden"in hr["default"] && "visibilityState"in hr["default"] && this.on(hr["default"], "visibilitychange", this.toggleVisibility_)
}
,
i.toggleVisibility_ = function(e) {
hr["default"].hidden ? this.disableInterval_(e) : (this.enableInterval_(),
this.update())
}
,
i.enableInterval_ = function() {
this.updateInterval || (this.updateInterval = this.setInterval(this.update, cl))
}
,
i.disableInterval_ = function(e) {
this.player_.liveTracker && this.player_.liveTracker.isLive() && e && "ended" !== e.type || this.updateInterval && (this.clearInterval(this.updateInterval),
this.updateInterval = null)
}
,
i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-progress-holder"
}, {
"aria-label": this.localize("Progress Bar")
})
}
,
i.update = function() {
var t = this
, i = e.prototype.update.call(this);
return this.requestNamedAnimationFrame("SeekBar#update", function() {
var e = t.player_.ended() ? t.player_.duration() : t.getCurrentTime_()
, n = t.player_.liveTracker
, r = t.player_.duration();
n && n.isLive() && (r = t.player_.liveTracker.liveCurrentTime()),
t.percent_ !== i && (t.el_.setAttribute("aria-valuenow", (100 * i).toFixed(2)),
t.percent_ = i),
(t.currentTime_ !== e || t.duration_ !== r) && (t.el_.setAttribute("aria-valuetext", t.localize("progress bar timing: currentTime={1} duration={2}", [cn(e, r), cn(r, r)], "{1} of {2}")),
t.currentTime_ = e,
t.duration_ = r),
t.bar && t.bar.update(mi(t.el()), t.getProgress())
}),
i
}
,
i.getCurrentTime_ = function() {
return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime()
}
,
i.getPercent = function() {
var e, t = this.getCurrentTime_(), i = this.player_.liveTracker;
return i && i.isLive() ? (e = (t - i.seekableStart()) / i.liveWindow(),
i.atLiveEdge() && (e = 1)) : e = t / this.player_.duration(),
e
}
,
i.handleMouseDown = function(t) {
Ci(t) && (t.stopPropagation(),
this.player_.scrubbing(!0),
this.videoWasPlaying = !this.player_.paused(),
this.player_.pause(),
e.prototype.handleMouseDown.call(this, t))
}
,
i.handleMouseMove = function(e) {
if (Ci(e)) {
var t, i = this.calculateDistance(e), n = this.player_.liveTracker;
if (n && n.isLive()) {
if (i >= .99)
return void n.seekToLiveEdge();
var r = n.seekableStart()
, a = n.liveCurrentTime();
if (t = r + i * n.liveWindow(),
t >= a && (t = a),
r >= t && (t = r + .1),
1 / 0 === t)
return
} else
t = i * this.player_.duration(),
t === this.player_.duration() && (t -= .1);
this.player_.currentTime(t)
}
}
,
i.enable = function() {
e.prototype.enable.call(this);
var t = this.getChild("mouseTimeDisplay");
t && t.show()
}
,
i.disable = function() {
e.prototype.disable.call(this);
var t = this.getChild("mouseTimeDisplay");
t && t.hide()
}
,
i.handleMouseUp = function(t) {
e.prototype.handleMouseUp.call(this, t),
t && t.stopPropagation(),
this.player_.scrubbing(!1),
this.player_.trigger({
type: "timeupdate",
target: this,
manuallyTriggered: !0
}),
this.videoWasPlaying ? zi(this.player_.play()) : this.update_()
}
,
i.stepForward = function() {
this.player_.currentTime(this.player_.currentTime() + Ld)
}
,
i.stepBack = function() {
this.player_.currentTime(this.player_.currentTime() - Ld)
}
,
i.handleAction = function() {
this.player_.paused() ? this.player_.play() : this.player_.pause()
}
,
i.handleKeyDown = function(t) {
if (yr.isEventKey(t, "Space") || yr.isEventKey(t, "Enter"))
t.preventDefault(),
t.stopPropagation(),
this.handleAction(t);
else if (yr.isEventKey(t, "Home"))
t.preventDefault(),
t.stopPropagation(),
this.player_.currentTime(0);
else if (yr.isEventKey(t, "End"))
t.preventDefault(),
t.stopPropagation(),
this.player_.currentTime(this.player_.duration());
else if (/^[0-9]$/.test(yr(t))) {
t.preventDefault(),
t.stopPropagation();
var i = 10 * (yr.codes[yr(t)] - yr.codes[0]) / 100;
this.player_.currentTime(this.player_.duration() * i)
} else
yr.isEventKey(t, "PgDn") ? (t.preventDefault(),
t.stopPropagation(),
this.player_.currentTime(this.player_.currentTime() - Ld * Dd)) : yr.isEventKey(t, "PgUp") ? (t.preventDefault(),
t.stopPropagation(),
this.player_.currentTime(this.player_.currentTime() + Ld * Dd)) : e.prototype.handleKeyDown.call(this, t)
}
,
i.dispose = function() {
this.disableInterval_(),
this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update),
this.player_.liveTracker && this.on(this.player_.liveTracker, "liveedgechange", this.update),
this.off(this.player_, ["playing"], this.enableInterval_),
this.off(this.player_, ["ended", "pause", "waiting"], this.disableInterval_),
"hidden"in hr["default"] && "visibilityState"in hr["default"] && this.off(hr["default"], "visibilitychange", this.toggleVisibility_),
e.prototype.dispose.call(this)
}
,
t
}(kd);
Od.prototype.options_ = {
children: ["loadProgressBar", "playProgressBar"],
barName: "playProgressBar"
},
Zl || jl || Od.prototype.options_.children.splice(1, 0, "mouseTimeDisplay"),
Ol.registerComponent("SeekBar", Od);
var Nd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.handleMouseMove = hl(dl(mr(n), n.handleMouseMove), cl),
n.throttledHandleMouseSeek = hl(dl(mr(n), n.handleMouseSeek), cl),
n.enable(),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-progress-control vjs-control"
})
}
,
i.handleMouseMove = function(e) {
var t = this.getChild("seekBar");
if (t) {
var i = t.getChild("playProgressBar")
, n = t.getChild("mouseTimeDisplay");
if (i || n) {
var r = t.el()
, a = gi(r)
, s = vi(r, e).x;
s = Ed(s, 0, 1),
n && n.update(a, s),
i && i.update(a, t.getProgress())
}
}
}
,
i.handleMouseSeek = function(e) {
var t = this.getChild("seekBar");
t && t.handleMouseMove(e)
}
,
i.enabled = function() {
return this.enabled_
}
,
i.disable = function() {
this.children().forEach(function(e) {
return e.disable && e.disable()
}),
this.enabled() && (this.off(["mousedown", "touchstart"], this.handleMouseDown),
this.off(this.el_, "mousemove", this.handleMouseMove),
this.handleMouseUp(),
this.addClass("disabled"),
this.enabled_ = !1)
}
,
i.enable = function() {
this.children().forEach(function(e) {
return e.enable && e.enable()
}),
this.enabled() || (this.on(["mousedown", "touchstart"], this.handleMouseDown),
this.on(this.el_, "mousemove", this.handleMouseMove),
this.removeClass("disabled"),
this.enabled_ = !0)
}
,
i.handleMouseDown = function(e) {
var t = this.el_.ownerDocument
, i = this.getChild("seekBar");
i && i.handleMouseDown(e),
this.on(t, "mousemove", this.throttledHandleMouseSeek),
this.on(t, "touchmove", this.throttledHandleMouseSeek),
this.on(t, "mouseup", this.handleMouseUp),
this.on(t, "touchend", this.handleMouseUp)
}
,
i.handleMouseUp = function(e) {
var t = this.el_.ownerDocument
, i = this.getChild("seekBar");
i && i.handleMouseUp(e),
this.off(t, "mousemove", this.throttledHandleMouseSeek),
this.off(t, "touchmove", this.throttledHandleMouseSeek),
this.off(t, "mouseup", this.handleMouseUp),
this.off(t, "touchend", this.handleMouseUp)
}
,
t
}(Ol);
Nd.prototype.options_ = {
children: ["seekBar"]
},
Ol.registerComponent("ProgressControl", Nd);
var Md = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on(t, ["enterpictureinpicture", "leavepictureinpicture"], n.handlePictureInPictureChange),
n.on(t, ["disablepictureinpicturechanged", "loadedmetadata"], n.handlePictureInPictureEnabledChange),
n.disable(),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-picture-in-picture-control " + e.prototype.buildCSSClass.call(this)
}
,
i.handlePictureInPictureEnabledChange = function() {
hr["default"].pictureInPictureEnabled && this.player_.disablePictureInPicture() === !1 ? this.enable() : this.disable()
}
,
i.handlePictureInPictureChange = function() {
this.controlText(this.player_.isInPictureInPicture() ? "Exit Picture-in-Picture" : "Picture-in-Picture"),
this.handlePictureInPictureEnabledChange()
}
,
i.handleClick = function() {
this.player_.isInPictureInPicture() ? this.player_.exitPictureInPicture() : this.player_.requestPictureInPicture()
}
,
t
}(dd);
Md.prototype.controlText_ = "Picture-in-Picture",
Ol.registerComponent("PictureInPictureToggle", Md);
var Rd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on(t, "fullscreenchange", n.handleFullscreenChange),
hr["default"][t.fsApi_.fullscreenEnabled] === !1 && n.disable(),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-fullscreen-control " + e.prototype.buildCSSClass.call(this)
}
,
i.handleFullscreenChange = function() {
this.controlText(this.player_.isFullscreen() ? "Non-Fullscreen" : "Fullscreen")
}
,
i.handleClick = function() {
this.player_.isFullscreen() ? this.player_.exitFullscreen() : this.player_.requestFullscreen()
}
,
t
}(dd);
Rd.prototype.controlText_ = "Fullscreen",
Ol.registerComponent("FullscreenToggle", Rd);
var Ud = function(e, t) {
t.tech_ && !t.tech_.featuresVolumeControl && e.addClass("vjs-hidden"),
e.on(t, "loadstart", function() {
t.tech_.featuresVolumeControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden")
})
}
, Fd = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-volume-level",
innerHTML: '<span class="vjs-control-text"></span>'
})
}
,
t
}(Ol);
Ol.registerComponent("VolumeLevel", Fd);
var Bd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on("slideractive", n.updateLastVolume_),
n.on(t, "volumechange", n.updateARIAAttributes),
t.ready(function() {
return n.updateARIAAttributes()
}),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-volume-bar vjs-slider-bar"
}, {
"aria-label": this.localize("Volume Level"),
"aria-live": "polite"
})
}
,
i.handleMouseDown = function(t) {
Ci(t) && e.prototype.handleMouseDown.call(this, t)
}
,
i.handleMouseMove = function(e) {
Ci(e) && (this.checkMuted(),
this.player_.volume(this.calculateDistance(e)))
}
,
i.checkMuted = function() {
this.player_.muted() && this.player_.muted(!1)
}
,
i.getPercent = function() {
return this.player_.muted() ? 0 : this.player_.volume()
}
,
i.stepForward = function() {
this.checkMuted(),
this.player_.volume(this.player_.volume() + .1)
}
,
i.stepBack = function() {
this.checkMuted(),
this.player_.volume(this.player_.volume() - .1)
}
,
i.updateARIAAttributes = function() {
var e = this.player_.muted() ? 0 : this.volumeAsPercentage_();
this.el_.setAttribute("aria-valuenow", e),
this.el_.setAttribute("aria-valuetext", e + "%")
}
,
i.volumeAsPercentage_ = function() {
return Math.round(100 * this.player_.volume())
}
,
i.updateLastVolume_ = function() {
var e = this
, t = this.player_.volume();
this.one("sliderinactive", function() {
0 === e.player_.volume() && e.player_.lastVolume_(t)
})
}
,
t
}(kd);
Bd.prototype.options_ = {
children: ["volumeLevel"],
barName: "volumeLevel"
},
Bd.prototype.playerEvent = "volumechange",
Ol.registerComponent("VolumeBar", Bd);
var jd = function(e) {
function t(t, i) {
var n;
return void 0 === i && (i = {}),
i.vertical = i.vertical || !1,
("undefined" == typeof i.volumeBar || Gt(i.volumeBar)) && (i.volumeBar = i.volumeBar || {},
i.volumeBar.vertical = i.vertical),
n = e.call(this, t, i) || this,
Ud(mr(n), t),
n.throttledHandleMouseMove = hl(dl(mr(n), n.handleMouseMove), cl),
n.on("mousedown", n.handleMouseDown),
n.on("touchstart", n.handleMouseDown),
n.on(n.volumeBar, ["focus", "slideractive"], function() {
n.volumeBar.addClass("vjs-slider-active"),
n.addClass("vjs-slider-active"),
n.trigger("slideractive")
}),
n.on(n.volumeBar, ["blur", "sliderinactive"], function() {
n.volumeBar.removeClass("vjs-slider-active"),
n.removeClass("vjs-slider-active"),
n.trigger("sliderinactive")
}),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = "vjs-volume-horizontal";
return this.options_.vertical && (t = "vjs-volume-vertical"),
e.prototype.createEl.call(this, "div", {
className: "vjs-volume-control vjs-control " + t
})
}
,
i.handleMouseDown = function() {
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)
}
,
i.handleMouseUp = function() {
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)
}
,
i.handleMouseMove = function(e) {
this.volumeBar.handleMouseMove(e)
}
,
t
}(Ol);
jd.prototype.options_ = {
children: ["volumeBar"]
},
Ol.registerComponent("VolumeControl", jd);
var Vd = function(e, t) {
t.tech_ && !t.tech_.featuresMuteControl && e.addClass("vjs-hidden"),
e.on(t, "loadstart", function() {
t.tech_.featuresMuteControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden")
})
}
, qd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
Vd(mr(n), t),
n.on(t, ["loadstart", "volumechange"], n.update),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-mute-control " + e.prototype.buildCSSClass.call(this)
}
,
i.handleClick = function() {
var e = this.player_.volume()
, t = this.player_.lastVolume_();
if (0 === e) {
var i = .1 > t ? .1 : t;
this.player_.volume(i),
this.player_.muted(!1)
} else
this.player_.muted(this.player_.muted() ? !1 : !0)
}
,
i.update = function() {
this.updateIcon_(),
this.updateControlText_()
}
,
i.updateIcon_ = function() {
var e = this.player_.volume()
, t = 3;
Zl && this.player_.tech_ && this.player_.tech_.el_ && this.player_.muted(this.player_.tech_.el_.muted),
0 === e || this.player_.muted() ? t = 0 : .33 > e ? t = 1 : .67 > e && (t = 2);
for (var i = 0; 4 > i; i++)
si(this.el_, "vjs-vol-" + i);
ai(this.el_, "vjs-vol-" + t)
}
,
i.updateControlText_ = function() {
var e = this.player_.muted() || 0 === this.player_.volume()
, t = e ? "Unmute" : "Mute";
this.controlText() !== t && this.controlText(t)
}
,
t
}(dd);
qd.prototype.controlText_ = "Mute",
Ol.registerComponent("MuteToggle", qd);
var Hd = function(e) {
function t(t, i) {
var n;
return void 0 === i && (i = {}),
i.inline = "undefined" != typeof i.inline ? i.inline : !0,
("undefined" == typeof i.volumeControl || Gt(i.volumeControl)) && (i.volumeControl = i.volumeControl || {},
i.volumeControl.vertical = !i.inline),
n = e.call(this, t, i) || this,
n.on(t, ["loadstart"], n.volumePanelState_),
n.on(n.muteToggle, "keyup", n.handleKeyPress),
n.on(n.volumeControl, "keyup", n.handleVolumeControlKeyUp),
n.on("keydown", n.handleKeyPress),
n.on("mouseover", n.handleMouseOver),
n.on("mouseout", n.handleMouseOut),
n.on(n.volumeControl, ["slideractive"], n.sliderActive_),
n.on(n.volumeControl, ["sliderinactive"], n.sliderInactive_),
n
}
gr(t, e);
var i = t.prototype;
return i.sliderActive_ = function() {
this.addClass("vjs-slider-active")
}
,
i.sliderInactive_ = function() {
this.removeClass("vjs-slider-active")
}
,
i.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")
}
,
i.createEl = function() {
var t = "vjs-volume-panel-horizontal";
return this.options_.inline || (t = "vjs-volume-panel-vertical"),
e.prototype.createEl.call(this, "div", {
className: "vjs-volume-panel vjs-control " + t
})
}
,
i.dispose = function() {
this.handleMouseOut(),
e.prototype.dispose.call(this)
}
,
i.handleVolumeControlKeyUp = function(e) {
yr.isEventKey(e, "Esc") && this.muteToggle.focus()
}
,
i.handleMouseOver = function() {
this.addClass("vjs-hover"),
Pi(hr["default"], "keyup", dl(this, this.handleKeyPress))
}
,
i.handleMouseOut = function() {
this.removeClass("vjs-hover"),
Li(hr["default"], "keyup", dl(this, this.handleKeyPress))
}
,
i.handleKeyPress = function(e) {
yr.isEventKey(e, "Esc") && this.handleMouseOut()
}
,
t
}(Ol);
Hd.prototype.options_ = {
children: ["muteToggle", "volumeControl"]
},
Ol.registerComponent("VolumePanel", Hd);
var Wd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
i && (n.menuButton_ = i.menuButton),
n.focusedChild_ = -1,
n.on("keydown", n.handleKeyDown),
n.boundHandleBlur_ = dl(mr(n), n.handleBlur),
n.boundHandleTapClick_ = dl(mr(n), n.handleTapClick),
n
}
gr(t, e);
var i = t.prototype;
return i.addEventListenerForItem = function(e) {
e instanceof Ol && (this.on(e, "blur", this.boundHandleBlur_),
this.on(e, ["tap", "click"], this.boundHandleTapClick_))
}
,
i.removeEventListenerForItem = function(e) {
e instanceof Ol && (this.off(e, "blur", this.boundHandleBlur_),
this.off(e, ["tap", "click"], this.boundHandleTapClick_))
}
,
i.removeChild = function(t) {
"string" == typeof t && (t = this.getChild(t)),
this.removeEventListenerForItem(t),
e.prototype.removeChild.call(this, t)
}
,
i.addItem = function(e) {
var t = this.addChild(e);
t && this.addEventListenerForItem(t)
}
,
i.createEl = function() {
var t = this.options_.contentElType || "ul";
this.contentEl_ = ti(t, {
className: "vjs-menu-content"
}),
this.contentEl_.setAttribute("role", "menu");
var i = e.prototype.createEl.call(this, "div", {
append: this.contentEl_,
className: "vjs-menu"
});
return i.appendChild(this.contentEl_),
Pi(i, "click", function(e) {
e.preventDefault(),
e.stopImmediatePropagation()
}),
i
}
,
i.dispose = function() {
this.contentEl_ = null,
this.boundHandleBlur_ = null,
this.boundHandleTapClick_ = null,
e.prototype.dispose.call(this)
}
,
i.handleBlur = function(e) {
var t = e.relatedTarget || hr["default"].activeElement;
if (!this.children().some(function(e) {
return e.el() === t
})) {
var i = this.menuButton_;
i && i.buttonPressed_ && t !== i.el().firstChild && i.unpressButton()
}
}
,
i.handleTapClick = function(e) {
if (this.menuButton_) {
this.menuButton_.unpressButton();
var t = this.children();
if (!Array.isArray(t))
return;
var i = t.filter(function(t) {
return t.el() === e.target
})[0];
if (!i)
return;
"CaptionSettingsMenuItem" !== i.name() && this.menuButton_.focus()
}
}
,
i.handleKeyDown = function(e) {
yr.isEventKey(e, "Left") || yr.isEventKey(e, "Down") ? (e.preventDefault(),
e.stopPropagation(),
this.stepForward()) : (yr.isEventKey(e, "Right") || yr.isEventKey(e, "Up")) && (e.preventDefault(),
e.stopPropagation(),
this.stepBack())
}
,
i.stepForward = function() {
var e = 0;
void 0 !== this.focusedChild_ && (e = this.focusedChild_ + 1),
this.focus(e)
}
,
i.stepBack = function() {
var e = 0;
void 0 !== this.focusedChild_ && (e = this.focusedChild_ - 1),
this.focus(e)
}
,
i.focus = function(e) {
void 0 === e && (e = 0);
var t = this.children().slice()
, i = t.length && t[0].className && /vjs-menu-title/.test(t[0].className);
i && t.shift(),
t.length > 0 && (0 > e ? e = 0 : e >= t.length && (e = t.length - 1),
this.focusedChild_ = e,
t[e].el_.focus())
}
,
t
}(Ol);
Ol.registerComponent("Menu", Wd);
var zd = function(e) {
function t(t, i) {
var n;
void 0 === i && (i = {}),
n = e.call(this, t, i) || this,
n.menuButton_ = new dd(t,i),
n.menuButton_.controlText(n.controlText_),
n.menuButton_.el_.setAttribute("aria-haspopup", "true");
var r = dd.prototype.buildCSSClass();
return n.menuButton_.el_.className = n.buildCSSClass() + " " + r,
n.menuButton_.removeClass("vjs-control"),
n.addChild(n.menuButton_),
n.update(),
n.enabled_ = !0,
n.on(n.menuButton_, "tap", n.handleClick),
n.on(n.menuButton_, "click", n.handleClick),
n.on(n.menuButton_, "keydown", n.handleKeyDown),
n.on(n.menuButton_, "mouseenter", function() {
n.addClass("vjs-hover"),
n.menu.show(),
Pi(hr["default"], "keyup", dl(mr(n), n.handleMenuKeyUp))
}),
n.on("mouseleave", n.handleMouseLeave),
n.on("keydown", n.handleSubmenuKeyDown),
n
}
gr(t, e);
var i = t.prototype;
return i.update = function() {
var e = this.createMenu();
this.menu && (this.menu.dispose(),
this.removeChild(this.menu)),
this.menu = e,
this.addChild(e),
this.buttonPressed_ = !1,
this.menuButton_.el_.setAttribute("aria-expanded", "false"),
this.items && this.items.length <= this.hideThreshold_ ? this.hide() : this.show()
}
,
i.createMenu = function() {
var e = new Wd(this.player_,{
menuButton: this
});
if (this.hideThreshold_ = 0,
this.options_.title) {
var t = ti("li", {
className: "vjs-menu-title",
innerHTML: Il(this.options_.title),
tabIndex: -1
});
this.hideThreshold_ += 1;
var i = new Ol(this.player_,{
el: t
});
e.addItem(i)
}
if (this.items = this.createItems(),
this.items)
for (var n = 0; n < this.items.length; n++)
e.addItem(this.items[n]);
return e
}
,
i.createItems = function() {}
,
i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: this.buildWrapperCSSClass()
}, {})
}
,
i.buildWrapperCSSClass = function() {
var t = "vjs-menu-button";
t += this.options_.inline === !0 ? "-inline" : "-popup";
var i = dd.prototype.buildCSSClass();
return "vjs-menu-button " + t + " " + i + " " + e.prototype.buildCSSClass.call(this)
}
,
i.buildCSSClass = function() {
var t = "vjs-menu-button";
return t += this.options_.inline === !0 ? "-inline" : "-popup",
"vjs-menu-button " + t + " " + e.prototype.buildCSSClass.call(this)
}
,
i.controlText = function(e, t) {
return void 0 === t && (t = this.menuButton_.el()),
this.menuButton_.controlText(e, t)
}
,
i.dispose = function() {
this.handleMouseLeave(),
e.prototype.dispose.call(this)
}
,
i.handleClick = function() {
this.buttonPressed_ ? this.unpressButton() : this.pressButton()
}
,
i.handleMouseLeave = function() {
this.removeClass("vjs-hover"),
Li(hr["default"], "keyup", dl(this, this.handleMenuKeyUp))
}
,
i.focus = function() {
this.menuButton_.focus()
}
,
i.blur = function() {
this.menuButton_.blur()
}
,
i.handleKeyDown = function(e) {
yr.isEventKey(e, "Esc") || yr.isEventKey(e, "Tab") ? (this.buttonPressed_ && this.unpressButton(),
yr.isEventKey(e, "Tab") || (e.preventDefault(),
this.menuButton_.focus())) : (yr.isEventKey(e, "Up") || yr.isEventKey(e, "Down")) && (this.buttonPressed_ || (e.preventDefault(),
this.pressButton()))
}
,
i.handleMenuKeyUp = function(e) {
(yr.isEventKey(e, "Esc") || yr.isEventKey(e, "Tab")) && this.removeClass("vjs-hover")
}
,
i.handleSubmenuKeyPress = function(e) {
this.handleSubmenuKeyDown(e)
}
,
i.handleSubmenuKeyDown = function(e) {
(yr.isEventKey(e, "Esc") || yr.isEventKey(e, "Tab")) && (this.buttonPressed_ && this.unpressButton(),
yr.isEventKey(e, "Tab") || (e.preventDefault(),
this.menuButton_.focus()))
}
,
i.pressButton = function() {
if (this.enabled_) {
if (this.buttonPressed_ = !0,
this.menu.show(),
this.menu.lockShowing(),
this.menuButton_.el_.setAttribute("aria-expanded", "true"),
Zl && Zt())
return;
this.menu.focus()
}
}
,
i.unpressButton = function() {
this.enabled_ && (this.buttonPressed_ = !1,
this.menu.unlockShowing(),
this.menu.hide(),
this.menuButton_.el_.setAttribute("aria-expanded", "false"))
}
,
i.disable = function() {
this.unpressButton(),
this.enabled_ = !1,
this.addClass("vjs-disabled"),
this.menuButton_.disable()
}
,
i.enable = function() {
this.enabled_ = !0,
this.removeClass("vjs-disabled"),
this.menuButton_.enable()
}
,
t
}(Ol);
Ol.registerComponent("MenuButton", zd);
var Gd = function(e) {
function t(t, i) {
var n, r = i.tracks;
if (n = e.call(this, t, i) || this,
n.items.length <= 1 && n.hide(),
!r)
return mr(n);
var a = dl(mr(n), n.update);
return r.addEventListener("removetrack", a),
r.addEventListener("addtrack", a),
n.player_.on("ready", a),
n.player_.on("dispose", function() {
r.removeEventListener("removetrack", a),
r.removeEventListener("addtrack", a)
}),
n
}
return gr(t, e),
t
}(zd);
Ol.registerComponent("TrackButton", Gd);
var Xd = ["Tab", "Esc", "Up", "Down", "Right", "Left"]
, Kd = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.selectable = i.selectable,
n.isSelected_ = i.selected || !1,
n.multiSelectable = i.multiSelectable,
n.selected(n.isSelected_),
n.selectable ? n.multiSelectable ? n.el_.setAttribute("role", "menuitemcheckbox") : n.el_.setAttribute("role", "menuitemradio") : n.el_.setAttribute("role", "menuitem"),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function(t, i, n) {
return this.nonIconControl = !0,
e.prototype.createEl.call(this, "li", Wt({
className: "vjs-menu-item",
innerHTML: '<span class="vjs-menu-item-text">' + this.localize(this.options_.label) + "</span>",
tabIndex: -1
}, i), n)
}
,
i.handleKeyDown = function(t) {
Xd.some(function(e) {
return yr.isEventKey(t, e)
}) || e.prototype.handleKeyDown.call(this, t)
}
,
i.handleClick = function() {
this.selected(!0)
}
,
i.selected = function(e) {
this.selectable && (e ? (this.addClass("vjs-selected"),
this.el_.setAttribute("aria-checked", "true"),
this.controlText(", selected"),
this.isSelected_ = !0) : (this.removeClass("vjs-selected"),
this.el_.setAttribute("aria-checked", "false"),
this.controlText(""),
this.isSelected_ = !1))
}
,
t
}(rd);
Ol.registerComponent("MenuItem", Kd);
var Yd = function(e) {
function t(t, i) {
var n, r = i.track, a = t.textTracks();
i.label = r.label || r.language || "Unknown",
i.selected = "showing" === r.mode,
n = e.call(this, t, i) || this,
n.track = r,
n.kinds = (i.kinds || [i.kind || n.track.kind]).filter(Boolean);
var s = function() {
for (var e = arguments.length, t = new Array(e), i = 0; e > i; i++)
t[i] = arguments[i];
n.handleTracksChange.apply(mr(n), t)
}
, o = function() {
for (var e = arguments.length, t = new Array(e), i = 0; e > i; i++)
t[i] = arguments[i];
n.handleSelectedLanguageChange.apply(mr(n), t)
};
if (t.on(["loadstart", "texttrackchange"], s),
a.addEventListener("change", s),
a.addEventListener("selectedlanguagechange", o),
n.on("dispose", function() {
t.off(["loadstart", "texttrackchange"], s),
a.removeEventListener("change", s),
a.removeEventListener("selectedlanguagechange", o)
}),
void 0 === a.onchange) {
var u;
n.on(["tap", "click"], function() {
if ("object" != typeof dr["default"].Event)
try {
u = new dr["default"].Event("change")
} catch (e) {}
u || (u = hr["default"].createEvent("Event"),
u.initEvent("change", !0, !0)),
a.dispatchEvent(u)
})
}
return n.handleTracksChange(),
n
}
gr(t, e);
var i = t.prototype;
return i.handleClick = function(t) {
var i = this.track
, n = this.player_.textTracks();
if (e.prototype.handleClick.call(this, t),
n)
for (var r = 0; r < n.length; r++) {
var a = n[r];
-1 !== this.kinds.indexOf(a.kind) && (a === i ? "showing" !== a.mode && (a.mode = "showing") : "disabled" !== a.mode && (a.mode = "disabled"))
}
}
,
i.handleTracksChange = function() {
var e = "showing" === this.track.mode;
e !== this.isSelected_ && this.selected(e)
}
,
i.handleSelectedLanguageChange = function() {
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
}
}
}
,
i.dispose = function() {
this.track = null,
e.prototype.dispose.call(this)
}
,
t
}(Kd);
Ol.registerComponent("TextTrackMenuItem", Yd);
var $d = function(e) {
function t(t, i) {
return i.track = {
player: t,
kind: i.kind,
kinds: i.kinds,
"default": !1,
mode: "disabled"
},
i.kinds || (i.kinds = [i.kind]),
i.track.label = i.label ? i.label : i.kinds.join(" and ") + " off",
i.selectable = !0,
i.multiSelectable = !1,
e.call(this, t, i) || this
}
gr(t, e);
var i = t.prototype;
return i.handleTracksChange = function() {
for (var e = this.player().textTracks(), t = !0, i = 0, n = e.length; n > i; i++) {
var r = e[i];
if (this.options_.kinds.indexOf(r.kind) > -1 && "showing" === r.mode) {
t = !1;
break
}
}
t !== this.isSelected_ && this.selected(t)
}
,
i.handleSelectedLanguageChange = function() {
for (var e = this.player().textTracks(), t = !0, i = 0, n = e.length; n > i; i++) {
var r = e[i];
if (["captions", "descriptions", "subtitles"].indexOf(r.kind) > -1 && "showing" === r.mode) {
t = !1;
break
}
}
t && (this.player_.cache_.selectedLanguage = {
enabled: !1
})
}
,
t
}(Yd);
Ol.registerComponent("OffTextTrackMenuItem", $d);
var Qd = function(e) {
function t(t, i) {
return void 0 === i && (i = {}),
i.tracks = t.textTracks(),
e.call(this, t, i) || this
}
gr(t, e);
var i = t.prototype;
return i.createItems = function(e, t) {
void 0 === e && (e = []),
void 0 === t && (t = Yd);
var i;
this.label_ && (i = this.label_ + " off"),
e.push(new $d(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 (this.kinds_.indexOf(a.kind) > -1) {
var s = new t(this.player_,{
track: a,
kinds: this.kinds_,
kind: this.kind_,
selectable: !0,
multiSelectable: !1
});
s.addClass("vjs-" + a.kind + "-menu-item"),
e.push(s)
}
}
return e
}
,
t
}(Gd);
Ol.registerComponent("TextTrackButton", Qd);
var Jd = function(e) {
function t(t, i) {
var n, r = i.track, a = i.cue, s = t.currentTime();
return i.selectable = !0,
i.multiSelectable = !1,
i.label = a.text,
i.selected = a.startTime <= s && s < a.endTime,
n = e.call(this, t, i) || this,
n.track = r,
n.cue = a,
r.addEventListener("cuechange", dl(mr(n), n.update)),
n
}
gr(t, e);
var i = t.prototype;
return i.handleClick = function() {
e.prototype.handleClick.call(this),
this.player_.currentTime(this.cue.startTime),
this.update(this.cue.startTime)
}
,
i.update = function() {
var e = this.cue
, t = this.player_.currentTime();
this.selected(e.startTime <= t && t < e.endTime)
}
,
t
}(Kd);
Ol.registerComponent("ChaptersTrackMenuItem", Jd);
var Zd = function(e) {
function t(t, i, n) {
return e.call(this, t, i, n) || this
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-chapters-button " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-chapters-button " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.update = function(t) {
(!this.track_ || t && ("addtrack" === t.type || "removetrack" === t.type)) && this.setTrack(this.findChaptersTrack()),
e.prototype.update.call(this)
}
,
i.setTrack = function(e) {
if (this.track_ !== e) {
if (this.updateHandler_ || (this.updateHandler_ = this.update.bind(this)),
this.track_) {
var t = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
t && t.removeEventListener("load", this.updateHandler_),
this.track_ = null
}
if (this.track_ = e,
this.track_) {
this.track_.mode = "hidden";
var i = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
i && i.addEventListener("load", this.updateHandler_)
}
}
}
,
i.findChaptersTrack = function() {
for (var e = this.player_.textTracks() || [], t = e.length - 1; t >= 0; t--) {
var i = e[t];
if (i.kind === this.kind_)
return i
}
}
,
i.getMenuCaption = function() {
return this.track_ && this.track_.label ? this.track_.label : this.localize(Il(this.kind_))
}
,
i.createMenu = function() {
return this.options_.title = this.getMenuCaption(),
e.prototype.createMenu.call(this)
}
,
i.createItems = function() {
var e = [];
if (!this.track_)
return e;
var t = this.track_.cues;
if (!t)
return e;
for (var i = 0, n = t.length; n > i; i++) {
var r = t[i]
, a = new Jd(this.player_,{
track: this.track_,
cue: r
});
e.push(a)
}
return e
}
,
t
}(Qd);
Zd.prototype.kind_ = "chapters",
Zd.prototype.controlText_ = "Chapters",
Ol.registerComponent("ChaptersButton", Zd);
var eh = function(e) {
function t(t, i, n) {
var r;
r = e.call(this, t, i, n) || this;
var a = t.textTracks()
, s = dl(mr(r), r.handleTracksChange);
return a.addEventListener("change", s),
r.on("dispose", function() {
a.removeEventListener("change", s)
}),
r
}
gr(t, e);
var i = t.prototype;
return i.handleTracksChange = function() {
for (var e = this.player().textTracks(), t = !1, i = 0, n = e.length; n > i; i++) {
var r = e[i];
if (r.kind !== this.kind_ && "showing" === r.mode) {
t = !0;
break
}
}
t ? this.disable() : this.enable()
}
,
i.buildCSSClass = function() {
return "vjs-descriptions-button " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-descriptions-button " + e.prototype.buildWrapperCSSClass.call(this)
}
,
t
}(Qd);
eh.prototype.kind_ = "descriptions",
eh.prototype.controlText_ = "Descriptions",
Ol.registerComponent("DescriptionsButton", eh);
var th = function(e) {
function t(t, i, n) {
return e.call(this, t, i, n) || this
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-subtitles-button " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-subtitles-button " + e.prototype.buildWrapperCSSClass.call(this)
}
,
t
}(Qd);
th.prototype.kind_ = "subtitles",
th.prototype.controlText_ = "Subtitles",
Ol.registerComponent("SubtitlesButton", th);
var ih = function(e) {
function t(t, i) {
var n;
return i.track = {
player: t,
kind: i.kind,
label: i.kind + " settings",
selectable: !1,
"default": !1,
mode: "disabled"
},
i.selectable = !1,
i.name = "CaptionSettingsMenuItem",
n = e.call(this, t, i) || this,
n.addClass("vjs-texttrack-settings"),
n.controlText(", opens " + i.kind + " settings dialog"),
n
}
gr(t, e);
var i = t.prototype;
return i.handleClick = function() {
this.player().getChild("textTrackSettings").open()
}
,
t
}(Yd);
Ol.registerComponent("CaptionSettingsMenuItem", ih);
var nh = function(e) {
function t(t, i, n) {
return e.call(this, t, i, n) || this
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-captions-button " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-captions-button " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.createItems = function() {
var t = [];
return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild("textTrackSettings") || (t.push(new ih(this.player_,{
kind: this.kind_
})),
this.hideThreshold_ += 1),
e.prototype.createItems.call(this, t)
}
,
t
}(Qd);
nh.prototype.kind_ = "captions",
nh.prototype.controlText_ = "Captions",
Ol.registerComponent("CaptionsButton", nh);
var rh = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.createEl = function(t, i, n) {
var r = '<span class="vjs-menu-item-text">' + this.localize(this.options_.label);
"captions" === this.options_.track.kind && (r += '\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> ' + this.localize("Captions") + "</span>\n "),
r += "</span>";
var a = e.prototype.createEl.call(this, t, Wt({
innerHTML: r
}, i), n);
return a
}
,
t
}(Yd);
Ol.registerComponent("SubsCapsMenuItem", rh);
var ah = function(e) {
function t(t, i) {
var n;
return void 0 === i && (i = {}),
n = e.call(this, t, i) || this,
n.label_ = "subtitles",
["en", "en-us", "en-ca", "fr-ca"].indexOf(n.player_.language_) > -1 && (n.label_ = "captions"),
n.menuButton_.controlText(Il(n.label_)),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-subs-caps-button " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-subs-caps-button " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.createItems = function() {
var t = [];
return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild("textTrackSettings") || (t.push(new ih(this.player_,{
kind: this.label_
})),
this.hideThreshold_ += 1),
t = e.prototype.createItems.call(this, t, rh)
}
,
t
}(Qd);
ah.prototype.kinds_ = ["captions", "subtitles"],
ah.prototype.controlText_ = "Subtitles",
Ol.registerComponent("SubsCapsButton", ah);
var sh = function(e) {
function t(t, i) {
var n, r = i.track, a = t.audioTracks();
i.label = r.label || r.language || "Unknown",
i.selected = r.enabled,
n = e.call(this, t, i) || this,
n.track = r,
n.addClass("vjs-" + r.kind + "-menu-item");
var s = function() {
for (var e = arguments.length, t = new Array(e), i = 0; e > i; i++)
t[i] = arguments[i];
n.handleTracksChange.apply(mr(n), t)
};
return a.addEventListener("change", s),
n.on("dispose", function() {
a.removeEventListener("change", s)
}),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function(t, i, n) {
var r = '<span class="vjs-menu-item-text">' + this.localize(this.options_.label);
"main-desc" === this.options_.track.kind && (r += '\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> ' + this.localize("Descriptions") + "</span>\n "),
r += "</span>";
var a = e.prototype.createEl.call(this, t, Wt({
innerHTML: r
}, i), n);
return a
}
,
i.handleClick = function(t) {
var i = this.player_.audioTracks();
e.prototype.handleClick.call(this, t);
for (var n = 0; n < i.length; n++) {
var r = i[n];
r.enabled = r === this.track
}
}
,
i.handleTracksChange = function() {
this.selected(this.track.enabled)
}
,
t
}(Kd);
Ol.registerComponent("AudioTrackMenuItem", sh);
var oh = function(e) {
function t(t, i) {
return void 0 === i && (i = {}),
i.tracks = t.audioTracks(),
e.call(this, t, i) || this
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-audio-button " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-audio-button " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.createItems = function(e) {
void 0 === e && (e = []),
this.hideThreshold_ = 1;
for (var t = this.player_.audioTracks(), i = 0; i < t.length; i++) {
var n = t[i];
e.push(new sh(this.player_,{
track: n,
selectable: !0,
multiSelectable: !1
}))
}
return e
}
,
t
}(Gd);
oh.prototype.controlText_ = "Audio Track",
Ol.registerComponent("AudioTrackButton", oh);
var uh = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-spacer " + e.prototype.buildCSSClass.call(this)
}
,
i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: this.buildCSSClass()
})
}
,
t
}(Ol);
Ol.registerComponent("Spacer", uh);
var lh = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(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
}(uh);
Ol.registerComponent("CustomControlSpacer", lh);
var ch = function(e) {
function t() {
return e.apply(this, arguments) || this
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "div", {
className: "vjs-control-bar",
dir: "ltr"
})
}
,
t
}(Ol);
ch.prototype.options_ = {
children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
},
"exitPictureInPicture"in hr["default"] && ch.prototype.options_.children.splice(ch.prototype.options_.children.length - 1, 0, "pictureInPictureToggle"),
Ol.registerComponent("ControlBar", ch);
var dh = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.on(t, "error", n.open),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-error-display " + e.prototype.buildCSSClass.call(this)
}
,
i.content = function() {
var e = this.player().error();
return e ? this.localize(e.message) : ""
}
,
t
}(fc);
dh.prototype.options_ = fr({}, fc.prototype.options_, {
pauseOnOpen: !1,
fillAlways: !0,
temporary: !1,
uncloseable: !0
}),
Ol.registerComponent("ErrorDisplay", dh);
var hh = "vjs-text-track-settings"
, fh = ["#000", "Black"]
, ph = ["#00F", "Blue"]
, mh = ["#0FF", "Cyan"]
, gh = ["#0F0", "Green"]
, vh = ["#F0F", "Magenta"]
, yh = ["#F00", "Red"]
, _h = ["#FFF", "White"]
, bh = ["#FF0", "Yellow"]
, Th = ["1", "Opaque"]
, Sh = ["0.5", "Semi-Transparent"]
, Ch = ["0", "Transparent"]
, Eh = {
backgroundColor: {
selector: ".vjs-bg-color > select",
id: "captions-background-color-%s",
label: "Color",
options: [fh, _h, yh, gh, ph, bh, vh, mh]
},
backgroundOpacity: {
selector: ".vjs-bg-opacity > select",
id: "captions-background-opacity-%s",
label: "Transparency",
options: [Th, Sh, Ch]
},
color: {
selector: ".vjs-fg-color > select",
id: "captions-foreground-color-%s",
label: "Color",
options: [_h, fh, yh, gh, ph, bh, vh, mh]
},
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(e) {
return "1.00" === e ? null : Number(e)
}
},
textOpacity: {
selector: ".vjs-text-opacity > select",
id: "captions-foreground-opacity-%s",
label: "Transparency",
options: [Th, Sh]
},
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: [Ch, Sh, Th]
}
};
Eh.windowColor.options = Eh.backgroundColor.options;
var kh = function(e) {
function t(t, i) {
var n;
return i.temporary = !1,
n = e.call(this, t, i) || this,
n.updateDisplay = dl(mr(n), n.updateDisplay),
n.fill(),
n.hasBeenOpened_ = n.hasBeenFilled_ = !0,
n.endDialog = ti("p", {
className: "vjs-control-text",
textContent: n.localize("End of dialog window.")
}),
n.el().appendChild(n.endDialog),
n.setDefaults(),
void 0 === i.persistTextTrackSettings && (n.options_.persistTextTrackSettings = n.options_.playerOptions.persistTextTrackSettings),
n.on(n.$(".vjs-done-button"), "click", function() {
n.saveSettings(),
n.close()
}),
n.on(n.$(".vjs-default-button"), "click", function() {
n.setDefaults(),
n.updateDisplay()
}),
qt(Eh, function(e) {
n.on(n.$(e.selector), "change", n.updateDisplay)
}),
n.options_.persistTextTrackSettings && n.restoreSettings(),
n
}
gr(t, e);
var i = t.prototype;
return i.dispose = function() {
this.endDialog = null,
e.prototype.dispose.call(this)
}
,
i.createElSelect_ = function(e, t, i) {
var n = this;
void 0 === t && (t = ""),
void 0 === i && (i = "label");
var r = Eh[e]
, a = r.id.replace("%s", this.id_)
, s = [t, 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(e) {
var t = a + "-" + e[1].replace(/\W+/g, "");
return ['<option id="' + t + '" value="' + e[0] + '" ', 'aria-labelledby="' + s + " " + t + '">', n.localize(e[1]), "</option>"].join("")
})).concat("</select>").join("")
}
,
i.createElFgColor_ = function() {
var e = "captions-text-legend-" + this.id_;
return ['<fieldset class="vjs-fg-color vjs-track-setting">', '<legend id="' + e + '">', this.localize("Text"), "</legend>", this.createElSelect_("color", e), '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", e), "</span>", "</fieldset>"].join("")
}
,
i.createElBgColor_ = function() {
var e = "captions-background-" + this.id_;
return ['<fieldset class="vjs-bg-color vjs-track-setting">', '<legend id="' + e + '">', this.localize("Background"), "</legend>", this.createElSelect_("backgroundColor", e), '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", e), "</span>", "</fieldset>"].join("")
}
,
i.createElWinColor_ = function() {
var e = "captions-window-" + this.id_;
return ['<fieldset class="vjs-window-color vjs-track-setting">', '<legend id="' + e + '">', this.localize("Window"), "</legend>", this.createElSelect_("windowColor", e), '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", e), "</span>", "</fieldset>"].join("")
}
,
i.createElColors_ = function() {
return ti("div", {
className: "vjs-track-settings-colors",
innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
})
}
,
i.createElFont_ = function() {
return ti("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("")
})
}
,
i.createElControls_ = function() {
var e = this.localize("restore all settings to the default values");
return ti("div", {
className: "vjs-track-settings-controls",
innerHTML: ['<button type="button" class="vjs-default-button" title="' + e + '">', this.localize("Reset"), '<span class="vjs-control-text"> ' + e + "</span>", "</button>", '<button type="button" class="vjs-done-button">' + this.localize("Done") + "</button>"].join("")
})
}
,
i.content = function() {
return [this.createElColors_(), this.createElFont_(), this.createElControls_()]
}
,
i.label = function() {
return this.localize("Caption Settings Dialog")
}
,
i.description = function() {
return this.localize("Beginning of dialog window. Escape will cancel and close the window.")
}
,
i.buildCSSClass = function() {
return e.prototype.buildCSSClass.call(this) + " vjs-text-track-settings"
}
,
i.getValues = function() {
var e = this;
return Ht(Eh, function(t, i, n) {
var r = hn(e.$(i.selector), i.parser);
return void 0 !== r && (t[n] = r),
t
}, {})
}
,
i.setValues = function(e) {
var t = this;
qt(Eh, function(i, n) {
fn(t.$(i.selector), e[n], i.parser)
})
}
,
i.setDefaults = function() {
var e = this;
qt(Eh, function(t) {
var i = t.hasOwnProperty("default") ? t["default"] : 0;
e.$(t.selector).selectedIndex = i
})
}
,
i.restoreSettings = function() {
var e;
try {
e = JSON.parse(dr["default"].localStorage.getItem(hh))
} catch (t) {
zu.warn(t)
}
e && this.setValues(e)
}
,
i.saveSettings = function() {
if (this.options_.persistTextTrackSettings) {
var e = this.getValues();
try {
Object.keys(e).length ? dr["default"].localStorage.setItem(hh, JSON.stringify(e)) : dr["default"].localStorage.removeItem(hh)
} catch (t) {
zu.warn(t)
}
}
}
,
i.updateDisplay = function() {
var e = this.player_.getChild("textTrackDisplay");
e && e.updateDisplay()
}
,
i.conditionalBlur_ = function() {
this.previouslyActiveEl_ = null;
var e = this.player_.controlBar
, t = e && e.subsCapsButton
, i = e && e.captionsButton;
t ? t.focus() : i && i.focus()
}
,
t
}(fc);
Ol.registerComponent("TextTrackSettings", kh);
var wh = function(e) {
function t(t, i) {
var n, r = i.ResizeObserver || dr["default"].ResizeObserver;
null === i.ResizeObserver && (r = !1);
var a = Ui({
createEl: !r,
reportTouchActivity: !1
}, i);
return n = e.call(this, t, a) || this,
n.ResizeObserver = i.ResizeObserver || dr["default"].ResizeObserver,
n.loadListener_ = null,
n.resizeObserver_ = null,
n.debouncedHandler_ = fl(function() {
n.resizeHandler()
}, 100, !1, mr(n)),
r ? (n.resizeObserver_ = new n.ResizeObserver(n.debouncedHandler_),
n.resizeObserver_.observe(t.el())) : (n.loadListener_ = function() {
if (n.el_ && n.el_.contentWindow) {
var e = n.debouncedHandler_
, t = n.unloadListener_ = function() {
Li(this, "resize", e),
Li(this, "unload", t),
t = null
}
;
Pi(n.el_.contentWindow, "unload", t),
Pi(n.el_.contentWindow, "resize", e)
}
}
,
n.one("load", n.loadListener_)),
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
return e.prototype.createEl.call(this, "iframe", {
className: "vjs-resize-manager",
tabIndex: -1
}, {
"aria-hidden": "true"
})
}
,
i.resizeHandler = function() {
this.player_ && this.player_.trigger && this.player_.trigger("playerresize")
}
,
i.dispose = function() {
this.debouncedHandler_ && this.debouncedHandler_.cancel(),
this.resizeObserver_ && (this.player_.el() && this.resizeObserver_.unobserve(this.player_.el()),
this.resizeObserver_.disconnect()),
this.loadListener_ && this.off("load", this.loadListener_),
this.el_ && this.el_.contentWindow && this.unloadListener_ && this.unloadListener_.call(this.el_.contentWindow),
this.ResizeObserver = null,
this.resizeObserver = null,
this.debouncedHandler_ = null,
this.loadListener_ = null,
e.prototype.dispose.call(this)
}
,
t
}(Ol);
Ol.registerComponent("ResizeManager", wh);
var Ih = {
trackingThreshold: 30,
liveTolerance: 15
}
, Ah = function(e) {
function t(t, i) {
var n, r = Ui(Ih, i, {
createEl: !1
});
return n = e.call(this, t, r) || this,
n.reset_(),
n.on(n.player_, "durationchange", n.handleDurationchange),
Xl && "hidden"in hr["default"] && "visibilityState"in hr["default"] && n.on(hr["default"], "visibilitychange", n.handleVisibilityChange),
n
}
gr(t, e);
var i = t.prototype;
return i.handleVisibilityChange = function() {
1 / 0 === this.player_.duration() && (hr["default"].hidden ? this.stopTracking() : this.startTracking())
}
,
i.trackLive_ = function() {
var e = this.player_.seekable();
if (e && e.length) {
var t = Number(dr["default"].performance.now().toFixed(4))
, i = -1 === this.lastTime_ ? 0 : (t - this.lastTime_) / 1e3;
this.lastTime_ = t,
this.pastSeekEnd_ = this.pastSeekEnd() + i;
var n = this.liveCurrentTime()
, r = this.player_.currentTime()
, a = this.player_.paused() || this.seekedBehindLive_ || Math.abs(n - r) > this.options_.liveTolerance;
this.timeupdateSeen_ && 1 / 0 !== n || (a = !1),
a !== this.behindLiveEdge_ && (this.behindLiveEdge_ = a,
this.trigger("liveedgechange"))
}
}
,
i.handleDurationchange = function() {
1 / 0 === this.player_.duration() && this.liveWindow() >= this.options_.trackingThreshold ? (this.player_.options_.liveui && this.player_.addClass("vjs-liveui"),
this.startTracking()) : (this.player_.removeClass("vjs-liveui"),
this.stopTracking())
}
,
i.startTracking = function() {
this.isTracking() || (this.timeupdateSeen_ || (this.timeupdateSeen_ = this.player_.hasStarted()),
this.trackingInterval_ = this.setInterval(this.trackLive_, cl),
this.trackLive_(),
this.on(this.player_, ["play", "pause"], this.trackLive_),
this.timeupdateSeen_ ? this.on(this.player_, "seeked", this.handleSeeked) : (this.one(this.player_, "play", this.handlePlay),
this.one(this.player_, "timeupdate", this.handleFirstTimeupdate)))
}
,
i.handleFirstTimeupdate = function() {
this.timeupdateSeen_ = !0,
this.on(this.player_, "seeked", this.handleSeeked)
}
,
i.handleSeeked = function() {
var e = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
this.seekedBehindLive_ = this.skipNextSeeked_ ? !1 : e > 2,
this.skipNextSeeked_ = !1,
this.trackLive_()
}
,
i.handlePlay = function() {
this.one(this.player_, "timeupdate", this.seekToLiveEdge)
}
,
i.reset_ = function() {
this.lastTime_ = -1,
this.pastSeekEnd_ = 0,
this.lastSeekEnd_ = -1,
this.behindLiveEdge_ = !0,
this.timeupdateSeen_ = !1,
this.seekedBehindLive_ = !1,
this.skipNextSeeked_ = !1,
this.clearInterval(this.trackingInterval_),
this.trackingInterval_ = null,
this.off(this.player_, ["play", "pause"], this.trackLive_),
this.off(this.player_, "seeked", this.handleSeeked),
this.off(this.player_, "play", this.handlePlay),
this.off(this.player_, "timeupdate", this.handleFirstTimeupdate),
this.off(this.player_, "timeupdate", this.seekToLiveEdge)
}
,
i.stopTracking = function() {
this.isTracking() && (this.reset_(),
this.trigger("liveedgechange"))
}
,
i.seekableEnd = function() {
for (var e = this.player_.seekable(), t = [], i = e ? e.length : 0; i--; )
t.push(e.end(i));
return t.length ? t.sort()[t.length - 1] : 1 / 0
}
,
i.seekableStart = function() {
for (var e = this.player_.seekable(), t = [], i = e ? e.length : 0; i--; )
t.push(e.start(i));
return t.length ? t.sort()[0] : 0
}
,
i.liveWindow = function() {
var e = this.liveCurrentTime();
return 1 / 0 === e ? 1 / 0 : e - this.seekableStart()
}
,
i.isLive = function() {
return this.isTracking()
}
,
i.atLiveEdge = function() {
return !this.behindLiveEdge()
}
,
i.liveCurrentTime = function() {
return this.pastSeekEnd() + this.seekableEnd()
}
,
i.pastSeekEnd = function() {
var e = this.seekableEnd();
return -1 !== this.lastSeekEnd_ && e !== this.lastSeekEnd_ && (this.pastSeekEnd_ = 0),
this.lastSeekEnd_ = e,
this.pastSeekEnd_
}
,
i.behindLiveEdge = function() {
return this.behindLiveEdge_
}
,
i.isTracking = function() {
return "number" == typeof this.trackingInterval_
}
,
i.seekToLiveEdge = function() {
this.seekedBehindLive_ = !1,
this.atLiveEdge() || (this.skipNextSeeked_ = !0,
this.player_.currentTime(this.liveCurrentTime()))
}
,
i.dispose = function() {
this.off(hr["default"], "visibilitychange", this.handleVisibilityChange),
this.stopTracking(),
e.prototype.dispose.call(this)
}
,
t
}(Ol);
Ol.registerComponent("LiveTracker", Ah);
var xh = function(e) {
var t = e.el();
if (t.hasAttribute("src"))
return e.triggerSourceset(t.src),
!0;
var i = e.$$("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]),
e.triggerSourceset(r),
!0) : !1
}
, Ph = Object.defineProperty({}, "innerHTML", {
get: function() {
return this.cloneNode(!0).innerHTML
},
set: function(e) {
var t = hr["default"].createElement(this.nodeName.toLowerCase());
t.innerHTML = e;
for (var i = hr["default"].createDocumentFragment(); t.childNodes.length; )
i.appendChild(t.childNodes[0]);
return this.innerText = "",
dr["default"].Element.prototype.appendChild.call(this, i),
this.innerHTML
}
})
, Lh = function(e, t) {
for (var i = {}, n = 0; n < e.length && (i = Object.getOwnPropertyDescriptor(e[n], t),
!(i && i.set && i.get)); n++)
;
return i.enumerable = !0,
i.configurable = !0,
i
}
, Dh = function(e) {
return Lh([e.el(), dr["default"].HTMLMediaElement.prototype, dr["default"].Element.prototype, Ph], "innerHTML")
}
, Oh = function(e) {
var t = e.el();
if (!t.resetSourceWatch_) {
var i = {}
, n = Dh(e)
, r = function(i) {
return function() {
for (var n = arguments.length, r = new Array(n), a = 0; n > a; a++)
r[a] = arguments[a];
var s = i.apply(t, r);
return xh(e),
s
}
};
["append", "appendChild", "insertAdjacentHTML"].forEach(function(e) {
t[e] && (i[e] = t[e],
t[e] = r(i[e]))
}),
Object.defineProperty(t, "innerHTML", Ui(n, {
set: r(n.set)
})),
t.resetSourceWatch_ = function() {
t.resetSourceWatch_ = null,
Object.keys(i).forEach(function(e) {
t[e] = i[e]
}),
Object.defineProperty(t, "innerHTML", n)
}
,
e.one("sourceset", t.resetSourceWatch_)
}
}
, Nh = Object.defineProperty({}, "src", {
get: function() {
return this.hasAttribute("src") ? xc(dr["default"].Element.prototype.getAttribute.call(this, "src")) : ""
},
set: function(e) {
return dr["default"].Element.prototype.setAttribute.call(this, "src", e),
e
}
})
, Mh = function(e) {
return Lh([e.el(), dr["default"].HTMLMediaElement.prototype, Nh], "src")
}
, Rh = function(e) {
if (e.featuresSourceset) {
var t = e.el();
if (!t.resetSourceset_) {
var i = Mh(e)
, n = t.setAttribute
, r = t.load;
Object.defineProperty(t, "src", Ui(i, {
set: function(n) {
var r = i.set.call(t, n);
return e.triggerSourceset(t.src),
r
}
})),
t.setAttribute = function(i, r) {
var a = n.call(t, i, r);
return /src/i.test(i) && e.triggerSourceset(t.src),
a
}
,
t.load = function() {
var i = r.call(t);
return xh(e) || (e.triggerSourceset(""),
Oh(e)),
i
}
,
t.currentSrc ? e.triggerSourceset(t.currentSrc) : xh(e) || Oh(e),
t.resetSourceset_ = function() {
t.resetSourceset_ = null,
t.load = r,
t.setAttribute = n,
Object.defineProperty(t, "src", i),
t.resetSourceWatch_ && t.resetSourceWatch_()
}
}
}
}
, Uh = function(e, t, i, n) {
void 0 === n && (n = !0);
var r = function(i) {
return Object.defineProperty(e, t, {
value: i,
enumerable: !0,
writable: !0
})
}
, a = {
configurable: !0,
enumerable: !0,
get: function() {
var e = i();
return r(e),
e
}
};
return n && (a.set = r),
Object.defineProperty(e, t, a)
}
, Fh = function(e) {
function t(t, i) {
var n;
n = e.call(this, t, i) || this;
var r = t.source
, a = !1;
if (r && (n.el_.currentSrc !== r.src || t.tag && 3 === t.tag.initNetworkState_) ? n.setSource(r) : n.handleLateInit_(n.el_),
t.enableSourceset && n.setupSourcesetHandling_(),
n.el_.hasChildNodes()) {
for (var s = n.el_.childNodes, o = s.length, u = []; o--; ) {
var l = s[o]
, c = l.nodeName.toLowerCase();
"track" === c && (n.featuresNativeTextTracks ? (n.remoteTextTrackEls().addTrackElement_(l),
n.remoteTextTracks().addTrack(l.track),
n.textTracks().addTrack(l.track),
a || n.el_.hasAttribute("crossorigin") || !Lc(l.src) || (a = !0)) : u.push(l))
}
for (var d = 0; d < u.length; d++)
n.el_.removeChild(u[d])
}
return n.proxyNativeTracks_(),
n.featuresNativeTextTracks && a && zu.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),
n.restoreMetadataTracksInIOSNativePlayer_(),
($l || Jl || ql) && t.nativeControlsForTouch === !0 && n.setControls(!0),
n.proxyWebkitFullscreen_(),
n.triggerReady(),
n
}
gr(t, e);
var i = t.prototype;
return i.dispose = function() {
this.el_ && this.el_.resetSourceset_ && this.el_.resetSourceset_(),
t.disposeMediaElement(this.el_),
this.options_ = null,
e.prototype.dispose.call(this)
}
,
i.setupSourcesetHandling_ = function() {
Rh(this)
}
,
i.restoreMetadataTracksInIOSNativePlayer_ = function() {
var e, t = this.textTracks(), i = function() {
e = [];
for (var i = 0; i < t.length; i++) {
var n = t[i];
"metadata" === n.kind && e.push({
track: n,
storedMode: n.mode
})
}
};
i(),
t.addEventListener("change", i),
this.on("dispose", function() {
return t.removeEventListener("change", i)
});
var n = function r() {
for (var i = 0; i < e.length; i++) {
var n = e[i];
"disabled" === n.track.mode && n.track.mode !== n.storedMode && (n.track.mode = n.storedMode)
}
t.removeEventListener("change", r)
};
this.on("webkitbeginfullscreen", function() {
t.removeEventListener("change", i),
t.removeEventListener("change", n),
t.addEventListener("change", n)
}),
this.on("webkitendfullscreen", function() {
t.removeEventListener("change", i),
t.addEventListener("change", i),
t.removeEventListener("change", n)
})
}
,
i.overrideNative_ = function(e, t) {
var i = this;
if (t === this["featuresNative" + e + "Tracks"]) {
var n = e.toLowerCase();
this[n + "TracksListeners_"] && Object.keys(this[n + "TracksListeners_"]).forEach(function(e) {
var t = i.el()[n + "Tracks"];
t.removeEventListener(e, i[n + "TracksListeners_"][e])
}),
this["featuresNative" + e + "Tracks"] = !t,
this[n + "TracksListeners_"] = null,
this.proxyNativeTracksForType_(n)
}
}
,
i.overrideNativeAudioTracks = function(e) {
this.overrideNative_("Audio", e)
}
,
i.overrideNativeVideoTracks = function(e) {
this.overrideNative_("Video", e)
}
,
i.proxyNativeTracksForType_ = function(e) {
var t = this
, i = Hc[e]
, n = this.el()[i.getterName]
, r = this[i.getterName]();
if (this["featuresNative" + i.capitalName + "Tracks"] && n && n.addEventListener) {
var a = {
change: function() {
var i = {
type: "change",
target: r,
currentTarget: r,
srcElement: r
};
r.trigger(i),
"text" === e && t[Wc.remoteText.getterName]().trigger(i)
},
addtrack: function(e) {
r.addTrack(e.track)
},
removetrack: function(e) {
r.removeTrack(e.track)
}
}
, s = function() {
for (var e = [], t = 0; t < r.length; t++) {
for (var i = !1, a = 0; a < n.length; a++)
if (n[a] === r[t]) {
i = !0;
break
}
i || e.push(r[t])
}
for (; e.length; )
r.removeTrack(e.shift())
};
this[i.getterName + "Listeners_"] = a,
Object.keys(a).forEach(function(e) {
var i = a[e];
n.addEventListener(e, i),
t.on("dispose", function() {
return n.removeEventListener(e, i)
})
}),
this.on("loadstart", s),
this.on("dispose", function() {
return t.off("loadstart", s)
})
}
}
,
i.proxyNativeTracks_ = function() {
var e = this;
Hc.names.forEach(function(t) {
e.proxyNativeTracksForType_(t)
})
}
,
i.createEl = function() {
var e = this.options_.tag;
if (!e || !this.options_.playerElIngest && !this.movingMediaElementInDOM) {
if (e) {
var i = e.cloneNode(!0);
e.parentNode && e.parentNode.insertBefore(i, e),
t.disposeMediaElement(e),
e = i
} else {
e = hr["default"].createElement("video");
var n = this.options_.tag && li(this.options_.tag)
, r = Ui({}, n);
$l && this.options_.nativeControlsForTouch === !0 || delete r.controls,
ui(e, Wt(r, {
id: this.options_.techId,
"class": "vjs-tech"
}))
}
e.playerId = this.options_.playerId
}
"undefined" != typeof this.options_.preload && di(e, "preload", this.options_.preload),
void 0 !== this.options_.disablePictureInPicture && (e.disablePictureInPicture = this.options_.disablePictureInPicture);
for (var a = ["loop", "muted", "playsinline", "autoplay"], s = 0; s < a.length; s++) {
var o = a[s]
, u = this.options_[o];
"undefined" != typeof u && (u ? di(e, o, o) : hi(e, o),
e[o] = u)
}
return e
}
,
i.handleLateInit_ = function(e) {
if (0 !== e.networkState && 3 !== e.networkState) {
if (0 === e.readyState) {
var t = !1
, i = function() {
t = !0
};
this.on("loadstart", i);
var n = function() {
t || this.trigger("loadstart")
};
return this.on("loadedmetadata", n),
void this.ready(function() {
this.off("loadstart", i),
this.off("loadedmetadata", n),
t || this.trigger("loadstart")
})
}
var r = ["loadstart"];
r.push("loadedmetadata"),
e.readyState >= 2 && r.push("loadeddata"),
e.readyState >= 3 && r.push("canplay"),
e.readyState >= 4 && r.push("canplaythrough"),
this.ready(function() {
r.forEach(function(e) {
this.trigger(e)
}, this)
})
}
}
,
i.setScrubbing = function(e) {
this.isScrubbing_ = e
}
,
i.setCurrentTime = function(e) {
try {
this.isScrubbing_ && this.el_.fastSeek && ec ? this.el_.fastSeek(e) : this.el_.currentTime = e
} catch (t) {
zu(t, "Video is not ready. (Video.js)")
}
}
,
i.duration = function() {
var e = this;
if (1 / 0 === this.el_.duration && jl && zl && 0 === this.el_.currentTime) {
var t = function i() {
e.el_.currentTime > 0 && (1 / 0 === e.el_.duration && e.trigger("durationchange"),
e.off("timeupdate", i))
};
return this.on("timeupdate", t),
0 / 0
}
return this.el_.duration || 0 / 0
}
,
i.width = function() {
return this.el_.offsetWidth
}
,
i.height = function() {
return this.el_.offsetHeight
}
,
i.proxyWebkitFullscreen_ = function() {
var e = this;
if ("webkitDisplayingFullscreen"in this.el_) {
var t = function() {
this.trigger("fullscreenchange", {
isFullscreen: !1
})
}
, i = function() {
"webkitPresentationMode"in this.el_ && "picture-in-picture" !== this.el_.webkitPresentationMode && (this.one("webkitendfullscreen", t),
this.trigger("fullscreenchange", {
isFullscreen: !0,
nativeIOSFullscreen: !0
}))
};
this.on("webkitbeginfullscreen", i),
this.on("dispose", function() {
e.off("webkitbeginfullscreen", i),
e.off("webkitendfullscreen", t)
})
}
}
,
i.supportsFullScreen = function() {
if ("function" == typeof this.el_.webkitEnterFullScreen) {
var e = dr["default"].navigator && dr["default"].navigator.userAgent || "";
if (/Android/.test(e) || !/Chrome|Mac OS X 10.5/.test(e))
return !0
}
return !1
}
,
i.enterFullScreen = function() {
var e = this.el_;
if (e.paused && e.networkState <= e.HAVE_METADATA)
zi(this.el_.play()),
this.setTimeout(function() {
e.pause();
try {
e.webkitEnterFullScreen()
} catch (t) {
this.trigger("fullscreenerror", t)
}
}, 0);
else
try {
e.webkitEnterFullScreen()
} catch (t) {
this.trigger("fullscreenerror", t)
}
}
,
i.exitFullScreen = function() {
return this.el_.webkitDisplayingFullscreen ? void this.el_.webkitExitFullScreen() : void this.trigger("fullscreenerror", new Error("The video is not fullscreen"))
}
,
i.requestPictureInPicture = function() {
return this.el_.requestPictureInPicture()
}
,
i.src = function(e) {
return void 0 === e ? this.el_.src : void this.setSrc(e)
}
,
i.reset = function() {
t.resetMediaElement(this.el_)
}
,
i.currentSrc = function() {
return this.currentSource_ ? this.currentSource_.src : this.el_.currentSrc
}
,
i.setControls = function(e) {
this.el_.controls = !!e
}
,
i.addTextTrack = function(t, i, n) {
return this.featuresNativeTextTracks ? this.el_.addTextTrack(t, i, n) : e.prototype.addTextTrack.call(this, t, i, n)
}
,
i.createRemoteTextTrack = function(t) {
if (!this.featuresNativeTextTracks)
return e.prototype.createRemoteTextTrack.call(this, t);
var i = hr["default"].createElement("track");
return t.kind && (i.kind = t.kind),
t.label && (i.label = t.label),
(t.language || t.srclang) && (i.srclang = t.language || t.srclang),
t["default"] && (i["default"] = t["default"]),
t.id && (i.id = t.id),
t.src && (i.src = t.src),
i
}
,
i.addRemoteTextTrack = function(t, i) {
var n = e.prototype.addRemoteTextTrack.call(this, t, i);
return this.featuresNativeTextTracks && this.el().appendChild(n),
n
}
,
i.removeRemoteTextTrack = function(t) {
if (e.prototype.removeRemoteTextTrack.call(this, t),
this.featuresNativeTextTracks)
for (var i = this.$$("track"), n = i.length; n--; )
(t === i[n] || t === i[n].track) && this.el().removeChild(i[n])
}
,
i.getVideoPlaybackQuality = function() {
if ("function" == typeof this.el().getVideoPlaybackQuality)
return this.el().getVideoPlaybackQuality();
var e = {};
return "undefined" != typeof this.el().webkitDroppedFrameCount && "undefined" != typeof this.el().webkitDecodedFrameCount && (e.droppedVideoFrames = this.el().webkitDroppedFrameCount,
e.totalVideoFrames = this.el().webkitDecodedFrameCount),
dr["default"].performance && "function" == typeof dr["default"].performance.now ? e.creationTime = dr["default"].performance.now() : dr["default"].performance && dr["default"].performance.timing && "number" == typeof dr["default"].performance.timing.navigationStart && (e.creationTime = dr["default"].Date.now() - dr["default"].performance.timing.navigationStart),
e
}
,
t
}(Gc);
Uh(Fh, "TEST_VID", function() {
if (Qt()) {
var e = hr["default"].createElement("video")
, t = hr["default"].createElement("track");
return t.kind = "captions",
t.srclang = "en",
t.label = "English",
e.appendChild(t),
e
}
}),
Fh.isSupported = function() {
try {
Fh.TEST_VID.volume = .5
} catch (e) {
return !1
}
return !(!Fh.TEST_VID || !Fh.TEST_VID.canPlayType)
}
,
Fh.canPlayType = function(e) {
return Fh.TEST_VID.canPlayType(e)
}
,
Fh.canPlaySource = function(e) {
return Fh.canPlayType(e.type)
}
,
Fh.canControlVolume = function() {
try {
var e = Fh.TEST_VID.volume;
return Fh.TEST_VID.volume = e / 2 + .1,
e !== Fh.TEST_VID.volume
} catch (t) {
return !1
}
}
,
Fh.canMuteVolume = function() {
try {
var e = Fh.TEST_VID.muted;
return Fh.TEST_VID.muted = !e,
Fh.TEST_VID.muted ? di(Fh.TEST_VID, "muted", "muted") : hi(Fh.TEST_VID, "muted", "muted"),
e !== Fh.TEST_VID.muted
} catch (t) {
return !1
}
}
,
Fh.canControlPlaybackRate = function() {
if (jl && zl && 58 > Gl)
return !1;
try {
var e = Fh.TEST_VID.playbackRate;
return Fh.TEST_VID.playbackRate = e / 2 + .1,
e !== Fh.TEST_VID.playbackRate
} catch (t) {
return !1
}
}
,
Fh.canOverrideAttributes = function() {
try {
var e = function() {};
Object.defineProperty(hr["default"].createElement("video"), "src", {
get: e,
set: e
}),
Object.defineProperty(hr["default"].createElement("audio"), "src", {
get: e,
set: e
}),
Object.defineProperty(hr["default"].createElement("video"), "innerHTML", {
get: e,
set: e
}),
Object.defineProperty(hr["default"].createElement("audio"), "innerHTML", {
get: e,
set: e
})
} catch (t) {
return !1
}
return !0
}
,
Fh.supportsNativeTextTracks = function() {
return ec || Zl && zl
}
,
Fh.supportsNativeVideoTracks = function() {
return !(!Fh.TEST_VID || !Fh.TEST_VID.videoTracks)
}
,
Fh.supportsNativeAudioTracks = function() {
return !(!Fh.TEST_VID || !Fh.TEST_VID.audioTracks)
}
,
Fh.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange"],
[["featuresVolumeControl", "canControlVolume"], ["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function(e) {
var t = e[0]
, i = e[1];
Uh(Fh.prototype, t, function() {
return Fh[i]()
}, !0)
}),
Fh.prototype.movingMediaElementInDOM = !Zl,
Fh.prototype.featuresFullscreenResize = !0,
Fh.prototype.featuresProgressEvents = !0,
Fh.prototype.featuresTimeupdateEvents = !0;
var Bh;
Fh.patchCanPlayType = function() {
Vl >= 4 && !Hl && !zl && (Bh = Fh.TEST_VID && Fh.TEST_VID.constructor.prototype.canPlayType,
Fh.TEST_VID.constructor.prototype.canPlayType = function(e) {
var t = /^application\/(?:x-|vnd\.apple\.)mpegurl/i;
return e && t.test(e) ? "maybe" : Bh.call(this, e)
}
)
}
,
Fh.unpatchCanPlayType = function() {
var e = Fh.TEST_VID.constructor.prototype.canPlayType;
return Bh && (Fh.TEST_VID.constructor.prototype.canPlayType = Bh),
e
}
,
Fh.patchCanPlayType(),
Fh.disposeMediaElement = function(e) {
if (e) {
for (e.parentNode && e.parentNode.removeChild(e); e.hasChildNodes(); )
e.removeChild(e.firstChild);
e.removeAttribute("src"),
"function" == typeof e.load && !function() {
try {
e.load()
} catch (t) {}
}()
}
}
,
Fh.resetMediaElement = function(e) {
if (e) {
for (var t = e.querySelectorAll("source"), i = t.length; i--; )
e.removeChild(t[i]);
e.removeAttribute("src"),
"function" == typeof e.load && !function() {
try {
e.load()
} catch (t) {}
}()
}
}
,
["muted", "defaultMuted", "autoplay", "controls", "loop", "playsinline"].forEach(function(e) {
Fh.prototype[e] = function() {
return this.el_[e] || this.el_.hasAttribute(e)
}
}),
["muted", "defaultMuted", "autoplay", "loop", "playsinline"].forEach(function(e) {
Fh.prototype["set" + Il(e)] = function(t) {
this.el_[e] = t,
t ? this.el_.setAttribute(e, e) : this.el_.removeAttribute(e)
}
}),
["paused", "currentTime", "buffered", "volume", "poster", "preload", "error", "seeking", "seekable", "ended", "playbackRate", "defaultPlaybackRate", "disablePictureInPicture", "played", "networkState", "readyState", "videoWidth", "videoHeight", "crossOrigin"].forEach(function(e) {
Fh.prototype[e] = function() {
return this.el_[e]
}
}),
["volume", "src", "poster", "preload", "playbackRate", "defaultPlaybackRate", "disablePictureInPicture", "crossOrigin"].forEach(function(e) {
Fh.prototype["set" + Il(e)] = function(t) {
this.el_[e] = t
}
}),
["pause", "load", "play"].forEach(function(e) {
Fh.prototype[e] = function() {
return this.el_[e]()
}
}),
Gc.withSourceHandlers(Fh),
Fh.nativeSourceHandler = {},
Fh.nativeSourceHandler.canPlayType = function(e) {
try {
return Fh.TEST_VID.canPlayType(e)
} catch (t) {
return ""
}
}
,
Fh.nativeSourceHandler.canHandleSource = function(e) {
if (e.type)
return Fh.nativeSourceHandler.canPlayType(e.type);
if (e.src) {
var t = Pc(e.src);
return Fh.nativeSourceHandler.canPlayType("video/" + t)
}
return ""
}
,
Fh.nativeSourceHandler.handleSource = function(e, t) {
t.setSrc(e.src)
}
,
Fh.nativeSourceHandler.dispose = function() {}
,
Fh.registerSourceHandler(Fh.nativeSourceHandler),
Gc.registerTech("Html5", Fh);
var jh = ["progress", "abort", "suspend", "emptied", "stalled", "loadedmetadata", "loadeddata", "timeupdate", "resize", "volumechange", "texttrackchange"]
, Vh = {
canplay: "CanPlay",
canplaythrough: "CanPlayThrough",
playing: "Playing",
seeked: "Seeked"
}
, qh = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"]
, Hh = {};
qh.forEach(function(e) {
var t = "x" === e.charAt(0) ? "x-" + e.substring(1) : e;
Hh[e] = "vjs-layout-" + t
});
var Wh = {
tiny: 210,
xsmall: 320,
small: 425,
medium: 768,
large: 1440,
xlarge: 2560,
huge: 1 / 0
}
, zh = function(e) {
function t(i, n, r) {
var a;
if (i.id = i.id || n.id || "vjs_video_" + wi(),
n = Wt(t.getTagSettings(i), n),
n.initChildren = !1,
n.createEl = !1,
n.evented = !1,
n.reportTouchActivity = !1,
!n.language)
if ("function" == typeof i.closest) {
var s = i.closest("[lang]");
s && s.getAttribute && (n.language = s.getAttribute("lang"))
} else
for (var o = i; o && 1 === o.nodeType; ) {
if (li(o).hasOwnProperty("lang")) {
n.language = o.getAttribute("lang");
break
}
o = o.parentNode
}
if (a = e.call(this, null, n, r) || this,
a.boundDocumentFullscreenChange_ = dl(mr(a), a.documentFullscreenChange_),
a.boundFullWindowOnEscKey_ = dl(mr(a), a.fullWindowOnEscKey),
a.isFullscreen_ = !1,
a.log = Gu(a.id_),
a.fsApi_ = ic,
a.isPosterFromTech_ = !1,
a.queuedCallbacks_ = [],
a.isReady_ = !1,
a.hasStarted_ = !1,
a.userActive_ = !1,
a.debugEnabled_ = !1,
!a.options_ || !a.options_.techOrder || !a.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 (a.tag = i,
a.tagAttributes = i && li(i),
a.language(a.options_.language),
n.languages) {
var u = {};
Object.getOwnPropertyNames(n.languages).forEach(function(e) {
u[e.toLowerCase()] = n.languages[e]
}),
a.languages_ = u
} else
a.languages_ = t.prototype.options_.languages;
a.resetCache_(),
a.poster_ = n.poster || "",
a.controls_ = !!n.controls,
i.controls = !1,
i.removeAttribute("controls"),
a.changingSrc_ = !1,
a.playCallbacks_ = [],
a.playTerminatedQueue_ = [],
a.autoplay(i.hasAttribute("autoplay") ? !0 : a.options_.autoplay),
n.plugins && Object.keys(n.plugins).forEach(function(e) {
if ("function" != typeof a[e])
throw new Error('plugin "' + e + '" does not exist')
}),
a.scrubbing_ = !1,
a.el_ = a.createEl(),
Mi(mr(a), {
eventBusKey: "el_"
}),
a.fsApi_.requestFullscreen && (Pi(hr["default"], a.fsApi_.fullscreenchange, a.boundDocumentFullscreenChange_),
a.on(a.fsApi_.fullscreenchange, a.boundDocumentFullscreenChange_)),
a.fluid_ && a.on("playerreset", a.updateStyleEl_);
var l = Ui(a.options_);
n.plugins && Object.keys(n.plugins).forEach(function(e) {
a[e](n.plugins[e])
}),
n.debug && a.debug(!0),
a.options_.playerOptions = l,
a.middleware_ = [],
a.initChildren(),
a.isAudio("audio" === i.nodeName.toLowerCase()),
a.addClass(a.controls() ? "vjs-controls-enabled" : "vjs-controls-disabled"),
a.el_.setAttribute("role", "region"),
a.isAudio() ? a.el_.setAttribute("aria-label", a.localize("Audio Player")) : a.el_.setAttribute("aria-label", a.localize("Video Player")),
a.isAudio() && a.addClass("vjs-audio"),
a.flexNotSupported_() && a.addClass("vjs-no-flex"),
$l && a.addClass("vjs-touch-enabled"),
Zl || a.addClass("vjs-workinghover"),
t.players[a.id_] = mr(a);
var c = qu.split(".")[0];
return a.addClass("vjs-v" + c),
a.userActive(!0),
a.reportUserActivity(),
a.one("play", a.listenForUserActivity_),
a.on("stageclick", a.handleStageClick_),
a.on("keydown", a.handleKeyDown),
a.breakpoints(a.options_.breakpoints),
a.responsive(a.options_.responsive),
a
}
gr(t, e);
var i = t.prototype;
return i.dispose = function() {
var i = this;
this.trigger("dispose"),
this.off("dispose"),
Li(hr["default"], this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_),
Li(hr["default"], "keydown", this.boundFullWindowOnEscKey_),
this.styleEl_ && this.styleEl_.parentNode && (this.styleEl_.parentNode.removeChild(this.styleEl_),
this.styleEl_ = null),
t.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),
tn(this),
zc.names.forEach(function(e) {
var t = zc[e]
, n = i[t.getterName]();
n && n.off && n.off()
}),
e.prototype.dispose.call(this)
}
,
i.createEl = function() {
var t, i = this.tag, n = this.playerElIngest_ = i.parentNode && i.parentNode.hasAttribute && i.parentNode.hasAttribute("data-vjs-player"), r = "video-js" === this.tag.tagName.toLowerCase();
n ? t = this.el_ = i.parentNode : r || (t = this.el_ = e.prototype.createEl.call(this, "div"));
var a = li(i);
if (r) {
for (t = this.el_ = i,
i = this.tag = hr["default"].createElement("video"); t.children.length; )
i.appendChild(t.firstChild);
ri(t, "video-js") || ai(t, "video-js"),
t.appendChild(i),
n = this.playerElIngest_ = t,
Object.keys(t).forEach(function(e) {
try {
i[e] = t[e]
} catch (n) {}
})
}
if (i.setAttribute("tabindex", "-1"),
a.tabindex = "-1",
(Xl || zl && Yl) && (i.setAttribute("role", "application"),
a.role = "application"),
i.removeAttribute("width"),
i.removeAttribute("height"),
"width"in a && delete a.width,
"height"in a && delete a.height,
Object.getOwnPropertyNames(a).forEach(function(e) {
r && "class" === e || t.setAttribute(e, a[e]),
r && i.setAttribute(e, a[e])
}),
i.playerId = i.id,
i.id += "_html5_api",
i.className = "vjs-tech",
i.player = t.player = this,
this.addClass("vjs-paused"),
dr["default"].VIDEOJS_NO_DYNAMIC_STYLE !== !0) {
this.styleEl_ = tl("vjs-styles-dimensions");
var s = Yu(".vjs-styles-defaults")
, o = Yu("head");
o.insertBefore(this.styleEl_, s ? s.nextSibling : o.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),
this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
for (var u = i.getElementsByTagName("a"), l = 0; l < u.length; l++) {
var c = u.item(l);
ai(c, "vjs-hidden"),
c.setAttribute("hidden", "hidden")
}
return i.initNetworkState_ = i.networkState,
i.parentNode && !n && i.parentNode.insertBefore(t, i),
ni(i, t),
this.children_.unshift(i),
this.el_.setAttribute("lang", this.language_),
this.el_ = t,
t
}
,
i.crossOrigin = function(e) {
return e ? "anonymous" !== e && "use-credentials" !== e ? void zu.warn('crossOrigin must be "anonymous" or "use-credentials", given "' + e + '"') : void this.techCall_("setCrossOrigin", e) : this.techGet_("crossOrigin")
}
,
i.width = function(e) {
return this.dimension("width", e)
}
,
i.height = function(e) {
return this.dimension("height", e)
}
,
i.dimension = function(e, t) {
var i = e + "_";
if (void 0 === t)
return this[i] || 0;
if ("" === t || "auto" === t)
return this[i] = void 0,
void this.updateStyleEl_();
var n = parseFloat(t);
return isNaN(n) ? void zu.error('Improper value "' + t + '" supplied for for ' + e) : (this[i] = n,
void this.updateStyleEl_())
}
,
i.fluid = function(e) {
return void 0 === e ? !!this.fluid_ : (this.fluid_ = !!e,
gl(this) && this.off("playerreset", this.updateStyleEl_),
e ? (this.addClass("vjs-fluid"),
this.fill(!1),
vl(function() {
this.on("playerreset", this.updateStyleEl_)
})) : this.removeClass("vjs-fluid"),
void this.updateStyleEl_())
}
,
i.fill = function(e) {
return void 0 === e ? !!this.fill_ : (this.fill_ = !!e,
void (e ? (this.addClass("vjs-fill"),
this.fluid(!1)) : this.removeClass("vjs-fill")))
}
,
i.aspectRatio = function(e) {
if (void 0 === e)
return this.aspectRatio_;
if (!/^\d+\:\d+$/.test(e))
throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
this.aspectRatio_ = e,
this.fluid(!0),
this.updateStyleEl_()
}
,
i.updateStyleEl_ = function() {
if (dr["default"].VIDEOJS_NO_DYNAMIC_STYLE === !0) {
var e = "number" == typeof this.width_ ? this.width_ : this.options_.width
, t = "number" == typeof this.height_ ? this.height_ : this.options_.height
, i = this.tech_ && this.tech_.el();
return void (i && (e >= 0 && (i.width = e),
t >= 0 && (i.height = t)))
}
var n, r, a, s;
a = void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this.videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9";
var o = a.split(":")
, u = o[1] / o[0];
n = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / u : this.videoWidth() || 300,
r = void 0 !== this.height_ ? this.height_ : n * u,
s = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions",
this.addClass(s),
il(this.styleEl_, "\n ." + s + " {\n width: " + n + "px;\n height: " + r + "px;\n }\n\n ." + s + ".vjs-fluid {\n padding-top: " + 100 * u + "%;\n }\n ")
}
,
i.loadTech_ = function(e, t) {
var i = this;
this.tech_ && this.unloadTech_();
var n = Il(e)
, r = e.charAt(0).toLowerCase() + e.slice(1);
"Html5" !== n && this.tag && (Gc.getTech("Html5").disposeMediaElement(this.tag),
this.tag.player = null,
this.tag = null),
this.techName_ = n,
this.isReady_ = !1;
var a = "string" == typeof this.autoplay() ? !1 : this.autoplay()
, s = {
source: t,
autoplay: a,
nativeControlsForTouch: this.options_.nativeControlsForTouch,
playerId: this.id(),
techId: this.id() + "_" + r + "_api",
playsinline: this.options_.playsinline,
preload: this.options_.preload,
loop: this.options_.loop,
disablePictureInPicture: this.options_.disablePictureInPicture,
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,
Promise: this.options_.Promise
};
zc.names.forEach(function(e) {
var t = zc[e];
s[t.getterName] = i[t.privateName]
}),
Wt(s, this.options_[n]),
Wt(s, this.options_[r]),
Wt(s, this.options_[e.toLowerCase()]),
this.tag && (s.tag = this.tag),
t && t.src === this.cache_.src && this.cache_.currentTime > 0 && (s.startTime = this.cache_.currentTime);
var o = Gc.getTech(e);
if (!o)
throw new Error("No Tech named '" + n + "' exists! '" + n + "' should be registered using videojs.registerTech()'");
this.tech_ = new o(s),
this.tech_.ready(dl(this, this.handleTechReady_), !0),
dc.jsonToTextTracks(this.textTracksJson_ || [], this.tech_),
jh.forEach(function(e) {
i.on(i.tech_, e, i["handleTech" + Il(e) + "_"])
}),
Object.keys(Vh).forEach(function(e) {
i.on(i.tech_, e, function(t) {
return 0 === i.tech_.playbackRate() && i.tech_.seeking() ? void i.queuedCallbacks_.push({
callback: i["handleTech" + Vh[e] + "_"].bind(i),
event: t
}) : void i["handleTech" + Vh[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_, "fullscreenerror", this.handleTechFullscreenError_),
this.on(this.tech_, "enterpictureinpicture", this.handleTechEnterPictureInPicture_),
this.on(this.tech_, "leavepictureinpicture", this.handleTechLeavePictureInPicture_),
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 || ni(this.tech_.el(), this.el()),
this.tag && (this.tag.player = null,
this.tag = null)
}
,
i.unloadTech_ = function() {
var e = this;
zc.names.forEach(function(t) {
var i = zc[t];
e[i.privateName] = e[i.getterName]()
}),
this.textTracksJson_ = dc.textTracksToJson(this.tech_),
this.isReady_ = !1,
this.tech_.dispose(),
this.tech_ = !1,
this.isPosterFromTech_ && (this.poster_ = "",
this.trigger("posterchange")),
this.isPosterFromTech_ = !1
}
,
i.tech = function(e) {
return void 0 === e && zu.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),
this.tech_
}
,
i.addTechControlsListeners_ = function() {
this.removeTechControlsListeners_(),
this.on(this.tech_, "mouseup", 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_)
}
,
i.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_, "mouseup", this.handleTechClick_),
this.off(this.tech_, "dblclick", this.handleTechDoubleClick_)
}
,
i.handleTechReady_ = function() {
this.triggerReady(),
this.cache_.volume && this.techCall_("setVolume", this.cache_.volume),
this.handleTechPosterChange_(),
this.handleTechDurationChange_()
}
,
i.handleTechLoadStart_ = function() {
this.removeClass("vjs-ended"),
this.removeClass("vjs-seeking"),
this.error(null),
this.handleTechDurationChange_(),
this.paused() ? (this.hasStarted(!1),
this.trigger("loadstart")) : (this.trigger("loadstart"),
this.trigger("firstplay")),
this.manualAutoplay_(this.autoplay())
}
,
i.manualAutoplay_ = function(e) {
var t = this;
if (this.tech_ && "string" == typeof e) {
var i, n = function() {
var e = t.muted();
t.muted(!0);
var i = function() {
t.muted(e)
};
t.playTerminatedQueue_.push(i);
var n = t.play();
if (Wi(n))
return n["catch"](i)
};
if ("any" === e && this.muted() !== !0 ? (i = this.play(),
Wi(i) && (i = i["catch"](n))) : i = "muted" === e && this.muted() !== !0 ? n() : this.play(),
Wi(i))
return i.then(function() {
t.trigger({
type: "autoplay-success",
autoplay: e
})
})["catch"](function() {
t.trigger({
type: "autoplay-failure",
autoplay: e
})
})
}
}
,
i.updateSourceCaches_ = function(e) {
void 0 === e && (e = "");
var t = e
, i = "";
"string" != typeof t && (t = e.src,
i = e.type),
this.cache_.source = this.cache_.source || {},
this.cache_.sources = this.cache_.sources || [],
t && !i && (i = td(this, t)),
this.cache_.source = Ui({}, e, {
src: t,
type: i
});
for (var n = this.cache_.sources.filter(function(e) {
return e.src && e.src === t
}), r = [], a = this.$$("source"), s = [], o = 0; o < a.length; o++) {
var u = li(a[o]);
r.push(u),
u.src && u.src === t && s.push(u.src)
}
s.length && !n.length ? this.cache_.sources = r : n.length || (this.cache_.sources = [this.cache_.source]),
this.cache_.src = t
}
,
i.handleTechSourceset_ = function(e) {
var t = this;
if (!this.changingSrc_) {
var i = function(e) {
return t.updateSourceCaches_(e)
}
, n = this.currentSource().src
, r = e.src;
n && !/^blob:/.test(n) && /^blob:/.test(r) && (!this.lastSource_ || this.lastSource_.tech !== r && this.lastSource_.player !== n) && (i = function() {}
),
i(r),
e.src || this.tech_.any(["sourceset", "loadstart"], function(e) {
if ("sourceset" !== e.type) {
var i = t.techGet("currentSrc");
t.lastSource_.tech = i,
t.updateSourceCaches_(i)
}
})
}
this.lastSource_ = {
player: this.currentSource().src,
tech: e.src
},
this.trigger({
src: e.src,
type: "sourceset"
})
}
,
i.hasStarted = function(e) {
return void 0 === e ? this.hasStarted_ : void (e !== this.hasStarted_ && (this.hasStarted_ = e,
this.hasStarted_ ? (this.addClass("vjs-has-started"),
this.trigger("firstplay")) : this.removeClass("vjs-has-started")))
}
,
i.handleTechPlay_ = function() {
this.removeClass("vjs-ended"),
this.removeClass("vjs-paused"),
this.addClass("vjs-playing"),
this.hasStarted(!0),
this.trigger("play")
}
,
i.handleTechRateChange_ = function() {
this.tech_.playbackRate() > 0 && 0 === this.cache_.lastPlaybackRate && (this.queuedCallbacks_.forEach(function(e) {
return e.callback(e.event)
}),
this.queuedCallbacks_ = []),
this.cache_.lastPlaybackRate = this.tech_.playbackRate(),
this.trigger("ratechange")
}
,
i.handleTechWaiting_ = function() {
var e = this;
this.addClass("vjs-waiting"),
this.trigger("waiting");
var t = this.currentTime()
, i = function n() {
t !== e.currentTime() && (e.removeClass("vjs-waiting"),
e.off("timeupdate", n))
};
this.on("timeupdate", i)
}
,
i.handleTechCanPlay_ = function() {
this.removeClass("vjs-waiting"),
this.trigger("canplay")
}
,
i.handleTechCanPlayThrough_ = function() {
this.removeClass("vjs-waiting"),
this.trigger("canplaythrough")
}
,
i.handleTechPlaying_ = function() {
this.removeClass("vjs-waiting"),
this.trigger("playing")
}
,
i.handleTechSeeking_ = function() {
this.addClass("vjs-seeking"),
this.trigger("seeking")
}
,
i.handleTechSeeked_ = function() {
this.removeClass("vjs-seeking"),
this.removeClass("vjs-ended"),
this.trigger("seeked")
}
,
i.handleTechFirstPlay_ = function() {
this.options_.starttime && (zu.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")
}
,
i.handleTechPause_ = function() {
this.removeClass("vjs-playing"),
this.addClass("vjs-paused"),
this.trigger("pause")
}
,
i.handleTechEnded_ = function() {
this.addClass("vjs-ended"),
this.options_.loop ? (this.currentTime(0),
this.play()) : this.paused() || this.pause(),
this.trigger("ended")
}
,
i.handleTechDurationChange_ = function() {
this.duration(this.techGet_("duration"))
}
,
i.handleTechClick_ = function(e) {
Ci(e) && this.controls_ && (this.paused() ? zi(this.play()) : this.pause())
}
,
i.handleTechDoubleClick_ = function(e) {
if (this.controls_) {
var t = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), function(t) {
return t.contains(e.target)
});
t || (void 0 === this.options_ || void 0 === this.options_.userActions || void 0 === this.options_.userActions.doubleClick || this.options_.userActions.doubleClick !== !1) && (void 0 !== this.options_ && void 0 !== this.options_.userActions && "function" == typeof this.options_.userActions.doubleClick ? this.options_.userActions.doubleClick.call(this, e) : this.isFullscreen() ? this.exitFullscreen() : this.requestFullscreen())
}
}
,
i.handleTechTap_ = function() {
this.userActive(!this.userActive())
}
,
i.handleTechTouchStart_ = function() {
this.userWasActive = this.userActive()
}
,
i.handleTechTouchMove_ = function() {
this.userWasActive && this.reportUserActivity()
}
,
i.handleTechTouchEnd_ = function(e) {
e.preventDefault()
}
,
i.handleStageClick_ = function() {
this.reportUserActivity()
}
,
i.toggleFullscreenClass_ = function() {
this.isFullscreen() ? this.addClass("vjs-fullscreen") : this.removeClass("vjs-fullscreen")
}
,
i.documentFullscreenChange_ = function(e) {
var t = e.target.player;
if (!t || t === this) {
var i = this.el()
, n = hr["default"][this.fsApi_.fullscreenElement] === i;
!n && i.matches ? n = i.matches(":" + this.fsApi_.fullscreen) : !n && i.msMatchesSelector && (n = i.msMatchesSelector(":" + this.fsApi_.fullscreen)),
this.isFullscreen(n)
}
}
,
i.handleTechFullscreenChange_ = function(e, t) {
t && (t.nativeIOSFullscreen && this.toggleClass("vjs-ios-native-fs"),
this.isFullscreen(t.isFullscreen))
}
,
i.handleTechFullscreenError_ = function(e, t) {
this.trigger("fullscreenerror", t)
}
,
i.togglePictureInPictureClass_ = function() {
this.isInPictureInPicture() ? this.addClass("vjs-picture-in-picture") : this.removeClass("vjs-picture-in-picture")
}
,
i.handleTechEnterPictureInPicture_ = function() {
this.isInPictureInPicture(!0)
}
,
i.handleTechLeavePictureInPicture_ = function() {
this.isInPictureInPicture(!1)
}
,
i.handleTechError_ = function() {
var e = this.tech_.error();
this.error(e)
}
,
i.handleTechTextData_ = function() {
var e = null;
arguments.length > 1 && (e = arguments[1]),
this.trigger("textdata", e)
}
,
i.getCache = function() {
return this.cache_
}
,
i.resetCache_ = function() {
this.cache_ = {
currentTime: 0,
initTime: 0,
inactivityTimeout: this.options_.inactivityTimeout,
duration: 0 / 0,
lastVolume: 1,
lastPlaybackRate: this.defaultPlaybackRate(),
media: null,
src: "",
source: {},
sources: [],
volume: 1
}
}
,
i.techCall_ = function(e, t) {
this.ready(function() {
if (e in Qc)
return Qi(this.middleware_, this.tech_, e, t);
if (e in Jc)
return Ji(this.middleware_, this.tech_, e, t);
try {
this.tech_ && this.tech_[e](t)
} catch (i) {
throw zu(i),
i
}
}, !0)
}
,
i.techGet_ = function(e) {
if (this.tech_ && this.tech_.isReady_) {
if (e in $c)
return $i(this.middleware_, this.tech_, e);
if (e in Jc)
return Ji(this.middleware_, this.tech_, e);
try {
return this.tech_[e]()
} catch (t) {
if (void 0 === this.tech_[e])
throw zu("Video.js: " + e + " method not defined for " + this.techName_ + " playback technology.", t),
t;
if ("TypeError" === t.name)
throw zu("Video.js: " + e + " unavailable on " + this.techName_ + " playback technology element.", t),
this.tech_.isReady_ = !1,
t;
throw zu(t),
t
}
}
}
,
i.play = function() {
var e = this
, t = this.options_.Promise || dr["default"].Promise;
return t ? new t(function(t) {
e.play_(t)
}
) : this.play_()
}
,
i.play_ = function(e) {
var t = this;
void 0 === e && (e = zi),
this.playCallbacks_.push(e);
var i = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
if (this.waitToPlay_ && (this.off(["ready", "loadstart"], this.waitToPlay_),
this.waitToPlay_ = null),
!this.isReady_ || !i)
return this.waitToPlay_ = function() {
t.play_()
}
,
this.one(["ready", "loadstart"], this.waitToPlay_),
void (i || !ec && !Zl || this.load());
var n = this.techGet_("play");
null === n ? this.runPlayTerminatedQueue_() : this.runPlayCallbacks_(n)
}
,
i.runPlayTerminatedQueue_ = function() {
var e = this.playTerminatedQueue_.slice(0);
this.playTerminatedQueue_ = [],
e.forEach(function(e) {
e()
})
}
,
i.runPlayCallbacks_ = function(e) {
var t = this.playCallbacks_.slice(0);
this.playCallbacks_ = [],
this.playTerminatedQueue_ = [],
t.forEach(function(t) {
t(e)
})
}
,
i.pause = function() {
this.techCall_("pause")
}
,
i.paused = function() {
return this.techGet_("paused") === !1 ? !1 : !0
}
,
i.played = function() {
return this.techGet_("played") || Vi(0, 0)
}
,
i.scrubbing = function(e) {
return "undefined" == typeof e ? this.scrubbing_ : (this.scrubbing_ = !!e,
this.techCall_("setScrubbing", this.scrubbing_),
void (e ? this.addClass("vjs-scrubbing") : this.removeClass("vjs-scrubbing")))
}
,
i.currentTime = function(e) {
return "undefined" != typeof e ? (0 > e && (e = 0),
this.isReady_ && !this.changingSrc_ && this.tech_ && this.tech_.isReady_ ? (this.techCall_("setCurrentTime", e),
void (this.cache_.initTime = 0)) : (this.cache_.initTime = e,
this.off("canplay", this.applyInitTime_),
void this.one("canplay", this.applyInitTime_))) : (this.cache_.currentTime = this.techGet_("currentTime") || 0,
this.cache_.currentTime)
}
,
i.applyInitTime_ = function() {
this.currentTime(this.cache_.initTime)
}
,
i.duration = function(e) {
return void 0 === e ? void 0 !== this.cache_.duration ? this.cache_.duration : 0 / 0 : (e = parseFloat(e),
0 > e && (e = 1 / 0),
void (e !== this.cache_.duration && (this.cache_.duration = e,
1 / 0 === e ? this.addClass("vjs-live") : this.removeClass("vjs-live"),
isNaN(e) || this.trigger("durationchange"))))
}
,
i.remainingTime = function() {
return this.duration() - this.currentTime()
}
,
i.remainingTimeDisplay = function() {
return Math.floor(this.duration()) - Math.floor(this.currentTime())
}
,
i.buffered = function n() {
var n = this.techGet_("buffered");
return n && n.length || (n = Vi(0, 0)),
n
}
,
i.bufferedPercent = function() {
return qi(this.buffered(), this.duration())
}
,
i.bufferedEnd = function() {
var e = this.buffered()
, t = this.duration()
, i = e.end(e.length - 1);
return i > t && (i = t),
i
}
,
i.volume = function(e) {
var t;
return void 0 !== e ? (t = Math.max(0, Math.min(1, parseFloat(e))),
this.cache_.volume = t,
this.techCall_("setVolume", t),
void (t > 0 && this.lastVolume_(t))) : (t = parseFloat(this.techGet_("volume")),
isNaN(t) ? 1 : t)
}
,
i.muted = function(e) {
return void 0 !== e ? void this.techCall_("setMuted", e) : this.techGet_("muted") || !1
}
,
i.defaultMuted = function(e) {
return void 0 !== e ? this.techCall_("setDefaultMuted", e) : this.techGet_("defaultMuted") || !1
}
,
i.lastVolume_ = function(e) {
return void 0 !== e && 0 !== e ? void (this.cache_.lastVolume = e) : this.cache_.lastVolume
}
,
i.supportsFullScreen = function() {
return this.techGet_("supportsFullScreen") || !1
}
,
i.isFullscreen = function(e) {
if (void 0 !== e) {
var t = this.isFullscreen_;
return this.isFullscreen_ = Boolean(e),
this.isFullscreen_ !== t && this.fsApi_.prefixed && this.trigger("fullscreenchange"),
void this.toggleFullscreenClass_()
}
return this.isFullscreen_
}
,
i.requestFullscreen = function(e) {
var t = this.options_.Promise || dr["default"].Promise;
if (t) {
var i = this;
return new t(function(t, n) {
function r() {
i.off("fullscreenerror", s),
i.off("fullscreenchange", a)
}
function a() {
r(),
t()
}
function s(e, t) {
r(),
n(t)
}
i.one("fullscreenchange", a),
i.one("fullscreenerror", s);
var o = i.requestFullscreenHelper_(e);
return o ? (o.then(r, r),
o) : void 0
}
)
}
return this.requestFullscreenHelper_()
}
,
i.requestFullscreenHelper_ = function(e) {
var t, i = this;
if (this.fsApi_.prefixed || (t = this.options_.fullscreen && this.options_.fullscreen.options || {},
void 0 !== e && (t = e)),
this.fsApi_.requestFullscreen) {
var n = this.el_[this.fsApi_.requestFullscreen](t);
return n && n.then(function() {
return i.isFullscreen(!0)
}, function() {
return i.isFullscreen(!1)
}),
n
}
this.tech_.supportsFullScreen() ? this.techCall_("enterFullScreen") : this.enterFullWindow()
}
,
i.exitFullscreen = function() {
var e = this.options_.Promise || dr["default"].Promise;
if (e) {
var t = this;
return new e(function(e, i) {
function n() {
t.off("fullscreenerror", a),
t.off("fullscreenchange", r)
}
function r() {
n(),
e()
}
function a(e, t) {
n(),
i(t)
}
t.one("fullscreenchange", r),
t.one("fullscreenerror", a);
var s = t.exitFullscreenHelper_();
return s ? (s.then(n, n),
s) : void 0
}
)
}
return this.exitFullscreenHelper_()
}
,
i.exitFullscreenHelper_ = function() {
var e = this;
if (this.fsApi_.requestFullscreen) {
var t = hr["default"][this.fsApi_.exitFullscreen]();
return t && t.then(function() {
return e.isFullscreen(!1)
}),
t
}
this.tech_.supportsFullScreen() ? this.techCall_("exitFullScreen") : this.exitFullWindow()
}
,
i.enterFullWindow = function() {
this.isFullscreen(!0),
this.isFullWindow = !0,
this.docOrigOverflow = hr["default"].documentElement.style.overflow,
Pi(hr["default"], "keydown", this.boundFullWindowOnEscKey_),
hr["default"].documentElement.style.overflow = "hidden",
ai(hr["default"].body, "vjs-full-window"),
this.trigger("enterFullWindow")
}
,
i.fullWindowOnEscKey = function(e) {
yr.isEventKey(e, "Esc") && (this.isFullscreen() === !0 ? this.exitFullscreen() : this.exitFullWindow())
}
,
i.exitFullWindow = function() {
this.isFullscreen(!1),
this.isFullWindow = !1,
Li(hr["default"], "keydown", this.boundFullWindowOnEscKey_),
hr["default"].documentElement.style.overflow = this.docOrigOverflow,
si(hr["default"].body, "vjs-full-window"),
this.trigger("exitFullWindow")
}
,
i.disablePictureInPicture = function(e) {
return void 0 === e ? this.techGet_("disablePictureInPicture") : (this.techCall_("setDisablePictureInPicture", e),
this.options_.disablePictureInPicture = e,
void this.trigger("disablepictureinpicturechanged"))
}
,
i.isInPictureInPicture = function(e) {
return void 0 !== e ? (this.isInPictureInPicture_ = !!e,
void this.togglePictureInPictureClass_()) : !!this.isInPictureInPicture_
}
,
i.requestPictureInPicture = function() {
return "pictureInPictureEnabled"in hr["default"] && this.disablePictureInPicture() === !1 ? this.techGet_("requestPictureInPicture") : void 0
}
,
i.exitPictureInPicture = function() {
return "pictureInPictureEnabled"in hr["default"] ? hr["default"].exitPictureInPicture() : void 0
}
,
i.handleKeyDown = function(e) {
var t = this.options_.userActions;
if (t && t.hotkeys) {
var i = function(e) {
var t = e.tagName.toLowerCase();
if (e.isContentEditable)
return !0;
var i = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
if ("input" === t)
return -1 === i.indexOf(e.type);
var n = ["textarea"];
return -1 !== n.indexOf(t)
};
i(this.el_.ownerDocument.activeElement) || ("function" == typeof t.hotkeys ? t.hotkeys.call(this, e) : this.handleHotkeys(e))
}
}
,
i.handleHotkeys = function(e) {
var t = this.options_.userActions ? this.options_.userActions.hotkeys : {}
, i = t.fullscreenKey
, n = void 0 === i ? function(e) {
return yr.isEventKey(e, "f")
}
: i
, r = t.muteKey
, a = void 0 === r ? function(e) {
return yr.isEventKey(e, "m")
}
: r
, s = t.playPauseKey
, o = void 0 === s ? function(e) {
return yr.isEventKey(e, "k") || yr.isEventKey(e, "Space")
}
: s;
if (n.call(this, e)) {
e.preventDefault(),
e.stopPropagation();
var u = Ol.getComponent("FullscreenToggle");
hr["default"][this.fsApi_.fullscreenEnabled] !== !1 && u.prototype.handleClick.call(this, e)
} else if (a.call(this, e)) {
e.preventDefault(),
e.stopPropagation();
var l = Ol.getComponent("MuteToggle");
l.prototype.handleClick.call(this, e)
} else if (o.call(this, e)) {
e.preventDefault(),
e.stopPropagation();
var c = Ol.getComponent("PlayToggle");
c.prototype.handleClick.call(this, e)
}
}
,
i.canPlayType = function(e) {
for (var t, i = 0, n = this.options_.techOrder; i < n.length; i++) {
var r = n[i]
, a = Gc.getTech(r);
if (a || (a = Ol.getComponent(r)),
a) {
if (a.isSupported() && (t = a.canPlayType(e)))
return t
} else
zu.error('The "' + r + '" tech is undefined. Skipped browser support check for that tech.')
}
return ""
}
,
i.selectSource = function(e) {
var t, i = this, n = this.options_.techOrder.map(function(e) {
return [e, Gc.getTech(e)]
}).filter(function(e) {
var t = e[0]
, i = e[1];
return i ? i.isSupported() : (zu.error('The "' + t + '" tech is undefined. Skipped browser support check for that tech.'),
!1)
}), r = function(e, t, i) {
var n;
return e.some(function(e) {
return t.some(function(t) {
return n = i(e, t),
n ? !0 : void 0
})
}),
n
}, a = function(e) {
return function(t, i) {
return e(i, t)
}
}, s = function(e, t) {
var n = e[0]
, r = e[1];
return r.canPlaySource(t, i.options_[n.toLowerCase()]) ? {
source: t,
tech: n
} : void 0
};
return t = this.options_.sourceOrder ? r(e, n, a(s)) : r(n, e, s),
t || !1
}
,
i.src = function(e) {
var t = this;
if ("undefined" == typeof e)
return this.cache_.src || "";
var i = id(e);
return i.length ? (this.changingSrc_ = !0,
this.cache_.sources = i,
this.updateSourceCaches_(i[0]),
void Ki(this, i[0], function(e, n) {
t.middleware_ = n,
t.cache_.sources = i,
t.updateSourceCaches_(e);
var r = t.src_(e);
return r ? i.length > 1 ? t.src(i.slice(1)) : (t.changingSrc_ = !1,
t.setTimeout(function() {
this.error({
code: 4,
message: this.localize(this.options_.notSupportedMessage)
})
}, 0),
void t.triggerReady()) : void Yi(n, t.tech_)
})) : void this.setTimeout(function() {
this.error({
code: 4,
message: this.localize(this.options_.notSupportedMessage)
})
}, 0)
}
,
i.src_ = function(e) {
var t = this
, i = this.selectSource([e]);
return i ? Al(i.tech, this.techName_) ? (this.ready(function() {
this.tech_.constructor.prototype.hasOwnProperty("setSource") ? this.techCall_("setSource", e) : this.techCall_("src", e.src),
this.changingSrc_ = !1
}, !0),
!1) : (this.changingSrc_ = !0,
this.loadTech_(i.tech, i.source),
this.tech_.ready(function() {
t.changingSrc_ = !1
}),
!1) : !0
}
,
i.load = function() {
this.techCall_("load")
}
,
i.reset = function() {
var e = this
, t = this.options_.Promise || dr["default"].Promise;
if (this.paused() || !t)
this.doReset_();
else {
var i = this.play();
zi(i.then(function() {
return e.doReset_()
}))
}
}
,
i.doReset_ = function() {
this.tech_ && this.tech_.clearTracks("text"),
this.resetCache_(),
this.poster(""),
this.loadTech_(this.options_.techOrder[0], null),
this.techCall_("reset"),
this.resetControlBarUI_(),
gl(this) && this.trigger("playerreset")
}
,
i.resetControlBarUI_ = function() {
this.resetProgressBar_(),
this.resetPlaybackRate_(),
this.resetVolumeBar_()
}
,
i.resetProgressBar_ = function() {
this.currentTime(0);
var e = this.controlBar
, t = e.durationDisplay
, i = e.remainingTimeDisplay;
t && t.updateContent(),
i && i.updateContent()
}
,
i.resetPlaybackRate_ = function() {
this.playbackRate(this.defaultPlaybackRate()),
this.handleTechRateChange_()
}
,
i.resetVolumeBar_ = function() {
this.volume(1),
this.trigger("volumechange")
}
,
i.currentSources = function() {
var e = this.currentSource()
, t = [];
return 0 !== Object.keys(e).length && t.push(e),
this.cache_.sources || t
}
,
i.currentSource = function() {
return this.cache_.source || {}
}
,
i.currentSrc = function() {
return this.currentSource() && this.currentSource().src || ""
}
,
i.currentType = function() {
return this.currentSource() && this.currentSource().type || ""
}
,
i.preload = function(e) {
return void 0 !== e ? (this.techCall_("setPreload", e),
void (this.options_.preload = e)) : this.techGet_("preload")
}
,
i.autoplay = function(e) {
if (void 0 === e)
return this.options_.autoplay || !1;
var t;
"string" == typeof e && /(any|play|muted)/.test(e) ? (this.options_.autoplay = e,
this.manualAutoplay_(e),
t = !1) : this.options_.autoplay = e ? !0 : !1,
t = "undefined" == typeof t ? this.options_.autoplay : t,
this.tech_ && this.techCall_("setAutoplay", t)
}
,
i.playsinline = function(e) {
return void 0 !== e ? (this.techCall_("setPlaysinline", e),
this.options_.playsinline = e,
this) : this.techGet_("playsinline")
}
,
i.loop = function(e) {
return void 0 !== e ? (this.techCall_("setLoop", e),
void (this.options_.loop = e)) : this.techGet_("loop")
}
,
i.poster = function(e) {
return void 0 === e ? this.poster_ : (e || (e = ""),
void (e !== this.poster_ && (this.poster_ = e,
this.techCall_("setPoster", e),
this.isPosterFromTech_ = !1,
this.trigger("posterchange"))))
}
,
i.handleTechPosterChange_ = function() {
if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
var e = this.tech_.poster() || "";
e !== this.poster_ && (this.poster_ = e,
this.isPosterFromTech_ = !0,
this.trigger("posterchange"))
}
}
,
i.controls = function(e) {
return void 0 === e ? !!this.controls_ : (e = !!e,
void (this.controls_ !== e && (this.controls_ = e,
this.usingNativeControls() && this.techCall_("setControls", e),
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_()))))
}
,
i.usingNativeControls = function(e) {
return void 0 === e ? !!this.usingNativeControls_ : (e = !!e,
void (this.usingNativeControls_ !== e && (this.usingNativeControls_ = e,
this.usingNativeControls_ ? (this.addClass("vjs-using-native-controls"),
this.trigger("usingnativecontrols")) : (this.removeClass("vjs-using-native-controls"),
this.trigger("usingcustomcontrols")))))
}
,
i.error = function(e) {
if (void 0 === e)
return this.error_ || null;
if (this.options_.suppressNotSupportedError && e && 4 === e.code) {
var t = function() {
this.error(e)
};
return this.options_.suppressNotSupportedError = !1,
this.any(["click", "touchstart"], t),
void this.one("loadstart", function() {
this.off(["click", "touchstart"], t)
})
}
return null === e ? (this.error_ = e,
this.removeClass("vjs-error"),
void (this.errorDisplay && this.errorDisplay.close())) : (this.error_ = new Hi(e),
this.addClass("vjs-error"),
zu.error("(CODE:" + this.error_.code + " " + Hi.errorTypes[this.error_.code] + ")", this.error_.message, this.error_),
void this.trigger("error"))
}
,
i.reportUserActivity = function() {
this.userActivity_ = !0
}
,
i.userActive = function(e) {
if (void 0 === e)
return this.userActive_;
if (e = !!e,
e !== this.userActive_) {
if (this.userActive_ = e,
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(e) {
e.stopPropagation(),
e.preventDefault()
}),
this.userActivity_ = !1,
this.removeClass("vjs-user-active"),
this.addClass("vjs-user-inactive"),
this.trigger("userinactive")
}
}
,
i.listenForUserActivity_ = function() {
var e, t, i, n = dl(this, this.reportUserActivity), r = function(e) {
(e.screenX !== t || e.screenY !== i) && (t = e.screenX,
i = e.screenY,
n())
}, a = function() {
n(),
this.clearInterval(e),
e = this.setInterval(n, 250)
}, s = function() {
n(),
this.clearInterval(e)
};
this.on("mousedown", a),
this.on("mousemove", r),
this.on("mouseup", s),
this.on("mouseleave", s);
var o = this.getChild("controlBar");
!o || Zl || jl || (o.on("mouseenter", function() {
this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout,
this.player().options_.inactivityTimeout = 0
}),
o.on("mouseleave", function() {
this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout
})),
this.on("keydown", n),
this.on("keyup", n);
var u;
this.setInterval(function() {
if (this.userActivity_) {
this.userActivity_ = !1,
this.userActive(!0),
this.clearTimeout(u);
var e = this.options_.inactivityTimeout;
0 >= e || (u = this.setTimeout(function() {
this.userActivity_ || this.userActive(!1)
}, e))
}
}, 250)
}
,
i.playbackRate = function(e) {
return void 0 !== e ? void this.techCall_("setPlaybackRate", e) : this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate || this.techGet_("playbackRate") : 1
}
,
i.defaultPlaybackRate = function(e) {
return void 0 !== e ? this.techCall_("setDefaultPlaybackRate", e) : this.tech_ && this.tech_.featuresPlaybackRate ? this.techGet_("defaultPlaybackRate") : 1
}
,
i.isAudio = function(e) {
return void 0 !== e ? void (this.isAudio_ = !!e) : !!this.isAudio_
}
,
i.addTextTrack = function(e, t, i) {
return this.tech_ ? this.tech_.addTextTrack(e, t, i) : void 0
}
,
i.addRemoteTextTrack = function(e, t) {
return this.tech_ ? this.tech_.addRemoteTextTrack(e, t) : void 0
}
,
i.removeRemoteTextTrack = function(e) {
void 0 === e && (e = {});
var t = e
, i = t.track;
return i || (i = e),
this.tech_ ? this.tech_.removeRemoteTextTrack(i) : void 0
}
,
i.getVideoPlaybackQuality = function() {
return this.techGet_("getVideoPlaybackQuality")
}
,
i.videoWidth = function() {
return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0
}
,
i.videoHeight = function() {
return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0
}
,
i.language = function(e) {
return void 0 === e ? this.language_ : void (this.language_ = String(e).toLowerCase())
}
,
i.languages = function() {
return Ui(t.prototype.options_.languages, this.languages_)
}
,
i.toJSON = function() {
var e = Ui(this.options_)
, t = e.tracks;
e.tracks = [];
for (var i = 0; i < t.length; i++) {
var n = t[i];
n = Ui(n),
n.player = void 0,
e.tracks[i] = n
}
return e
}
,
i.createModal = function(e, t) {
var i = this;
t = t || {},
t.content = e || "";
var n = new fc(this,t);
return this.addChild(n),
n.on("dispose", function() {
i.removeChild(n)
}),
n.open(),
n
}
,
i.updateCurrentBreakpoint_ = function() {
if (this.responsive())
for (var e = this.currentBreakpoint(), t = this.currentWidth(), i = 0; i < qh.length; i++) {
var n = qh[i]
, r = this.breakpoints_[n];
if (r >= t) {
if (e === n)
return;
e && this.removeClass(Hh[e]),
this.addClass(Hh[n]),
this.breakpoint_ = n;
break
}
}
}
,
i.removeCurrentBreakpoint_ = function() {
var e = this.currentBreakpointClass();
this.breakpoint_ = "",
e && this.removeClass(e)
}
,
i.breakpoints = function(e) {
return void 0 === e ? Wt(this.breakpoints_) : (this.breakpoint_ = "",
this.breakpoints_ = Wt({}, Wh, e),
this.updateCurrentBreakpoint_(),
Wt(this.breakpoints_))
}
,
i.responsive = function(e) {
if (void 0 === e)
return this.responsive_;
e = Boolean(e);
var t = this.responsive_;
if (e !== t)
return this.responsive_ = e,
e ? (this.on("playerresize", this.updateCurrentBreakpoint_),
this.updateCurrentBreakpoint_()) : (this.off("playerresize", this.updateCurrentBreakpoint_),
this.removeCurrentBreakpoint_()),
e
}
,
i.currentBreakpoint = function() {
return this.breakpoint_
}
,
i.currentBreakpointClass = function() {
return Hh[this.breakpoint_] || ""
}
,
i.loadMedia = function(e, t) {
var i = this;
if (e && "object" == typeof e) {
this.reset(),
this.cache_.media = Ui(e);
var n = this.cache_.media
, r = n.artwork
, a = n.poster
, s = n.src
, o = n.textTracks;
!r && a && (this.cache_.media.artwork = [{
src: a,
type: ed(a)
}]),
s && this.src(s),
a && this.poster(a),
Array.isArray(o) && o.forEach(function(e) {
return i.addRemoteTextTrack(e, !1)
}),
this.ready(t)
}
}
,
i.getMedia = function() {
if (!this.cache_.media) {
var e = this.poster()
, t = this.currentSources()
, i = Array.prototype.map.call(this.remoteTextTracks(), function(e) {
return {
kind: e.kind,
label: e.label,
language: e.language,
src: e.src
}
})
, n = {
src: t,
textTracks: i
};
return e && (n.poster = e,
n.artwork = [{
src: n.poster,
type: ed(n.poster)
}]),
n
}
return Ui(this.cache_.media)
}
,
t.getTagSettings = function(e) {
var t = {
sources: [],
tracks: []
}
, i = li(e)
, n = i["data-setup"];
if (ri(e, "vjs-fill") && (i.fill = !0),
ri(e, "vjs-fluid") && (i.fluid = !0),
null !== n) {
var r = vr(n || "{}")
, a = r[0]
, s = r[1];
a && zu.error(a),
Wt(i, s)
}
if (Wt(t, i),
e.hasChildNodes())
for (var o = e.childNodes, u = 0, l = o.length; l > u; u++) {
var c = o[u]
, d = c.nodeName.toLowerCase();
"source" === d ? t.sources.push(li(c)) : "track" === d && t.tracks.push(li(c))
}
return t
}
,
i.flexNotSupported_ = function() {
var e = hr["default"].createElement("i");
return !("flexBasis"in e.style || "webkitFlexBasis"in e.style || "mozFlexBasis"in e.style || "msFlexBasis"in e.style || "msFlexOrder"in e.style)
}
,
i.debug = function(e) {
return void 0 === e ? this.debugEnabled_ : void (e ? (this.trigger("debugon"),
this.previousLogLevel_ = this.log.level,
this.log.level("debug"),
this.debugEnabled_ = !0) : (this.trigger("debugoff"),
this.log.level(this.previousLogLevel_),
this.previousLogLevel_ = void 0,
this.debugEnabled_ = !1))
}
,
t
}(Ol);
zc.names.forEach(function(e) {
var t = zc[e];
zh.prototype[t.getterName] = function() {
return this.tech_ ? this.tech_[t.getterName]() : (this[t.privateName] = this[t.privateName] || new t.ListClass,
this[t.privateName])
}
}),
zh.prototype.crossorigin = zh.prototype.crossOrigin,
zh.players = {};
var Gh = dr["default"].navigator;
zh.prototype.options_ = {
techOrder: Gc.defaultTechOrder_,
html5: {},
flash: {},
inactivityTimeout: 2e3,
playbackRates: [],
liveui: !1,
children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
language: Gh && (Gh.languages && Gh.languages[0] || Gh.userLanguage || Gh.language) || "en",
languages: {},
notSupportedMessage: "No compatible source was found for this media.",
fullscreen: {
options: {
navigationUI: "hide"
}
},
breakpoints: {},
responsive: !1
},
["ended", "seeking", "seekable", "networkState", "readyState"].forEach(function(e) {
zh.prototype[e] = function() {
return this.techGet_(e)
}
}),
jh.forEach(function(e) {
zh.prototype["handleTech" + Il(e) + "_"] = function() {
return this.trigger(e)
}
}),
Ol.registerComponent("Player", zh);
var Xh = "plugin"
, Kh = "activePlugins_"
, Yh = {}
, $h = function(e) {
return Yh.hasOwnProperty(e)
}
, Qh = function(e) {
return $h(e) ? Yh[e] : void 0
}
, Jh = function(e, t) {
e[Kh] = e[Kh] || {},
e[Kh][t] = !0
}
, Zh = function(e, t, i) {
var n = (i ? "before" : "") + "pluginsetup";
e.trigger(n, t),
e.trigger(n + ":" + t.name, t)
}
, ef = function(e, t) {
var i = function() {
Zh(this, {
name: e,
plugin: t,
instance: null
}, !0);
var i = t.apply(this, arguments);
return Jh(this, e),
Zh(this, {
name: e,
plugin: t,
instance: i
}),
i
};
return Object.keys(t).forEach(function(e) {
i[e] = t[e]
}),
i
}
, tf = function(e, t) {
return t.prototype.name = e,
function() {
Zh(this, {
name: e,
plugin: t,
instance: null
}, !0);
for (var i = arguments.length, n = new Array(i), r = 0; i > r; r++)
n[r] = arguments[r];
var a = Wr(t, [this].concat(n));
return this[e] = function() {
return a
}
,
Zh(this, a.getEventHash()),
a
}
}
, nf = function() {
function e(t) {
if (this.constructor === e)
throw new Error("Plugin must be sub-classed; not directly instantiated.");
this.player = t,
this.log || (this.log = this.player.log.createLogger(this.name)),
Mi(this),
delete this.trigger,
Ri(this, this.constructor.defaultState),
Jh(t, this.name),
this.dispose = dl(this, this.dispose),
t.on("dispose", this.dispose)
}
var t = e.prototype;
return t.version = function() {
return this.constructor.VERSION
}
,
t.getEventHash = function(e) {
return void 0 === e && (e = {}),
e.name = this.name,
e.plugin = this.constructor,
e.instance = this,
e
}
,
t.trigger = function(e, t) {
return void 0 === t && (t = {}),
Di(this.eventBusEl_, e, this.getEventHash(t))
}
,
t.handleStateChanged = function() {}
,
t.dispose = function() {
var e = this.name
, t = this.player;
this.trigger("dispose"),
this.off(),
t.off("dispose", this.dispose),
t[Kh][e] = !1,
this.player = this.state = null,
t[e] = tf(e, Yh[e])
}
,
e.isBasic = function(t) {
var i = "string" == typeof t ? Qh(t) : t;
return "function" == typeof i && !e.prototype.isPrototypeOf(i.prototype)
}
,
e.registerPlugin = function(t, i) {
if ("string" != typeof t)
throw new Error('Illegal plugin name, "' + t + '", must be a string, was ' + typeof t + ".");
if ($h(t))
zu.warn('A plugin named "' + t + '" already exists. You may want to avoid re-registering plugins!');
else if (zh.prototype.hasOwnProperty(t))
throw new Error('Illegal plugin name, "' + t + '", cannot share a name with an existing player method!');
if ("function" != typeof i)
throw new Error('Illegal plugin for "' + t + '", must be a function, was ' + typeof i + ".");
return Yh[t] = i,
t !== Xh && (zh.prototype[t] = e.isBasic(i) ? ef(t, i) : tf(t, i)),
i
}
,
e.deregisterPlugin = function(e) {
if (e === Xh)
throw new Error("Cannot de-register base plugin.");
$h(e) && (delete Yh[e],
delete zh.prototype[e])
}
,
e.getPlugins = function(e) {
void 0 === e && (e = Object.keys(Yh));
var t;
return e.forEach(function(e) {
var i = Qh(e);
i && (t = t || {},
t[e] = i)
}),
t
}
,
e.getPluginVersion = function(e) {
var t = Qh(e);
return t && t.VERSION || ""
}
,
e
}();
nf.getPlugin = Qh,
nf.BASE_PLUGIN_NAME = Xh,
nf.registerPlugin(Xh, nf),
zh.prototype.usingPlugin = function(e) {
return !!this[Kh] && this[Kh][e] === !0
}
,
zh.prototype.hasPlugin = function(e) {
return !!$h(e)
}
;
var rf = function(e, t) {
void 0 === t && (t = {});
var i = function() {
e.apply(this, arguments)
}
, n = {};
"object" == typeof t ? (t.constructor !== Object.prototype.constructor && (i = t.constructor),
n = t) : "function" == typeof t && (i = t),
zr(i, e),
e && (i.super_ = e);
for (var r in n)
n.hasOwnProperty(r) && (i.prototype[r] = n[r]);
return i
}
, af = function(e) {
return 0 === e.indexOf("#") ? e.slice(1) : e
};
if (pn.hooks_ = {},
pn.hooks = function(e, t) {
return pn.hooks_[e] = pn.hooks_[e] || [],
t && (pn.hooks_[e] = pn.hooks_[e].concat(t)),
pn.hooks_[e]
}
,
pn.hook = function(e, t) {
pn.hooks(e, t)
}
,
pn.hookOnce = function(e, t) {
pn.hooks(e, [].concat(t).map(function(t) {
var i = function n() {
return pn.removeHook(e, n),
t.apply(void 0, arguments)
};
return i
}))
}
,
pn.removeHook = function(e, t) {
var i = pn.hooks(e).indexOf(t);
return -1 >= i ? !1 : (pn.hooks_[e] = pn.hooks_[e].slice(),
pn.hooks_[e].splice(i, 1),
!0)
}
,
dr["default"].VIDEOJS_NO_DYNAMIC_STYLE !== !0 && Qt()) {
var sf = Yu(".vjs-styles-defaults");
if (!sf) {
sf = tl("vjs-styles-defaults");
var of = Yu("head");
of && of.insertBefore(sf, of.firstChild),
il(sf, "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")
}
}
Ei(1, pn),
pn.VERSION = qu,
pn.options = zh.prototype.options_,
pn.getPlayers = function() {
return zh.players
}
,
pn.getPlayer = function(e) {
var t, i = zh.players;
if ("string" == typeof e) {
var n = af(e)
, r = i[n];
if (r)
return r;
t = Yu("#" + n)
} else
t = e;
if (Jt(t)) {
var a = t
, s = a.player
, o = a.playerId;
if (s || i[o])
return s || i[o]
}
}
,
pn.getAllPlayers = function() {
return Object.keys(zh.players).map(function(e) {
return zh.players[e]
}).filter(Boolean)
}
,
pn.players = zh.players,
pn.getComponent = Ol.getComponent,
pn.registerComponent = function(e, t) {
Gc.isTech(t) && zu.warn("The " + e + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),
Ol.registerComponent.call(Ol, e, t)
}
,
pn.getTech = Gc.getTech,
pn.registerTech = Gc.registerTech,
pn.use = Xi,
Object.defineProperty(pn, "middleware", {
value: {},
writeable: !1,
enumerable: !0
}),
Object.defineProperty(pn.middleware, "TERMINATOR", {
value: Yc,
writeable: !1,
enumerable: !0
}),
pn.browser = tc,
pn.TOUCH_ENABLED = $l,
pn.extend = rf,
pn.mergeOptions = Ui,
pn.bind = dl,
pn.registerPlugin = nf.registerPlugin,
pn.deregisterPlugin = nf.deregisterPlugin,
pn.plugin = function(e, t) {
return zu.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),
nf.registerPlugin(e, t)
}
,
pn.getPlugins = nf.getPlugins,
pn.getPlugin = nf.getPlugin,
pn.getPluginVersion = nf.getPluginVersion,
pn.addLanguage = function(e, t) {
var i;
return e = ("" + e).toLowerCase(),
pn.options.languages = Ui(pn.options.languages, (i = {},
i[e] = t,
i)),
pn.options.languages[e]
}
,
pn.log = zu,
pn.createLogger = Gu,
pn.createTimeRange = pn.createTimeRanges = Vi,
pn.formatTime = cn,
pn.setFormatTime = un,
pn.resetFormatTime = ln,
pn.parseUrl = Ac,
pn.isCrossOrigin = Lc,
pn.EventTarget = pl,
pn.on = Pi,
pn.one = Oi,
pn.off = Li,
pn.trigger = Di,
pn.xhr = Sr,
pn.TextTrack = Mc,
pn.AudioTrack = Rc,
pn.VideoTrack = Uc,
["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach(function(e) {
pn[e] = function() {
return zu.warn("videojs." + e + "() is deprecated; use videojs.dom." + e + "() instead"),
Qu[e].apply(null, arguments)
}
}),
pn.computedStyle = Xt,
pn.dom = Qu,
pn.url = Dc,
pn.defineLazyProperty = Uh;
var uf, lf = $r, cf = function(e, t, i) {
return e && i && i.responseURL && t !== i.responseURL ? i.responseURL : t
}, df = pn.log, hf = function(e, t) {
return e + "-" + t
}, ff = function(e) {
var t = e.manifestString
, i = e.customTagParsers
, n = void 0 === i ? [] : i
, r = e.customTagMappers
, a = void 0 === r ? [] : r
, s = new sa;
return n.forEach(function(e) {
return s.addParser(e)
}),
a.forEach(function(e) {
return s.addTagMapper(e)
}),
s.push(t),
s.end(),
s.manifest
}, pf = function(e, t) {
["AUDIO", "SUBTITLES"].forEach(function(i) {
for (var n in e.mediaGroups[i])
for (var r in e.mediaGroups[i][n]) {
var a = e.mediaGroups[i][n][r];
t(a, i, n, r)
}
})
}, mf = function(e) {
var t = e.playlist
, i = e.uri
, n = e.id;
t.id = n,
i && (t.uri = i),
t.attributes = t.attributes || {}
}, gf = function(e) {
for (var t = e.playlists.length; t--; ) {
var i = e.playlists[t];
mf({
playlist: i,
id: hf(t, i.uri)
}),
i.resolvedUri = lf(e.uri, i.uri),
e.playlists[i.id] = i,
e.playlists[i.uri] = i,
i.attributes.BANDWIDTH || df.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")
}
}, vf = function(e) {
pf(e, function(t) {
t.uri && (t.resolvedUri = lf(e.uri, t.uri))
})
}, yf = function(e, t) {
var i = hf(0, t)
, n = {
mediaGroups: {
AUDIO: {},
VIDEO: {},
"CLOSED-CAPTIONS": {},
SUBTITLES: {}
},
uri: dr["default"].location.href,
resolvedUri: dr["default"].location.href,
playlists: [{
uri: t,
id: i,
resolvedUri: t,
attributes: {}
}]
};
return n.playlists[i] = n.playlists[0],
n.playlists[t] = n.playlists[0],
n
}, _f = function(e, t) {
e.uri = t;
for (var i = 0; i < e.playlists.length; i++)
if (!e.playlists[i].uri) {
var n = "placeholder-uri-" + i;
e.playlists[i].uri = n
}
pf(e, function(t, i, n, r) {
if (t.playlists && t.playlists.length && !t.playlists[0].uri) {
var a = "placeholder-uri-" + i + "-" + n + "-" + r
, s = hf(0, a);
t.playlists[0].uri = a,
t.playlists[0].id = s,
e.playlists[s] = t.playlists[0],
e.playlists[a] = t.playlists[0]
}
}),
gf(e),
vf(e)
}, bf = pn.mergeOptions, Tf = pn.EventTarget, Sf = function(e, t, i) {
var n = t.slice();
i = i || 0;
for (var r = Math.min(e.length, t.length + i), a = i; r > a; a++)
n[a - i] = bf(e[a], n[a - i]);
return n
}, Cf = function(e, t) {
e.resolvedUri || (e.resolvedUri = lf(t, e.uri)),
e.key && !e.key.resolvedUri && (e.key.resolvedUri = lf(t, e.key.uri)),
e.map && !e.map.resolvedUri && (e.map.resolvedUri = lf(t, e.map.uri))
}, Ef = function(e, t) {
var i = bf(e, {})
, n = i.playlists[t.id];
if (!n)
return null;
if (n.segments && t.segments && n.segments.length === t.segments.length && n.endList === t.endList && n.mediaSequence === t.mediaSequence)
return null;
var r = bf(n, t);
n.segments && (r.segments = Sf(n.segments, t.segments, t.mediaSequence - n.mediaSequence)),
r.segments.forEach(function(e) {
Cf(e, r.resolvedUri)
});
for (var a = 0; a < i.playlists.length; a++)
i.playlists[a].id === t.id && (i.playlists[a] = r);
return i.playlists[t.id] = r,
i.playlists[t.uri] = r,
i
}, kf = function(e, t) {
var i, n = e.segments[e.segments.length - 1];
return i = t && n && n.duration ? 1e3 * n.duration : 500 * (e.targetDuration || 10)
}, wf = function(e) {
function t(t, i, n) {
var r;
if (void 0 === n && (n = {}),
r = e.call(this) || this,
!t)
throw new Error("A non-empty playlist URL or object is required");
var a = n
, s = a.withCredentials
, o = void 0 === s ? !1 : s
, u = a.handleManifestRedirects
, l = void 0 === u ? !1 : u;
r.src = t,
r.vhs_ = i,
r.withCredentials = o,
r.handleManifestRedirects = l;
var c = i.options_;
return r.customTagParsers = c && c.customTagParsers || [],
r.customTagMappers = c && c.customTagMappers || [],
r.state = "HAVE_NOTHING",
r.on("mediaupdatetimeout", function() {
"HAVE_METADATA" === r.state && (r.state = "HAVE_CURRENT_METADATA",
r.request = r.vhs_.xhr({
uri: lf(r.master.uri, r.media().uri),
withCredentials: r.withCredentials
}, function(e) {
return r.request ? e ? r.playlistRequestError(r.request, r.media(), "HAVE_METADATA") : void r.haveMetadata({
playlistString: r.request.responseText,
url: r.media().uri,
id: r.media().id
}) : void 0
}))
}),
r
}
gr(t, e);
var i = t.prototype;
return i.playlistRequestError = function(e, t, i) {
var n = t.uri
, r = t.id;
this.request = null,
i && (this.state = i),
this.error = {
playlist: this.master.playlists[r],
status: e.status,
message: "HLS playlist request error at URL: " + n + ".",
responseText: e.responseText,
code: e.status >= 500 ? 4 : 2
},
this.trigger("error")
}
,
i.haveMetadata = function(e) {
var t = this
, i = e.playlistString
, n = e.playlistObject
, r = e.url
, a = e.id;
this.request = null,
this.state = "HAVE_METADATA";
var s = n || ff({
manifestString: i,
customTagParsers: this.customTagParsers,
customTagMappers: this.customTagMappers
});
mf({
playlist: s,
uri: r,
id: a
});
var o = Ef(this.master, s);
this.targetDuration = s.targetDuration,
o ? (this.master = o,
this.media_ = this.master.playlists[a]) : this.trigger("playlistunchanged"),
this.media().endList || (dr["default"].clearTimeout(this.mediaUpdateTimeout),
this.mediaUpdateTimeout = dr["default"].setTimeout(function() {
t.trigger("mediaupdatetimeout")
}, kf(this.media(), !!o))),
this.trigger("loadedplaylist")
}
,
i.dispose = function() {
this.trigger("dispose"),
this.stopRequest(),
dr["default"].clearTimeout(this.mediaUpdateTimeout),
dr["default"].clearTimeout(this.finalRenditionTimeout),
this.off()
}
,
i.stopRequest = function() {
if (this.request) {
var e = this.request;
this.request = null,
e.onreadystatechange = null,
e.abort()
}
}
,
i.media = function(e, t) {
var i = this;
if (!e)
return this.media_;
if ("HAVE_NOTHING" === this.state)
throw new Error("Cannot switch media playlist from " + this.state);
if ("string" == typeof e) {
if (!this.master.playlists[e])
throw new Error("Unknown playlist URI: " + e);
e = this.master.playlists[e]
}
if (dr["default"].clearTimeout(this.finalRenditionTimeout),
t) {
var n = e.targetDuration / 2 * 1e3 || 5e3;
return void (this.finalRenditionTimeout = dr["default"].setTimeout(this.media.bind(this, e, !1), n))
}
var r = this.state
, a = !this.media_ || e.id !== this.media_.id;
if (this.master.playlists[e.id].endList || e.endList && e.segments.length)
return this.request && (this.request.onreadystatechange = null,
this.request.abort(),
this.request = null),
this.state = "HAVE_METADATA",
this.media_ = e,
void (a && (this.trigger("mediachanging"),
this.trigger("HAVE_MASTER" === r ? "loadedmetadata" : "mediachange")));
if (a) {
if (this.state = "SWITCHING_MEDIA",
this.request) {
if (e.resolvedUri === this.request.url)
return;
this.request.onreadystatechange = null,
this.request.abort(),
this.request = null
}
this.media_ && this.trigger("mediachanging"),
this.request = this.vhs_.xhr({
uri: e.resolvedUri,
withCredentials: this.withCredentials
}, function(t, n) {
if (i.request) {
if (e.resolvedUri = cf(i.handleManifestRedirects, e.resolvedUri, n),
t)
return i.playlistRequestError(i.request, e, r);
i.haveMetadata({
playlistString: n.responseText,
url: e.uri,
id: e.id
}),
i.trigger("HAVE_MASTER" === r ? "loadedmetadata" : "mediachange")
}
})
}
}
,
i.pause = function() {
this.stopRequest(),
dr["default"].clearTimeout(this.mediaUpdateTimeout),
"HAVE_NOTHING" === this.state && (this.started = !1),
"SWITCHING_MEDIA" === this.state ? this.state = this.media_ ? "HAVE_METADATA" : "HAVE_MASTER" : "HAVE_CURRENT_METADATA" === this.state && (this.state = "HAVE_METADATA")
}
,
i.load = function(e) {
var t = this;
dr["default"].clearTimeout(this.mediaUpdateTimeout);
var i = this.media();
if (e) {
var n = i ? i.targetDuration / 2 * 1e3 : 5e3;
return void (this.mediaUpdateTimeout = dr["default"].setTimeout(function() {
return t.load()
}, n))
}
return this.started ? void this.trigger(i && !i.endList ? "mediaupdatetimeout" : "loadedplaylist") : void this.start()
}
,
i.start = function() {
var e = this;
return this.started = !0,
"object" == typeof this.src ? (this.src.uri || (this.src.uri = dr["default"].location.href),
this.src.resolvedUri = this.src.uri,
void setTimeout(function() {
e.setupInitialPlaylist(e.src)
}, 0)) : void (this.request = this.vhs_.xhr({
uri: this.src,
withCredentials: this.withCredentials
}, function(t, i) {
if (e.request) {
if (e.request = null,
t)
return e.error = {
status: i.status,
message: "HLS playlist request error at URL: " + e.src + ".",
responseText: i.responseText,
code: 2
},
"HAVE_NOTHING" === e.state && (e.started = !1),
e.trigger("error");
e.src = cf(e.handleManifestRedirects, e.src, i);
var n = ff({
manifestString: i.responseText,
customTagParsers: e.customTagParsers,
customTagMappers: e.customTagMappers
});
e.setupInitialPlaylist(n)
}
}))
}
,
i.srcUri = function() {
return "string" == typeof this.src ? this.src : this.src.uri
}
,
i.setupInitialPlaylist = function(e) {
if (this.state = "HAVE_MASTER",
e.playlists)
return this.master = e,
_f(this.master, this.srcUri()),
e.playlists.forEach(function(e) {
e.segments && e.segments.forEach(function(t) {
Cf(t, e.resolvedUri)
})
}),
this.trigger("loadedplaylist"),
void (this.request || this.media(this.master.playlists[0]));
var t = this.srcUri() || dr["default"].location.href;
this.master = yf(e, t),
this.haveMetadata({
playlistObject: e,
url: t,
id: this.master.playlists[0].id
}),
this.trigger("loadedmetadata")
}
,
t
}(Tf), If = 1 / 30, Af = 3 * If, xf = function(e, t) {
var i, n = [];
if (e && e.length)
for (i = 0; i < e.length; i++)
t(e.start(i), e.end(i)) && n.push([e.start(i), e.end(i)]);
return pn.createTimeRanges(n)
}, Pf = function(e, t) {
return xf(e, function(e, i) {
return t >= e - Af && i + Af >= t
})
}, Lf = function(e, t) {
return xf(e, function(e) {
return e - If >= t
})
}, Df = function(e) {
if (e.length < 2)
return pn.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 pn.createTimeRanges(t)
}, Of = function(e, t) {
var i = null
, n = null
, r = 0
, a = []
, s = [];
if (!(e && e.length && t && t.length))
return pn.createTimeRange();
for (var o = e.length; o--; )
a.push({
time: e.start(o),
type: "start"
}),
a.push({
time: e.end(o),
type: "end"
});
for (o = t.length; o--; )
a.push({
time: t.start(o),
type: "start"
}),
a.push({
time: t.end(o),
type: "end"
});
for (a.sort(function(e, t) {
return e.time - t.time
}),
o = 0; o < a.length; o++)
"start" === a[o].type ? (r++,
2 === r && (i = a[o].time)) : "end" === a[o].type && (r--,
1 === r && (n = a[o].time)),
null !== i && null !== n && (s.push([i, n]),
i = null,
n = null);
return pn.createTimeRanges(s)
}, Nf = 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(", ")
}, Mf = function(e, t, i) {
void 0 === i && (i = 1);
var n = e.length ? e.end(e.length - 1) : 0;
return (n - t) / i
}, Rf = function(e) {
for (var t = [], i = 0; i < e.length; i++)
t.push({
start: e.start(i),
end: e.end(i)
});
return t
}, Uf = function(e, t) {
if (e === t)
return !1;
if (!e && t || !t && e)
return !0;
if (e.length !== t.length)
return !0;
for (var i = 0; i < e.length; i++)
if (e.start(i) !== t.start(i) || e.end(i) !== t.end(i))
return !0;
return !1
}, Ff = pn.createTimeRange, Bf = 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
}
}, jf = function(e, t) {
for (var i, n = 0, r = t - e.mediaSequence; r < e.segments.length; r++) {
if (i = e.segments[r],
"undefined" != typeof i.start)
return {
result: i.start - n,
precise: !0
};
if (n += i.duration,
"undefined" != typeof i.end)
return {
result: i.end - n,
precise: !0
}
}
return {
result: -1,
precise: !1
}
}, Vf = function(e, t, i) {
if ("undefined" == typeof t && (t = e.mediaSequence + e.segments.length),
t < e.mediaSequence)
return 0;
var n = Bf(e, t);
if (n.precise)
return n.result;
var r = jf(e, t);
return r.precise ? r.result : n.result + i
}, qf = function(e, t, i) {
if (!e)
return 0;
if ("number" != typeof i && (i = 0),
"undefined" == typeof t) {
if (e.totalDuration)
return e.totalDuration;
if (!e.endList)
return dr["default"].Infinity
}
return Vf(e, t, i)
}, Hf = function(e, t, i) {
var n = 0;
if (t > i) {
var r = [i, t];
t = r[0],
i = r[1]
}
if (0 > t) {
for (var a = t; a < Math.min(0, i); a++)
n += e.targetDuration;
t = 0
}
for (var s = t; i > s; s++)
n += e.segments[s].duration;
return n
}, Wf = function(e, t) {
if (!e.segments.length)
return 0;
var i = e.segments.length
, n = e.segments[i - 1].duration || e.targetDuration
, r = "number" == typeof t ? t : n + 2 * e.targetDuration;
if (0 === r)
return i;
for (var a = 0; i-- && (a += e.segments[i].duration,
!(a >= r)); )
;
return Math.max(0, i)
}, zf = function(e, t, i, n) {
if (!e || !e.segments)
return null;
if (e.endList)
return qf(e);
if (null === t)
return null;
t = t || 0;
var r = i ? Wf(e, n) : e.segments.length;
return Vf(e, e.mediaSequence + r, t)
}, Gf = function(e, t, i) {
var n = !0
, r = t || 0
, a = zf(e, t, n, i);
return null === a ? Ff() : Ff(r, a)
}, Xf = function(e, t, i, n) {
var r, a, s = e.segments.length, o = t - n;
if (0 > o) {
if (i > 0)
for (r = i - 1; r >= 0; r--)
if (a = e.segments[r],
o += a.duration + If,
o > 0)
return {
mediaIndex: r,
startTime: n - Hf(e, i, r)
};
return {
mediaIndex: 0,
startTime: t
}
}
if (0 > i) {
for (r = i; 0 > r; r++)
if (o -= e.targetDuration,
0 > o)
return {
mediaIndex: 0,
startTime: t
};
i = 0
}
for (r = i; s > r; r++)
if (a = e.segments[r],
o -= a.duration + If,
0 > o)
return {
mediaIndex: r,
startTime: n + Hf(e, i, r)
};
return {
mediaIndex: s - 1,
startTime: t
}
}, Kf = function(e) {
return e.excludeUntil && e.excludeUntil > Date.now()
}, Yf = function(e) {
return e.excludeUntil && 1 / 0 === e.excludeUntil
}, $f = function(e) {
var t = Kf(e);
return !e.disabled && !t
}, Qf = function(e) {
return e.disabled
}, Jf = function(e) {
for (var t = 0; t < e.segments.length; t++)
if (e.segments[t].key)
return !0;
return !1
}, Zf = function(e, t) {
return t.attributes && t.attributes[e]
}, ep = function(e, t, i, n) {
if (void 0 === n && (n = 0),
!Zf("BANDWIDTH", i))
return 0 / 0;
var r = e * i.attributes.BANDWIDTH;
return (r - 8 * n) / t
}, tp = function(e, t) {
if (1 === e.playlists.length)
return !0;
var i = t.attributes.BANDWIDTH || Number.MAX_VALUE;
return 0 === e.playlists.filter(function(e) {
return $f(e) ? (e.attributes.BANDWIDTH || 0) < i : !1
}).length
}, ip = {
duration: qf,
seekable: Gf,
safeLiveIndex: Wf,
getMediaInfoForTime: Xf,
isEnabled: $f,
isDisabled: Qf,
isBlacklisted: Kf,
isIncompatible: Yf,
playlistEnd: zf,
isAes: Jf,
hasAttribute: Zf,
estimateSegmentRequestTime: ep,
isLowestEnabledRendition: tp
}, np = pn.xhr, rp = pn.mergeOptions, ap = function(e, t, i, n) {
var r = "arraybuffer" === e.responseType ? e.response : e.responseText;
!t && r && (e.responseTime = Date.now(),
e.roundTripTime = e.responseTime - e.requestTime,
e.bytesReceived = r.byteLength || r.length,
e.bandwidth || (e.bandwidth = Math.floor(e.bytesReceived / e.roundTripTime * 8 * 1e3))),
i.headers && (e.responseHeaders = i.headers),
t && "ETIMEDOUT" === t.code && (e.timedout = !0),
t || e.aborted || 200 === i.statusCode || 206 === i.statusCode || 0 === i.statusCode || (t = new Error("XHR Failed with a response of: " + (e && (r || e.responseText)))),
n(t, e)
}, sp = function() {
var e = function t(e, i) {
e = rp({
timeout: 45e3
}, e);
var n = t.beforeRequest || pn.Vhs.xhr.beforeRequest;
if (n && "function" == typeof n) {
var r = n(e);
r && (e = r)
}
var a = np(e, function(e, t) {
return ap(a, e, t, i)
})
, s = a.abort;
return a.abort = function() {
return a.aborted = !0,
s.apply(a, arguments)
}
,
a.uri = e.uri,
a.requestTime = Date.now(),
a
};
return e
}, op = function(e) {
var t = e.offset + e.length - 1
, i = e.offset;
return "bytes=" + i + "-" + t
}, up = function(e) {
var t = {};
return e.byterange && (t.Range = op(e.byterange)),
t
}, lp = function(e, t) {
return e.start(t) + "-" + e.end(t)
}, cp = function(e, t) {
var i = e.toString(16);
return "00".substring(0, 2 - i.length) + i + (t % 2 ? " " : "")
}, dp = function(e) {
return e >= 32 && 126 > e ? String.fromCharCode(e) : "."
}, hp = function(e) {
var t = {};
return Object.keys(e).forEach(function(i) {
var n = e[i];
t[i] = ArrayBuffer.isView(n) ? {
bytes: n.buffer,
byteOffset: n.byteOffset,
byteLength: n.byteLength
} : n
}),
t
}, fp = function(e) {
var t = e.byterange || {
length: 1 / 0,
offset: 0
};
return [t.length, t.offset, e.resolvedUri].join(",")
}, pp = function(e) {
return e.resolvedUri
}, mp = function(e) {
for (var t, i, n = Array.prototype.slice.call(e), r = 16, a = "", s = 0; s < n.length / r; s++)
t = n.slice(s * r, s * r + r).map(cp).join(""),
i = n.slice(s * r, s * r + r).map(dp).join(""),
a += t + " " + i + "\n";
return a
}, gp = function(e) {
var t = e.bytes;
return mp(t)
}, vp = function(e) {
var t, i = "";
for (t = 0; t < e.length; t++)
i += lp(e, t) + " ";
return i
}, yp = Object.freeze({
__proto__: null,
createTransferableMessage: hp,
initSegmentId: fp,
segmentKeyId: pp,
hexDump: mp,
tagDump: gp,
textRanges: vp
}), _p = .25, bp = function(e, t) {
if (!t.dateTimeObject)
return null;
var i = t.videoTimingInfo.transmuxerPrependedSeconds
, n = t.videoTimingInfo.transmuxedPresentationStart
, r = n + i
, a = e - r;
return new Date(t.dateTimeObject.getTime() + 1e3 * a)
}, Tp = function(e) {
return e.transmuxedPresentationEnd - e.transmuxedPresentationStart - e.transmuxerPrependedSeconds
}, Sp = function(e, t) {
var i;
try {
i = new Date(e)
} catch (n) {
return null
}
if (!t || !t.segments || 0 === t.segments.length)
return null;
var r = t.segments[0];
if (i < r.dateTimeObject)
return null;
for (var a = 0; a < t.segments.length - 1; a++) {
r = t.segments[a];
var s = t.segments[a + 1].dateTimeObject;
if (s > i)
break
}
var o = t.segments[t.segments.length - 1]
, u = o.dateTimeObject
, l = o.videoTimingInfo ? Tp(o.videoTimingInfo) : o.duration + o.duration * _p
, c = new Date(u.getTime() + 1e3 * l);
return i > c ? null : (i > u && (r = o),
{
segment: r,
estimatedStart: r.videoTimingInfo ? r.videoTimingInfo.transmuxedPresentationStart : ip.duration(t, t.mediaSequence + t.segments.indexOf(r)),
type: r.videoTimingInfo ? "accurate" : "estimate"
})
}, Cp = function(e, t) {
if (!t || !t.segments || 0 === t.segments.length)
return null;
for (var i, n = 0, r = 0; r < t.segments.length && (i = t.segments[r],
n = i.videoTimingInfo ? i.videoTimingInfo.transmuxedPresentationEnd : n + i.duration,
!(n >= e)); r++)
;
var a = t.segments[t.segments.length - 1];
if (a.videoTimingInfo && a.videoTimingInfo.transmuxedPresentationEnd < e)
return null;
if (e > n) {
if (e > n + a.duration * _p)
return null;
i = a
}
return {
segment: i,
estimatedStart: i.videoTimingInfo ? i.videoTimingInfo.transmuxedPresentationStart : n - i.duration,
type: i.videoTimingInfo ? "accurate" : "estimate"
}
}, Ep = function(e, t) {
var i, n;
try {
i = new Date(e),
n = new Date(t)
} catch (r) {}
var a = i.getTime()
, s = n.getTime();
return (s - a) / 1e3
}, kp = function(e) {
if (!e.segments || 0 === e.segments.length)
return !1;
for (var t = 0; t < e.segments.length; t++) {
var i = e.segments[t];
if (!i.dateTimeObject)
return !1
}
return !0
}, wp = function(e) {
var t = e.playlist
, i = e.time
, n = void 0 === i ? void 0 : i
, r = e.callback;
if (!r)
throw new Error("getProgramTime: callback must be provided");
if (!t || void 0 === n)
return r({
message: "getProgramTime: playlist and time must be provided"
});
var a = Cp(n, t);
if (!a)
return r({
message: "valid programTime was not found"
});
if ("estimate" === a.type)
return r({
message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
seekTime: a.estimatedStart
});
var s = {
mediaSeconds: n
}
, o = bp(n, a.segment);
return o && (s.programDateTime = o.toISOString()),
r(null, s)
}, Ip = function Ky(e) {
var t = e.programTime
, i = e.playlist
, n = e.retryCount
, r = void 0 === n ? 2 : n
, a = e.seekTo
, s = e.pauseAfterSeek
, o = void 0 === s ? !0 : s
, u = e.tech
, l = e.callback;
if (!l)
throw new Error("seekToProgramTime: callback must be provided");
if ("undefined" == typeof t || !i || !a)
return l({
message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
});
if (!i.endList && !u.hasStarted_)
return l({
message: "player must be playing a live stream to start buffering"
});
if (!kp(i))
return l({
message: "programDateTime tags must be provided in the manifest " + i.resolvedUri
});
var c = Sp(t, i);
if (!c)
return l({
message: t + " was not found in the stream"
});
var d = c.segment
, h = Ep(d.dateTimeObject, t);
if ("estimate" === c.type)
return 0 === r ? l({
message: t + " is not buffered yet. Try again"
}) : (a(c.estimatedStart + h),
void u.one("seeked", function() {
Ky({
programTime: t,
playlist: i,
retryCount: r - 1,
seekTo: a,
pauseAfterSeek: o,
tech: u,
callback: l
})
}));
var f = d.start + h
, p = function() {
return l(null, u.currentTime())
};
u.one("seeked", p),
o && u.pause(),
a(f)
}, Ap = function(e, t) {
return 4 === e.readyState ? t() : void 0
}, xp = function(e, t, i) {
var n, r = [], a = !1, s = function(e, t, n, r) {
return t.abort(),
a = !0,
i(e, t, n, r)
}, o = function(e, t) {
if (!a) {
if (e)
return s(e, t, "", r);
var i = t.responseText.substring(r && r.byteLength || 0, t.responseText.length);
if (r = Zs(r, eo(i, !0)),
n = n || $s(r),
r.length < 10 || n && r.length < n + 2)
return Ap(t, function() {
return s(e, t, "", r)
});
var o = Ys(r);
return "ts" === o && r.length < 188 ? Ap(t, function() {
return s(e, t, "", r)
}) : !o && r.length < 376 ? Ap(t, function() {
return s(e, t, "", r)
}) : s(null, t, o, r)
}
}, u = {
uri: e,
beforeSend: function(e) {
e.overrideMimeType("text/plain; charset=x-user-defined"),
e.addEventListener("progress", function(t) {
return t.total,
t.loaded,
ap(e, null, {
statusCode: e.status
}, o)
})
}
}, l = t(u, function(e, t) {
return ap(l, e, t, o)
});
return l
}, Pp = pn.EventTarget, Lp = pn.mergeOptions, Dp = function(e) {
var t = e.masterXml
, i = e.srcUrl
, n = e.clientOffset
, r = e.sidxMapping
, a = Ws(t, {
manifestUri: i,
clientOffset: n,
sidxMapping: r
});
return _f(a, i),
a
}, Op = function(e, t) {
for (var i = !0, n = Lp(e, {
duration: t.duration,
minimumUpdatePeriod: t.minimumUpdatePeriod
}), r = 0; r < t.playlists.length; r++) {
var a = Ef(n, t.playlists[r]);
a && (n = a,
i = !1)
}
return pf(t, function(e, t, r, a) {
if (e.playlists && e.playlists.length) {
var s = e.playlists[0].id
, o = Ef(n, e.playlists[0]);
o && (n = o,
n.mediaGroups[t][r][a].playlists[0] = n.playlists[s],
i = !1)
}
}),
t.minimumUpdatePeriod !== e.minimumUpdatePeriod && (i = !1),
i ? null : n
}, Np = function(e) {
var t = e.byterange.offset + e.byterange.length - 1;
return e.uri + "-" + e.byterange.offset + "-" + t
}, Mp = function(e, t) {
var i = Boolean(!e.map && !t.map)
, n = i || Boolean(e.map && t.map && e.map.byterange.offset === t.map.byterange.offset && e.map.byterange.length === t.map.byterange.length);
return n && e.uri === t.uri && e.byterange.offset === t.byterange.offset && e.byterange.length === t.byterange.length
}, Rp = function(e, t) {
var i = {};
for (var n in e) {
var r = e[n]
, a = r.sidx;
if (a) {
var s = Np(a);
if (!t[s])
break;
var o = t[s].sidxInfo;
Mp(o, a) && (i[s] = t[s])
}
}
return i
}, Up = function(e, t, i, n) {
var r = Ws(e, {
manifestUri: t,
clientOffset: i
})
, a = Rp(r.playlists, n)
, s = a;
return pf(r, function(e) {
if (e.playlists && e.playlists.length) {
var t = e.playlists;
s = Lp(s, Rp(t, n))
}
}),
s
}, Fp = function(e, t, i, n, r, a) {
var s = {
uri: cf(r.handleManifestRedirects, t.resolvedUri),
byterange: t.byterange,
playlist: i
}
, o = pn.mergeOptions(s, {
responseType: "arraybuffer",
headers: up(s)
});
return xp(s.uri, n, function(t, r, u, l) {
if (t)
return a(t, r);
if (!u || "mp4" !== u)
return a({
status: r.status,
message: "Unsupported " + (u || "unknown") + " container type for sidx segment at URL: " + s.uri,
response: "",
playlist: i,
internal: !0,
blacklistDuration: 1 / 0,
code: 2
}, r);
var c = s.byterange
, d = c.offset
, h = c.length;
return l.length >= h + d ? a(t, {
response: l.subarray(d, d + h),
status: r.status,
uri: r.uri
}) : void (e.request = n(o, a))
})
}, Bp = function(e) {
function t(t, i, n, r) {
var a;
void 0 === n && (n = {}),
a = e.call(this) || this;
var s = n
, o = s.withCredentials
, u = void 0 === o ? !1 : o
, l = s.handleManifestRedirects
, c = void 0 === l ? !1 : l;
if (a.vhs_ = i,
a.withCredentials = u,
a.handleManifestRedirects = c,
!t)
throw new Error("A non-empty playlist URL or object is required");
return a.on("minimumUpdatePeriod", function() {
a.refreshXml_()
}),
a.on("mediaupdatetimeout", function() {
a.refreshMedia_(a.media().id)
}),
a.state = "HAVE_NOTHING",
a.loadedPlaylists_ = {},
"string" == typeof t ? (a.srcUrl = t,
a.sidxMapping_ = {},
mr(a)) : (a.setupChildLoader(r, t),
a)
}
gr(t, e);
var i = t.prototype;
return i.setupChildLoader = function(e, t) {
this.masterPlaylistLoader_ = e,
this.childPlaylist_ = t
}
,
i.dispose = function() {
this.trigger("dispose"),
this.stopRequest(),
this.loadedPlaylists_ = {},
dr["default"].clearTimeout(this.minimumUpdatePeriodTimeout_),
dr["default"].clearTimeout(this.mediaRequest_),
dr["default"].clearTimeout(this.mediaUpdateTimeout),
this.off()
}
,
i.hasPendingRequest = function() {
return this.request || this.mediaRequest_
}
,
i.stopRequest = function() {
if (this.request) {
var e = this.request;
this.request = null,
e.onreadystatechange = null,
e.abort()
}
}
,
i.sidxRequestFinished_ = function(e, t, i, n) {
var r = this;
return function(a, s) {
if (r.request) {
if (r.request = null,
a)
return r.error = "object" == typeof a ? a : {
status: s.status,
message: "DASH playlist request error at URL: " + e.uri,
response: s.response,
code: 2
},
i && (r.state = i),
void r.trigger("error");
var o = to(s.response)
, u = Xs(o.subarray(8));
return n(t, u)
}
}
}
,
i.media = function(e) {
var t = this;
if (!e)
return this.media_;
if ("HAVE_NOTHING" === this.state)
throw new Error("Cannot switch media playlist from " + this.state);
var i = this.state;
if ("string" == typeof e) {
if (!this.master.playlists[e])
throw new Error("Unknown playlist URI: " + e);
e = this.master.playlists[e]
}
var n = !this.media_ || e.id !== this.media_.id;
if (n && this.loadedPlaylists_[e.id] && this.loadedPlaylists_[e.id].endList)
return this.state = "HAVE_METADATA",
this.media_ = e,
void (n && (this.trigger("mediachanging"),
this.trigger("mediachange")));
if (n) {
if (this.media_ && this.trigger("mediachanging"),
!e.sidx)
return void (this.mediaRequest_ = dr["default"].setTimeout(this.haveMetadata.bind(this, {
startingState: i,
playlist: e
}), 0));
var r, a;
this.masterPlaylistLoader_ ? (r = this.masterPlaylistLoader_.master,
a = this.masterPlaylistLoader_.sidxMapping_) : (r = this.master,
a = this.sidxMapping_);
var s = Np(e.sidx);
a[s] = {
sidxInfo: e.sidx
},
this.request = Fp(this, e.sidx, e, this.vhs_.xhr, {
handleManifestRedirects: this.handleManifestRedirects
}, this.sidxRequestFinished_(e, r, i, function(n, r) {
if (!n || !r)
throw new Error("failed to request sidx");
a[s].sidx = r,
t.haveMetadata({
startingState: i,
playlist: n.playlists[e.id]
})
}))
}
}
,
i.haveMetadata = function(e) {
var t = e.startingState
, i = e.playlist;
this.state = "HAVE_METADATA",
this.loadedPlaylists_[i.id] = i,
this.mediaRequest_ = null,
this.refreshMedia_(i.id),
this.trigger("HAVE_MASTER" === t ? "loadedmetadata" : "mediachange")
}
,
i.pause = function() {
this.stopRequest(),
dr["default"].clearTimeout(this.mediaUpdateTimeout),
dr["default"].clearTimeout(this.minimumUpdatePeriodTimeout_),
"HAVE_NOTHING" === this.state && (this.started = !1)
}
,
i.load = function(e) {
var t = this;
dr["default"].clearTimeout(this.mediaUpdateTimeout),
dr["default"].clearTimeout(this.minimumUpdatePeriodTimeout_);
var i = this.media();
if (e) {
var n = i ? i.targetDuration / 2 * 1e3 : 5e3;
return void (this.mediaUpdateTimeout = dr["default"].setTimeout(function() {
return t.load()
}, n))
}
return this.started ? void this.trigger(i && !i.endList ? "mediaupdatetimeout" : "loadedplaylist") : void this.start()
}
,
i.start = function() {
var e = this;
return this.started = !0,
this.masterPlaylistLoader_ ? void (this.mediaRequest_ = dr["default"].setTimeout(this.haveMaster_.bind(this), 0)) : void (this.request = this.vhs_.xhr({
uri: this.srcUrl,
withCredentials: this.withCredentials
}, function(t, i) {
if (e.request) {
if (e.request = null,
t)
return e.error = {
status: i.status,
message: "DASH playlist request error at URL: " + e.srcUrl,
responseText: i.responseText,
code: 2
},
"HAVE_NOTHING" === e.state && (e.started = !1),
e.trigger("error");
e.masterXml_ = i.responseText,
e.masterLoaded_ = i.responseHeaders && i.responseHeaders.date ? Date.parse(i.responseHeaders.date) : Date.now(),
e.srcUrl = cf(e.handleManifestRedirects, e.srcUrl, i),
e.syncClientServerClock_(e.onClientServerClockSync_.bind(e))
}
}))
}
,
i.syncClientServerClock_ = function(e) {
var t = this
, i = zs(this.masterXml_);
return null === i ? (this.clientOffset_ = this.masterLoaded_ - Date.now(),
e()) : "DIRECT" === i.method ? (this.clientOffset_ = i.value - Date.now(),
e()) : void (this.request = this.vhs_.xhr({
uri: lf(this.srcUrl, i.value),
method: i.method,
withCredentials: this.withCredentials
}, function(n, r) {
if (t.request) {
if (n)
return t.clientOffset_ = t.masterLoaded_ - Date.now(),
e();
var a;
a = "HEAD" === i.method ? r.responseHeaders && r.responseHeaders.date ? Date.parse(r.responseHeaders.date) : t.masterLoaded_ : Date.parse(r.responseText),
t.clientOffset_ = a - Date.now(),
e()
}
}))
}
,
i.haveMaster_ = function() {
this.state = "HAVE_MASTER",
this.mediaRequest_ = null,
this.masterPlaylistLoader_ ? this.media_ || this.media(this.childPlaylist_) : (this.updateMainManifest_(Dp({
masterXml: this.masterXml_,
srcUrl: this.srcUrl,
clientOffset: this.clientOffset_,
sidxMapping: this.sidxMapping_
})),
this.trigger("loadedplaylist"))
}
,
i.updateMinimumUpdatePeriodTimeout_ = function() {
var e = this;
dr["default"].clearTimeout(this.minimumUpdatePeriodTimeout_);
var t = function(t) {
e.minimumUpdatePeriodTimeout_ = dr["default"].setTimeout(function() {
e.trigger("minimumUpdatePeriod")
}, t)
}
, i = this.master && this.master.minimumUpdatePeriod;
i > 0 ? t(i) : 0 === i && (this.media() ? t(1e3 * this.media().targetDuration) : this.one("loadedplaylist", function() {
t(1e3 * e.media().targetDuration)
}))
}
,
i.onClientServerClockSync_ = function() {
this.haveMaster_(),
this.hasPendingRequest() || this.media_ || this.media(this.master.playlists[0]),
this.updateMinimumUpdatePeriodTimeout_()
}
,
i.updateMainManifest_ = function(e) {
if (this.master = e,
this.master.locations && this.master.locations.length) {
var t = this.master.locations[0];
t !== this.srcUrl && (this.srcUrl = t)
}
}
,
i.refreshXml_ = function() {
var e = this;
this.request = this.vhs_.xhr({
uri: this.srcUrl,
withCredentials: this.withCredentials
}, function(t, i) {
if (e.request) {
if (e.request = null,
t)
return e.error = {
status: i.status,
message: "DASH playlist request error at URL: " + e.srcUrl,
responseText: i.responseText,
code: 2
},
"HAVE_NOTHING" === e.state && (e.started = !1),
e.trigger("error");
e.masterXml_ = i.responseText,
e.sidxMapping_ = Up(e.masterXml_, e.srcUrl, e.clientOffset_, e.sidxMapping_);
var n = Dp({
masterXml: e.masterXml_,
srcUrl: e.srcUrl,
clientOffset: e.clientOffset_,
sidxMapping: e.sidxMapping_
})
, r = Op(e.master, n)
, a = e.media().sidx;
if (r)
if (a) {
var s = Np(a);
if (!e.sidxMapping_[s]) {
var o = e.media();
e.request = Fp(e, o.sidx, o, e.vhs_.xhr, {
handleManifestRedirects: e.handleManifestRedirects
}, e.sidxRequestFinished_(o, n, e.state, function(t, i) {
if (!t || !i)
throw new Error("failed to request sidx on minimumUpdatePeriod");
e.sidxMapping_[s].sidx = i,
e.updateMinimumUpdatePeriodTimeout_(),
e.refreshMedia_(e.media().id)
}))
}
} else
e.updateMainManifest_(r),
e.media_ && (e.media_ = e.master.playlists[e.media_.id]);
e.updateMinimumUpdatePeriodTimeout_()
}
})
}
,
i.refreshMedia_ = function(e) {
var t = this;
if (!e)
throw new Error("refreshMedia_ must take a media id");
var i, n;
this.masterPlaylistLoader_ ? (i = this.masterPlaylistLoader_.master,
n = Dp({
masterXml: this.masterPlaylistLoader_.masterXml_,
srcUrl: this.masterPlaylistLoader_.srcUrl,
clientOffset: this.masterPlaylistLoader_.clientOffset_,
sidxMapping: this.masterPlaylistLoader_.sidxMapping_
})) : (i = this.master,
n = Dp({
masterXml: this.masterXml_,
srcUrl: this.srcUrl,
clientOffset: this.clientOffset_,
sidxMapping: this.sidxMapping_
}));
var r = Op(i, n);
r ? (this.masterPlaylistLoader_ ? this.masterPlaylistLoader_.master = r : this.master = r,
this.media_ = r.playlists[e]) : (this.media_ = i.playlists[e],
this.trigger("playlistunchanged")),
this.media().endList || (this.mediaUpdateTimeout = dr["default"].setTimeout(function() {
t.trigger("mediaupdatetimeout")
}, kf(this.media(), !!r))),
this.trigger("loadedplaylist")
}
,
t
}(Pp), jp = {
GOAL_BUFFER_LENGTH: 30,
MAX_GOAL_BUFFER_LENGTH: 60,
BACK_BUFFER_LENGTH: 30,
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
}, Vp = function(e) {
for (var t = new Uint8Array(new ArrayBuffer(e.length)), i = 0; i < e.length; i++)
t[i] = e.charCodeAt(i);
return t.buffer
}, qp = [], Hp = function(e, t, i) {
var n = e.data.segment
, r = n.type
, a = n.initSegment
, s = n.captions
, o = n.captionStreams
, u = n.metadata
, l = n.videoFrameDtsTime
, c = n.videoFramePtsTime;
t.buffer.push({
captions: s,
captionStreams: o,
metadata: u
});
var d = e.data.segment.boxes || {
data: e.data.segment.data
}
, h = {
type: r,
data: new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),
initSegment: new Uint8Array(a.data,a.byteOffset,a.byteLength)
};
"undefined" != typeof l && (h.videoFrameDtsTime = l),
"undefined" != typeof c && (h.videoFramePtsTime = c),
i(h)
}, Wp = function(e) {
var t = e.transmuxedData
, i = e.callback;
t.buffer = [],
i(t)
}, zp = function(e, t) {
t.gopInfo = e.data.gopInfo
}, Gp = function(e) {
var t = e.transmuxer
, i = e.bytes
, n = e.audioAppendStart
, r = e.gopsToAlignWith
, a = e.isPartial
, s = e.remux
, o = e.onData
, u = e.onTrackInfo
, l = e.onAudioTimingInfo
, c = e.onVideoTimingInfo
, d = e.onVideoSegmentTimingInfo
, h = e.onId3
, f = e.onCaptions
, p = e.onDone
, m = {
isPartial: a,
buffer: []
}
, g = function(e) {
uf && ("data" === e.data.action && Hp(e, m, o),
"trackinfo" === e.data.action && u(e.data.trackInfo),
"gopInfo" === e.data.action && zp(e, m),
"audioTimingInfo" === e.data.action && l(e.data.audioTimingInfo),
"videoTimingInfo" === e.data.action && c(e.data.videoTimingInfo),
"videoSegmentTimingInfo" === e.data.action && d(e.data.videoSegmentTimingInfo),
"id3Frame" === e.data.action && h([e.data.id3Frame], e.data.id3Frame.dispatchType),
"caption" === e.data.action && f(e.data.caption),
"transmuxed" === e.data.type && (t.onmessage = null,
Wp({
transmuxedData: m,
callback: p
}),
Xp()))
};
if (t.onmessage = g,
n && t.postMessage({
action: "setAudioAppendStart",
appendStart: n
}),
Array.isArray(r) && t.postMessage({
action: "alignGopsWith",
gopsToAlignWith: r
}),
"undefined" != typeof s && t.postMessage({
action: "setRemux",
remux: s
}),
i.byteLength) {
var v = i instanceof ArrayBuffer ? i : i.buffer
, y = i instanceof ArrayBuffer ? 0 : i.byteOffset;
t.postMessage({
action: "push",
data: v,
byteOffset: y,
byteLength: i.byteLength
}, [v])
}
t.postMessage({
action: a ? "partialFlush" : "flush"
})
}, Xp = function() {
uf = null,
qp.length && (uf = qp.shift(),
"function" == typeof uf ? uf() : Gp(uf))
}, Kp = function(e, t) {
e.postMessage({
action: t
}),
Xp()
}, Yp = function(e, t) {
return uf ? void qp.push(Kp.bind(null, t, e)) : (uf = e,
void Kp(t, e))
}, $p = function(e) {
Yp("reset", e)
}, Qp = function(e) {
Yp("endTimeline", e)
}, Jp = function(e) {
return uf ? void qp.push(e) : (uf = e,
void Gp(e))
}, Zp = function() {
uf = null,
qp.length = 0
}, em = {
reset: $p,
dispose: Zp,
endTimeline: Qp,
transmux: Jp
}, tm = function(e, t) {
var i = lu.inspect(e, t * Wo);
if (!i)
return null;
var n = {
hasVideo: i.video && 2 === i.video.length || !1,
hasAudio: i.audio && 2 === i.audio.length || !1
};
return n.hasVideo && (n.videoStart = i.video[0].ptsTime),
n.hasAudio && (n.audioStart = i.audio[0].ptsTime),
n
}, im = function(e) {
var t, i = 0;
return e.bytes && (t = new Uint8Array(e.bytes),
e.segments.forEach(function(e) {
t.set(e, i),
i += e.byteLength
})),
t
}, nm = {
FAILURE: 2,
TIMEOUT: -101,
ABORTED: -102
}, rm = function(e) {
e.forEach(function(e) {
e.abort()
})
}, am = function(e) {
return {
bandwidth: e.bandwidth,
bytesReceived: e.bytesReceived || 0,
roundTripTime: e.roundTripTime || 0
}
}, sm = function(e) {
var t = e.target
, i = Date.now() - t.requestTime
, n = {
bandwidth: 1 / 0,
bytesReceived: 0,
roundTripTime: i || 0
};
return n.bytesReceived = e.loaded,
n.bandwidth = Math.floor(n.bytesReceived / n.roundTripTime * 8 * 1e3),
n
}, om = function(e, t) {
return t.timedout ? {
status: t.status,
message: "HLS request timed-out at URL: " + t.uri,
code: nm.TIMEOUT,
xhr: t
} : t.aborted ? {
status: t.status,
message: "HLS request aborted at URL: " + t.uri,
code: nm.ABORTED,
xhr: t
} : e ? {
status: t.status,
message: "HLS request errored at URL: " + t.uri,
code: nm.FAILURE,
xhr: t
} : null
}, um = function(e, t) {
return function(i, n) {
var r = n.response
, a = om(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: nm.FAILURE,
xhr: n
}, e);
var s = new DataView(r);
return e.key.bytes = new Uint32Array([s.getUint32(0), s.getUint32(4), s.getUint32(8), s.getUint32(12)]),
t(null, e)
}
}, lm = function(e) {
var t = e.segment
, i = e.finishProcessingFn;
return function(e, n) {
var r = n.response
, a = om(e, n);
if (a)
return i(a, t);
if (0 === r.byteLength)
return i({
status: n.status,
message: "Empty HLS segment content at URL: " + n.uri,
code: nm.FAILURE,
xhr: n
}, t);
t.map.bytes = new Uint8Array(n.response);
var s = Ys(t.map.bytes);
if ("mp4" !== s)
return i({
status: n.status,
message: "Found unsupported " + (s || "unknown") + " container for initialization segment at URL: " + n.uri,
code: nm.FAILURE,
internal: !0,
xhr: n
}, t);
var o = xu.tracks(t.map.bytes);
return o.forEach(function(e) {
t.map.tracks = t.map.tracks || {},
t.map.tracks[e.type] || (t.map.tracks[e.type] = e,
e.id && e.timescale && (t.map.timescales = t.map.timescales || {},
t.map.timescales[e.id] = e.timescale))
}),
i(null, t)
}
}, cm = function(e) {
var t = e.segment
, i = e.finishProcessingFn
, n = e.responseType;
return function(e, r) {
var a = r.response
, s = om(e, r);
if (s)
return i(s, t);
var o = "arraybuffer" !== n && r.responseText ? Vp(r.responseText.substring(t.lastReachedChar || 0)) : r.response;
return 0 === a.byteLength ? i({
status: r.status,
message: "Empty HLS segment content at URL: " + r.uri,
code: nm.FAILURE,
xhr: r
}, t) : (t.stats = am(r),
t.key ? t.encryptedBytes = new Uint8Array(o) : t.bytes = new Uint8Array(o),
i(null, t))
}
}, dm = function(e) {
var t = e.segment
, i = e.bytes
, n = e.isPartial
, r = e.trackInfoFn
, a = e.timingInfoFn
, s = e.videoSegmentTimingInfoFn
, o = e.id3Fn
, u = e.captionsFn
, l = e.dataFn
, c = e.doneFn
, d = t.map && t.map.tracks || {}
, h = Boolean(d.audio && d.video)
, f = a.bind(null, t, "audio", "start")
, p = a.bind(null, t, "audio", "end")
, m = a.bind(null, t, "video", "start")
, g = a.bind(null, t, "video", "end");
if (!n && !t.lastReachedChar) {
var v = tm(i, t.baseStartTime);
v && (r(t, {
hasAudio: v.hasAudio,
hasVideo: v.hasVideo,
isMuxed: h
}),
r = null,
v.hasAudio && !h && f(v.audioStart),
v.hasVideo && m(v.videoStart),
f = null,
m = null)
}
Jp({
bytes: i,
transmuxer: t.transmuxer,
audioAppendStart: t.audioAppendStart,
gopsToAlignWith: t.gopsToAlignWith,
isPartial: n,
remux: h,
onData: function(e) {
e.type = "combined" === e.type ? "video" : e.type,
l(t, e)
},
onTrackInfo: function(e) {
r && (h && (e.isMuxed = !0),
r(t, e))
},
onAudioTimingInfo: function(e) {
f && "undefined" != typeof e.start && (f(e.start),
f = null),
p && "undefined" != typeof e.end && p(e.end)
},
onVideoTimingInfo: function(e) {
m && "undefined" != typeof e.start && (m(e.start),
m = null),
g && "undefined" != typeof e.end && g(e.end)
},
onVideoSegmentTimingInfo: function(e) {
s(e)
},
onId3: function(e, i) {
o(t, e, i)
},
onCaptions: function(e) {
u(t, [e])
},
onDone: function(e) {
c && !n && (e.type = "combined" === e.type ? "video" : e.type,
c(null, t, e))
}
})
}, hm = function(e) {
var t = e.segment
, i = e.bytes
, n = e.isPartial
, r = e.trackInfoFn
, a = e.timingInfoFn
, s = e.videoSegmentTimingInfoFn
, o = e.id3Fn
, u = e.captionsFn
, l = e.dataFn
, c = e.doneFn
, d = new Uint8Array(i);
if (Qs(d)) {
t.isFmp4 = !0;
var h = t.map.tracks
, f = {
isFmp4: !0,
hasVideo: !!h.video,
hasAudio: !!h.audio
};
h.audio && h.audio.codec && "enca" !== h.audio.codec && (f.audioCodec = h.audio.codec),
h.video && h.video.codec && "encv" !== h.video.codec && (f.videoCodec = h.video.codec),
h.video && h.audio && (f.isMuxed = !0),
r(t, f);
var p = xu.startTime(t.map.timescales, d);
f.hasAudio && !f.isMuxed && a(t, "audio", "start", p),
f.hasVideo && a(t, "video", "start", p);
var m = function(e) {
l(t, {
data: i,
type: f.hasAudio && !f.isMuxed ? "audio" : "video"
}),
e && e.length && u(t, e),
c(null, t, {})
};
if (!h.video || !i.byteLength || !t.transmuxer)
return void m();
var g = i instanceof ArrayBuffer ? i : i.buffer
, v = i instanceof ArrayBuffer ? 0 : i.byteOffset
, y = function _(e) {
if ("mp4Captions" === e.data.action) {
t.transmuxer.removeEventListener("message", _);
var n = e.data.data;
t.bytes = i = new Uint8Array(n,n.byteOffset || 0,n.byteLength),
m(e.data.captions)
}
};
return t.transmuxer.addEventListener("message", y),
void t.transmuxer.postMessage({
action: "pushMp4Captions",
timescales: t.map.timescales,
trackIds: [h.video.id],
data: g,
byteOffset: v,
byteLength: i.byteLength
}, [g])
}
return t.transmuxer ? ("undefined" == typeof t.container && (t.container = Ys(d)),
"ts" !== t.container && "aac" !== t.container ? (r(t, {
hasAudio: !1,
hasVideo: !1
}),
void c(null, t, {})) : void dm({
segment: t,
bytes: i,
isPartial: n,
trackInfoFn: r,
timingInfoFn: a,
videoSegmentTimingInfoFn: s,
id3Fn: o,
captionsFn: u,
dataFn: l,
doneFn: c
})) : void c(null, t, {})
}, fm = function(e) {
var t = e.decryptionWorker
, i = e.segment
, n = e.trackInfoFn
, r = e.timingInfoFn
, a = e.videoSegmentTimingInfoFn
, s = e.id3Fn
, o = e.captionsFn
, u = e.dataFn
, l = e.doneFn
, c = function h(e) {
if (e.data.source === i.requestId) {
t.removeEventListener("message", h);
var c = e.data.decrypted;
i.bytes = new Uint8Array(c.bytes,c.byteOffset,c.byteLength),
hm({
segment: i,
bytes: i.bytes,
isPartial: !1,
trackInfoFn: n,
timingInfoFn: r,
videoSegmentTimingInfoFn: a,
id3Fn: s,
captionsFn: o,
dataFn: u,
doneFn: l
})
}
};
t.addEventListener("message", c);
var d;
d = i.key.bytes.slice ? i.key.bytes.slice() : new Uint32Array(Array.prototype.slice.call(i.key.bytes)),
t.postMessage(hp({
source: i.requestId,
encrypted: i.encryptedBytes,
key: d,
iv: i.key.iv
}), [i.encryptedBytes.buffer, d.buffer])
}, pm = function(e) {
var t = e.activeXhrs
, i = e.decryptionWorker
, n = e.trackInfoFn
, r = e.timingInfoFn
, a = e.videoSegmentTimingInfoFn
, s = e.id3Fn
, o = e.captionsFn
, u = e.dataFn
, l = e.doneFn
, c = 0
, d = !1;
return function(e, h) {
if (!d) {
if (e)
return d = !0,
rm(t),
l(e, h);
if (c += 1,
c === t.length) {
if (h.endOfAllRequests = Date.now(),
h.encryptedBytes)
return fm({
decryptionWorker: i,
segment: h,
trackInfoFn: n,
timingInfoFn: r,
videoSegmentTimingInfoFn: a,
id3Fn: s,
captionsFn: o,
dataFn: u,
doneFn: l
});
hm({
segment: h,
bytes: h.bytes,
isPartial: !1,
trackInfoFn: n,
timingInfoFn: r,
videoSegmentTimingInfoFn: a,
id3Fn: s,
captionsFn: o,
dataFn: u,
doneFn: l
})
}
}
}
}, mm = function(e) {
var t = e.loadendState
, i = e.abortFn;
return function(e) {
var n = e.target;
n.aborted && i && !t.calledAbortFn && (i(),
t.calledAbortFn = !0)
}
}, gm = function(e) {
var t = e.segment
, i = e.progressFn
, n = e.trackInfoFn
, r = e.timingInfoFn
, a = e.videoSegmentTimingInfoFn
, s = e.id3Fn
, o = e.captionsFn
, u = e.dataFn
, l = e.handlePartialData;
return function(e) {
var c = e.target;
if (!c.aborted) {
if (l && !t.key && c.responseText && c.responseText.length >= 8) {
var d = Vp(c.responseText.substring(t.lastReachedChar || 0));
(t.lastReachedChar || !Qs(new Uint8Array(d))) && (t.lastReachedChar = c.responseText.length,
hm({
segment: t,
bytes: d,
isPartial: !0,
trackInfoFn: n,
timingInfoFn: r,
videoSegmentTimingInfoFn: a,
id3Fn: s,
captionsFn: o,
dataFn: u
}))
}
return t.stats = pn.mergeOptions(t.stats, sm(e)),
!t.stats.firstBytesReceivedAt && t.stats.bytesReceived && (t.stats.firstBytesReceivedAt = Date.now()),
i(e, t)
}
}
}, vm = function(e) {
var t = e.xhr
, i = e.xhrOptions
, n = e.decryptionWorker
, r = e.segment
, a = e.abortFn
, s = e.progressFn
, o = e.trackInfoFn
, u = e.timingInfoFn
, l = e.videoSegmentTimingInfoFn
, c = e.id3Fn
, d = e.captionsFn
, h = e.dataFn
, f = e.doneFn
, p = e.handlePartialData
, m = []
, g = pm({
activeXhrs: m,
decryptionWorker: n,
trackInfoFn: o,
timingInfoFn: u,
videoSegmentTimingInfoFn: l,
id3Fn: c,
captionsFn: d,
dataFn: h,
doneFn: f
});
if (r.key && !r.key.bytes) {
var v = pn.mergeOptions(i, {
uri: r.key.resolvedUri,
responseType: "arraybuffer"
})
, y = um(r, g)
, _ = t(v, y);
m.push(_)
}
if (r.map && !r.map.bytes) {
var b = pn.mergeOptions(i, {
uri: r.map.resolvedUri,
responseType: "arraybuffer",
headers: up(r.map)
})
, T = lm({
segment: r,
finishProcessingFn: g
})
, S = t(b, T);
m.push(S)
}
var C = pn.mergeOptions(i, {
uri: r.resolvedUri,
responseType: "arraybuffer",
headers: up(r)
});
p && (C.responseType = "text",
C.beforeSend = function(e) {
e.overrideMimeType("text/plain; charset=x-user-defined")
}
);
var E = cm({
segment: r,
finishProcessingFn: g,
responseType: C.responseType
})
, k = t(C, E);
k.addEventListener("progress", gm({
segment: r,
progressFn: s,
trackInfoFn: o,
timingInfoFn: u,
videoSegmentTimingInfoFn: l,
id3Fn: c,
captionsFn: d,
dataFn: h,
handlePartialData: p
})),
m.push(k);
var w = {};
return m.forEach(function(e) {
e.addEventListener("loadend", mm({
loadendState: w,
abortFn: a
}))
}),
function() {
return rm(m)
}
}, ym = "undefined" != typeof window ? window : {}, _m = "undefined" == typeof Symbol ? "__target" : Symbol(), bm = "application/javascript", Tm = ym.BlobBuilder || ym.WebKitBlobBuilder || ym.MozBlobBuilder || ym.MSBlobBuilder, Sm = ym.URL || ym.webkitURL || Sm && Sm.msURL, Cm = ym.Worker;
if (Cm) {
var Em, km = gn("self.onmessage = function () {}"), wm = new Uint8Array(1);
try {
Em = new Cm(km),
Em.postMessage(wm, [wm.buffer])
} catch (qa) {
Cm = null
} finally {
Sm.revokeObjectURL(km),
Em && Em.terminate()
}
}
var Im, Am = new mn("./transmuxer-worker.worker.js",function() {
var e = this;
!function() {
var t = 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) : !1
}
,
this.trigger = function(t) {
var i, n, r, a;
if (i = e[t])
if (2 === arguments.length)
for (r = i.length,
n = 0; r > n; ++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; r > n; ++n)
i[n].apply(this, a)
}
}
,
this.dispose = function() {
e = {}
}
}
};
t.prototype.pipe = function(e) {
return this.on("data", function(t) {
e.push(t)
}),
this.on("done", function(t) {
e.flush(t)
}),
this.on("partialdone", function(t) {
e.partialFlush(t)
}),
this.on("endedtimeline", function(t) {
e.endTimeline(t)
}),
this.on("reset", function(t) {
e.reset(t)
}),
e
}
,
t.prototype.push = function(e) {
this.trigger("data", e)
}
,
t.prototype.flush = function(e) {
this.trigger("done", e)
}
,
t.prototype.partialFlush = function(e) {
this.trigger("partialdone", e)
}
,
t.prototype.endTimeline = function(e) {
this.trigger("endedtimeline", e)
}
,
t.prototype.reset = function(e) {
this.trigger("reset", e)
}
;
var i, n, r, a, s, o, u, l, c, d, h, f, p, m, g, v, y, _, b, T, S, C, E, k, w, I, A, x, P, L, D, O, N, M, R, U, F = t, B = Math.pow(2, 32) - 1;
!function() {
var e;
if (E = {
avc1: [],
avcC: [],
btrt: [],
dinf: [],
dref: [],
esds: [],
ftyp: [],
hdlr: [],
mdat: [],
mdhd: [],
mdia: [],
mfhd: [],
minf: [],
moof: [],
moov: [],
mp4a: [],
mvex: [],
mvhd: [],
pasp: [],
sdtp: [],
smhd: [],
stbl: [],
stco: [],
stsc: [],
stsd: [],
stsz: [],
stts: [],
styp: [],
tfdt: [],
tfhd: [],
traf: [],
trak: [],
trun: [],
trex: [],
tkhd: [],
vmhd: []
},
"undefined" != typeof Uint8Array) {
for (e in E)
E.hasOwnProperty(e) && (E[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e.charCodeAt(3)]);
k = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]),
I = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]),
w = new Uint8Array([0, 0, 0, 1]),
A = 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]),
x = 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]),
P = {
video: A,
audio: x
},
O = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]),
D = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]),
N = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]),
M = N,
R = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
U = N,
L = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
}
}(),
i = 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
}
,
n = function() {
return i(E.dinf, i(E.dref, O))
}
,
r = function(e) {
return i(E.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]))
}
,
a = function() {
return i(E.ftyp, k, w, k, I)
}
,
v = function(e) {
return i(E.hdlr, P[e])
}
,
s = function(e) {
return i(E.mdat, e)
}
,
g = 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),
i(E.mdhd, t)
}
,
m = function(e) {
return i(E.mdia, g(e), v(e.type), u(e))
}
,
o = function(e) {
return i(E.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8, 255 & e]))
}
,
u = function(e) {
return i(E.minf, "video" === e.type ? i(E.vmhd, L) : i(E.smhd, D), n(), _(e))
}
,
l = function(e, t) {
for (var n = [], r = t.length; r--; )
n[r] = T(t[r]);
return i.apply(null, [E.moof, o(e)].concat(n))
}
,
c = function(e) {
for (var t = e.length, n = []; t--; )
n[t] = f(e[t]);
return i.apply(null, [E.moov, h(4294967295)].concat(n).concat(d(e)))
}
,
d = function(e) {
for (var t = e.length, n = []; t--; )
n[t] = S(e[t]);
return i.apply(null, [E.mvex].concat(n))
}
,
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 i(E.mvhd, t)
}
,
y = function(e) {
var t, n, r = e.samples || [], a = new Uint8Array(4 + r.length);
for (n = 0; n < r.length; n++)
t = r[n].flags,
a[n + 4] = t.dependsOn << 4 | t.isDependedOn << 2 | t.hasRedundancy;
return i(E.sdtp, a)
}
,
_ = function(e) {
return i(E.stbl, b(e), i(E.stts, U), i(E.stsc, M), i(E.stsz, R), i(E.stco, N))
}
,
function() {
var e, t;
b = function(n) {
return i(E.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === n.type ? e(n) : t(n))
}
,
e = function(e) {
var t, n, r = e.sps || [], a = e.pps || [], s = [], o = [];
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]));
for (t = 0; t < a.length; t++)
o.push((65280 & a[t].byteLength) >>> 8),
o.push(255 & a[t].byteLength),
o = o.concat(Array.prototype.slice.call(a[t]));
if (n = [E.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]), i(E.avcC, new Uint8Array([1, e.profileIdc, e.profileCompatibility, e.levelIdc, 255].concat([r.length], s, [a.length], o))), i(E.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192]))],
e.sarRatio) {
var u = e.sarRatio[0]
, l = e.sarRatio[1];
n.push(i(E.pasp, new Uint8Array([(4278190080 & u) >> 24, (16711680 & u) >> 16, (65280 & u) >> 8, 255 & u, (4278190080 & l) >> 24, (16711680 & l) >> 16, (65280 & l) >> 8, 255 & l])))
}
return i.apply(null, n)
}
,
t = function(e) {
return i(E.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]), r(e))
}
}(),
p = 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 i(E.tkhd, t)
}
,
T = function(e) {
var t, n, r, a, s, o, u;
return t = i(E.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 / (B + 1)),
u = Math.floor(e.baseMediaDecodeTime % (B + 1)),
n = i(E.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 = C(e, s),
i(E.traf, t, n, r)) : (a = y(e),
r = C(e, a.length + s),
i(E.traf, t, n, r, a))
}
,
f = function(e) {
return e.duration = e.duration || 4294967295,
i(E.trak, p(e), m(e))
}
,
S = 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),
i(E.trex, t)
}
,
function() {
var e, t, n;
n = function(e, t) {
var i = 0
, n = 0
, r = 0
, a = 0;
return e.length && (void 0 !== e[0].duration && (i = 1),
void 0 !== e[0].size && (n = 2),
void 0 !== e[0].flags && (r = 4),
void 0 !== e[0].compositionTimeOffset && (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, u, l;
for (o = e.samples || [],
t += 20 + 16 * o.length,
s = n(o, t),
a = new Uint8Array(s.length + 16 * o.length),
a.set(s),
r = s.length,
l = 0; l < o.length; l++)
u = o[l],
a[r++] = (4278190080 & u.duration) >>> 24,
a[r++] = (16711680 & u.duration) >>> 16,
a[r++] = (65280 & u.duration) >>> 8,
a[r++] = 255 & u.duration,
a[r++] = (4278190080 & u.size) >>> 24,
a[r++] = (16711680 & u.size) >>> 16,
a[r++] = (65280 & u.size) >>> 8,
a[r++] = 255 & u.size,
a[r++] = u.flags.isLeading << 2 | u.flags.dependsOn,
a[r++] = u.flags.isDependedOn << 6 | u.flags.hasRedundancy << 4 | u.flags.paddingValue << 1 | u.flags.isNonSyncSample,
a[r++] = 61440 & u.flags.degradationPriority,
a[r++] = 15 & u.flags.degradationPriority,
a[r++] = (4278190080 & u.compositionTimeOffset) >>> 24,
a[r++] = (16711680 & u.compositionTimeOffset) >>> 16,
a[r++] = (65280 & u.compositionTimeOffset) >>> 8,
a[r++] = 255 & u.compositionTimeOffset;
return i(E.trun, a)
}
,
e = function(e, t) {
var r, a, s, o, u, l;
for (o = e.samples || [],
t += 20 + 8 * o.length,
s = n(o, t),
r = new Uint8Array(s.length + 8 * o.length),
r.set(s),
a = s.length,
l = 0; l < o.length; l++)
u = o[l],
r[a++] = (4278190080 & u.duration) >>> 24,
r[a++] = (16711680 & u.duration) >>> 16,
r[a++] = (65280 & u.duration) >>> 8,
r[a++] = 255 & u.duration,
r[a++] = (4278190080 & u.size) >>> 24,
r[a++] = (16711680 & u.size) >>> 16,
r[a++] = (65280 & u.size) >>> 8,
r[a++] = 255 & u.size;
return i(E.trun, r)
}
,
C = function(i, n) {
return "audio" === i.type ? e(i, n) : t(i, n)
}
}();
var j, V, q, H, W, z, G, X, K = {
ftyp: a,
mdat: s,
moof: l,
moov: c,
initSegment: function(e) {
var t, i = a(), n = c(e);
return t = new Uint8Array(i.byteLength + n.byteLength),
t.set(i),
t.set(n, i.byteLength),
t
}
}, Y = function(e) {
var t, i, n = [], r = [];
for (r.byteLength = 0,
r.nalCount = 0,
r.duration = 0,
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.byteLength += n.byteLength,
r.nalCount += n.length,
r.duration += n.duration,
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.byteLength += n.byteLength,
r.nalCount += n.length,
r.duration += n.duration,
r.push(n),
r
}, $ = 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
}, Q = 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
}, J = function() {
return {
size: 0,
flags: {
isLeading: 0,
dependsOn: 1,
isDependedOn: 0,
hasRedundancy: 0,
degradationPriority: 0,
isNonSyncSample: 1
}
}
}, Z = function(e, t) {
var i = J();
return i.dataOffset = t,
i.compositionTimeOffset = e.pts - e.dts,
i.duration = e.duration,
i.size = 4 * e.length,
i.size += e.byteLength,
e.keyFrame && (i.flags.dependsOn = 2,
i.flags.isNonSyncSample = 0),
i
}, et = function(e, t) {
var i, n, r, a, s, o = t || 0, u = [];
for (i = 0; i < e.length; i++)
for (a = e[i],
n = 0; n < a.length; n++)
s = a[n],
r = Z(s, o),
o += r.size,
u.push(r);
return u
}, tt = function(e) {
var t, i, n, r, a, s, o = 0, u = e.byteLength, l = e.nalCount, c = u + 4 * l, d = new Uint8Array(c), h = new DataView(d.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],
h.setUint32(o, s.data.byteLength),
o += 4,
d.set(s.data, o),
o += s.data.byteLength;
return d
}, it = function(e, t) {
var i, n = t || 0, r = [];
return i = Z(e, n),
r.push(i),
r
}, nt = function(e) {
var t, i, n = 0, r = e.byteLength, a = e.length, s = r + 4 * a, o = new Uint8Array(s), u = new DataView(o.buffer);
for (t = 0; t < e.length; t++)
i = e[t],
u.setUint32(n, i.data.byteLength),
n += 4,
o.set(i.data, n),
n += i.data.byteLength;
return o
}, rt = {
groupNalsIntoFrames: Y,
groupFramesIntoGops: $,
extendFirstKeyFrame: Q,
generateSampleTable: et,
concatenateNalData: tt,
generateSampleTableForFrame: it,
concatenateNalDataForFrame: nt
}, at = [33, 16, 5, 32, 164, 27], st = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252], ot = function(e) {
for (var t = []; e--; )
t.push(0);
return t
}, ut = 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
}, {})
}, lt = function() {
if (!j) {
var e = {
96e3: [at, [227, 64], ot(154), [56]],
88200: [at, [231], ot(170), [56]],
64e3: [at, [248, 192], ot(240), [56]],
48e3: [at, [255, 192], ot(268), [55, 148, 128], ot(54), [112]],
44100: [at, [255, 192], ot(268), [55, 163, 128], ot(84), [112]],
32e3: [at, [255, 192], ot(268), [55, 234], ot(226), [112]],
24e3: [at, [255, 192], ot(268), [55, 255, 128], ot(268), [111, 112], ot(126), [224]],
16e3: [at, [255, 192], ot(268), [55, 255, 128], ot(268), [111, 255], ot(269), [223, 108], ot(195), [1, 192]],
12e3: [st, ot(268), [3, 127, 248], ot(268), [6, 255, 240], ot(268), [13, 255, 224], ot(268), [27, 253, 128], ot(259), [56]],
11025: [st, ot(268), [3, 127, 248], ot(268), [6, 255, 240], ot(268), [13, 255, 224], ot(268), [27, 255, 192], ot(268), [55, 175, 128], ot(108), [112]],
8e3: [st, ot(268), [3, 121, 16], ot(47), [7]]
};
j = ut(e)
}
return j
}, ct = 9e4;
V = function(e) {
return e * ct
}
,
q = function(e, t) {
return e * t
}
,
H = function(e) {
return e / ct
}
,
W = function(e, t) {
return e / t
}
,
z = function(e, t) {
return V(W(e, t))
}
,
G = function(e, t) {
return q(H(e), t)
}
,
X = function(e, t, i) {
return H(i ? e : e - t)
}
;
var dt = {
ONE_SECOND_IN_TS: ct,
secondsToVideoTs: V,
secondsToAudioTs: q,
videoTsToSeconds: H,
audioTsToSeconds: W,
audioTsToVideoTs: z,
videoTsToAudioTs: G,
metadataTsToSeconds: X
}
, ht = dt.secondsToVideoTs
, ft = dt.videoTsToSeconds
, pt = function(e) {
var t, i, n = 0;
for (t = 0; t < e.length; t++)
i = e[t],
n += i.data.byteLength;
return n
}
, mt = function(e, t, i, n) {
var r, a, s, o, u = 0, l = 0, c = 0, d = 0;
if (t.length && (r = dt.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate),
u = Math.ceil(dt.ONE_SECOND_IN_TS / (e.samplerate / 1024)),
i && n && (l = r - Math.max(i, n),
c = Math.floor(l / u),
d = c * u),
!(1 > c || d > dt.ONE_SECOND_IN_TS / 2))) {
for (a = lt()[e.samplerate],
a || (a = t[0].data),
s = 0; c > s; s++)
o = t[0],
t.splice(0, 0, {
data: a,
dts: o.dts - u,
pts: o.pts - u
});
e.baseMediaDecodeTime -= Math.floor(dt.videoTsToAudioTs(d, e.samplerate))
}
}
, gt = function(e, t, i) {
return t.minSegmentDts >= i ? e : (t.minSegmentDts = 1 / 0,
e.filter(function(e) {
return e.dts >= i ? (t.minSegmentDts = Math.min(t.minSegmentDts, e.dts),
t.minSegmentPts = t.minSegmentDts,
!0) : !1
}))
}
, vt = 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
}
, yt = function(e) {
var t, i, n = 0, r = new Uint8Array(pt(e));
for (t = 0; t < e.length; t++)
i = e[t],
r.set(i.data, n),
n += i.data.byteLength;
return r
}
, _t = {
prefixWithSilence: mt,
trimAdtsFramesByEarliestDts: gt,
generateSampleTable: vt,
concatenateFrameData: yt
}
, bt = dt.ONE_SECOND_IN_TS
, Tt = function(e, t) {
"number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t.pts),
e.minSegmentPts = void 0 === e.minSegmentPts ? t.pts : Math.min(e.minSegmentPts, t.pts),
e.maxSegmentPts = void 0 === e.maxSegmentPts ? t.pts : Math.max(e.maxSegmentPts, t.pts)),
"number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts && (e.timelineStartInfo.dts = t.dts),
e.minSegmentDts = void 0 === e.minSegmentDts ? t.dts : Math.min(e.minSegmentDts, t.dts),
e.maxSegmentDts = void 0 === e.maxSegmentDts ? t.dts : Math.max(e.maxSegmentDts, t.dts))
}
, St = function(e) {
delete e.minSegmentDts,
delete e.maxSegmentDts,
delete e.minSegmentPts,
delete e.maxSegmentPts
}
, Ct = function(e, t) {
var i, n, r = e.minSegmentDts;
return t || (r -= e.timelineStartInfo.dts),
i = e.timelineStartInfo.baseMediaDecodeTime,
i += r,
i = Math.max(0, i),
"audio" === e.type && (n = e.samplerate / bt,
i *= n,
i = Math.floor(i)),
i
}
, Et = {
clearDtsInfo: St,
calculateTrackBaseMediaDecodeTime: Ct,
collectDtsInfo: Tt
}
, kt = 4
, wt = 128
, It = function(e) {
for (var t = 0, i = {
payloadType: -1,
payloadSize: 0
}, n = 0, r = 0; t < e.byteLength && e[t] !== wt; ) {
for (; 255 === e[t]; )
n += 255,
t++;
for (n += e[t++]; 255 === e[t]; )
r += 255,
t++;
if (r += e[t++],
!i.payload && n === kt) {
var a = String.fromCharCode(e[t + 3], e[t + 4], e[t + 5], e[t + 6]);
if ("GA94" === a) {
i.payloadType = n,
i.payloadSize = r,
i.payload = e.subarray(t, t + r);
break
}
i.payload = void 0
}
t += r,
n = 0,
r = 0
}
return i
}
, At = 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)
}
, xt = function(e, t) {
var i, n, r, a, s = [];
if (!(64 & t[0]))
return s;
for (n = 31 & t[0],
i = 0; n > i; 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
}
, Pt = function(e) {
for (var t, i, n = e.byteLength, r = [], a = 1; n - 2 > a; )
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; t > a; s++,
a++)
s === r[0] && (s++,
r.shift()),
i[a] = e[s];
return i
}
, Lt = {
parseSei: It,
parseUserData: At,
parseCaptionPackets: xt,
discardEmulationPreventionBytes: Pt,
USER_DATA_REGISTERED_ITU_T_T35: kt
}
, Dt = function jn() {
jn.prototype.init.call(this),
this.captionPackets_ = [],
this.ccStreams_ = [new Ft(0,0), new Ft(0,1), new Ft(1,0), new Ft(1,1)],
this.reset(),
this.ccStreams_.forEach(function(e) {
e.on("data", this.trigger.bind(this, "data")),
e.on("partialdone", this.trigger.bind(this, "partialdone")),
e.on("done", this.trigger.bind(this, "done"))
}, this)
};
Dt.prototype = new F,
Dt.prototype.push = function(e) {
var t, i, n;
if ("sei_rbsp" === e.nalUnitType && (t = Lt.parseSei(e.escapedRBSP),
t.payloadType === Lt.USER_DATA_REGISTERED_ITU_T_T35 && (i = Lt.parseUserData(t)))) {
if (e.dts < this.latestDts_)
return void (this.ignoreNextEqualDts_ = !0);
if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_)
return this.numSameDts_--,
void (this.numSameDts_ || (this.ignoreNextEqualDts_ = !1));
n = Lt.parseCaptionPackets(e.pts, i),
this.captionPackets_ = this.captionPackets_.concat(n),
this.latestDts_ !== e.dts && (this.numSameDts_ = 0),
this.numSameDts_++,
this.latestDts_ = e.dts
}
}
,
Dt.prototype.flushCCStreams = function(e) {
this.ccStreams_.forEach(function(t) {
return "flush" === e ? t.flush() : t.partialFlush()
}, this)
}
,
Dt.prototype.flushStream = function(e) {
return this.captionPackets_.length ? (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(function(e) {
e.type < 2 && this.dispatchCea608Packet(e)
}, this),
this.captionPackets_.length = 0,
void this.flushCCStreams(e)) : void this.flushCCStreams(e)
}
,
Dt.prototype.flush = function() {
return this.flushStream("flush")
}
,
Dt.prototype.partialFlush = function() {
return this.flushStream("partialFlush")
}
,
Dt.prototype.reset = function() {
this.latestDts_ = null,
this.ignoreNextEqualDts_ = !1,
this.numSameDts_ = 0,
this.activeCea608Channel_ = [null, null],
this.ccStreams_.forEach(function(e) {
e.reset()
})
}
,
Dt.prototype.dispatchCea608Packet = function(e) {
this.setsTextOrXDSActive(e) ? this.activeCea608Channel_[e.type] = null : this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (this.activeCea608Channel_[e.type] = 1),
null !== this.activeCea608Channel_[e.type] && this.ccStreams_[(e.type << 1) + this.activeCea608Channel_[e.type]].push(e)
}
,
Dt.prototype.setsChannel1Active = function(e) {
return 4096 === (30720 & e.ccData)
}
,
Dt.prototype.setsChannel2Active = function(e) {
return 6144 === (30720 & e.ccData)
}
,
Dt.prototype.setsTextOrXDSActive = function(e) {
return 256 === (28928 & e.ccData) || 4138 === (30974 & e.ccData) || 6186 === (30974 & e.ccData)
}
;
var Ot = {
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
}
, Nt = function(e) {
return null === e ? "" : (e = Ot[e] || e,
String.fromCharCode(e))
}
, Mt = 14
, Rt = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152]
, Ut = function() {
for (var e = [], t = Mt + 1; t--; )
e.push("");
return e
}
, Ft = function Vn(e, t) {
Vn.prototype.init.call(this),
this.field_ = e || 0,
this.dataChannel_ = t || 0,
this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1),
this.setConstants(),
this.reset(),
this.push = function(e) {
var t, i, n, r, a;
if (t = 32639 & e.ccData,
t === this.lastControlCode_)
return void (this.lastControlCode_ = null);
if (4096 === (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this.lastControlCode_ = null),
n = t >>> 8,
r = 255 & t,
t !== this.PADDING_)
if (t === this.RESUME_CAPTION_LOADING_)
this.mode_ = "popOn";
else if (t === this.END_OF_CAPTION_)
this.mode_ = "popOn",
this.clearFormatting(e.pts),
this.flushDisplayed(e.pts),
i = this.displayed_,
this.displayed_ = this.nonDisplayed_,
this.nonDisplayed_ = i,
this.startPts_ = e.pts;
else if (t === this.ROLL_UP_2_ROWS_)
this.rollUpRows_ = 2,
this.setRollUp(e.pts);
else if (t === this.ROLL_UP_3_ROWS_)
this.rollUpRows_ = 3,
this.setRollUp(e.pts);
else if (t === this.ROLL_UP_4_ROWS_)
this.rollUpRows_ = 4,
this.setRollUp(e.pts);
else if (t === this.CARRIAGE_RETURN_)
this.clearFormatting(e.pts),
this.flushDisplayed(e.pts),
this.shiftRowsUp_(),
this.startPts_ = e.pts;
else if (t === 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 (t === this.ERASE_DISPLAYED_MEMORY_)
this.flushDisplayed(e.pts),
this.displayed_ = Ut();
else if (t === this.ERASE_NON_DISPLAYED_MEMORY_)
this.nonDisplayed_ = Ut();
else if (t === this.RESUME_DIRECT_CAPTIONING_)
"paintOn" !== this.mode_ && (this.flushDisplayed(e.pts),
this.displayed_ = Ut()),
this.mode_ = "paintOn",
this.startPts_ = e.pts;
else if (this.isSpecialCharacter(n, r))
n = (3 & n) << 8,
a = Nt(n | r),
this[this.mode_](e.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),
n = (3 & n) << 8,
a = Nt(n | r),
this[this.mode_](e.pts, a),
this.column_++;
else if (this.isMidRowCode(n, r))
this.clearFormatting(e.pts),
this[this.mode_](e.pts, " "),
this.column_++,
14 === (14 & r) && this.addFormatting(e.pts, ["i"]),
1 === (1 & r) && this.addFormatting(e.pts, ["u"]);
else if (this.isOffsetControlCode(n, r))
this.column_ += 3 & r;
else if (this.isPAC(n, r)) {
var s = Rt.indexOf(7968 & t);
"rollUp" === this.mode_ && (s - this.rollUpRows_ + 1 < 0 && (s = this.rollUpRows_ - 1),
this.setRollUp(e.pts, s)),
s !== this.row_ && (this.clearFormatting(e.pts),
this.row_ = s),
1 & r && -1 === this.formatting_.indexOf("u") && this.addFormatting(e.pts, ["u"]),
16 === (16 & t) && (this.column_ = 4 * ((14 & t) >> 1)),
this.isColorPAC(r) && 14 === (14 & r) && this.addFormatting(e.pts, ["i"])
} else
this.isNormalChar(n) && (0 === r && (r = null),
a = Nt(n),
a += Nt(r),
this[this.mode_](e.pts, a),
this.column_ += a.length)
}
};
Ft.prototype = new F,
Ft.prototype.flushDisplayed = function(e) {
var t = this.displayed_.map(function(e) {
try {
return e.trim()
} catch (t) {
return console.error("Skipping malformed caption."),
""
}
}).join("\n").replace(/^\n+|\n+$/g, "");
t.length && this.trigger("data", {
startPts: this.startPts_,
endPts: e,
text: t,
stream: this.name_
})
}
,
Ft.prototype.reset = function() {
this.mode_ = "popOn",
this.topRow_ = 0,
this.startPts_ = 0,
this.displayed_ = Ut(),
this.nonDisplayed_ = Ut(),
this.lastControlCode_ = null,
this.column_ = 0,
this.row_ = Mt,
this.rollUpRows_ = 2,
this.formatting_ = []
}
,
Ft.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_
}
,
Ft.prototype.isSpecialCharacter = function(e, t) {
return e === this.EXT_ && t >= 48 && 63 >= t
}
,
Ft.prototype.isExtCharacter = function(e, t) {
return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && 63 >= t
}
,
Ft.prototype.isMidRowCode = function(e, t) {
return e === this.EXT_ && t >= 32 && 47 >= t
}
,
Ft.prototype.isOffsetControlCode = function(e, t) {
return e === this.OFFSET_ && t >= 33 && 35 >= t
}
,
Ft.prototype.isPAC = function(e, t) {
return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && 127 >= t
}
,
Ft.prototype.isColorPAC = function(e) {
return e >= 64 && 79 >= e || e >= 96 && 127 >= e
}
,
Ft.prototype.isNormalChar = function(e) {
return e >= 32 && 127 >= e
}
,
Ft.prototype.setRollUp = function(e, t) {
if ("rollUp" !== this.mode_ && (this.row_ = Mt,
this.mode_ = "rollUp",
this.flushDisplayed(e),
this.nonDisplayed_ = Ut(),
this.displayed_ = Ut()),
void 0 !== t && t !== this.row_)
for (var i = 0; i < this.rollUpRows_; i++)
this.displayed_[t - i] = this.displayed_[this.row_ - i],
this.displayed_[this.row_ - i] = "";
void 0 === t && (t = this.row_),
this.topRow_ = t - this.rollUpRows_ + 1
}
,
Ft.prototype.addFormatting = function(e, t) {
this.formatting_ = this.formatting_.concat(t);
var i = t.reduce(function(e, t) {
return e + "<" + t + ">"
}, "");
this[this.mode_](e, i)
}
,
Ft.prototype.clearFormatting = function(e) {
if (this.formatting_.length) {
var t = this.formatting_.reverse().reduce(function(e, t) {
return e + "</" + t + ">"
}, "");
this.formatting_ = [],
this[this.mode_](e, t)
}
}
,
Ft.prototype.popOn = function(e, t) {
var i = this.nonDisplayed_[this.row_];
i += t,
this.nonDisplayed_[this.row_] = i
}
,
Ft.prototype.rollUp = function(e, t) {
var i = this.displayed_[this.row_];
i += t,
this.displayed_[this.row_] = i
}
,
Ft.prototype.shiftRowsUp_ = function() {
var e;
for (e = 0; e < this.topRow_; e++)
this.displayed_[e] = "";
for (e = this.row_ + 1; Mt + 1 > e; e++)
this.displayed_[e] = "";
for (e = this.topRow_; e < this.row_; e++)
this.displayed_[e] = this.displayed_[e + 1];
this.displayed_[this.row_] = ""
}
,
Ft.prototype.paintOn = function(e, t) {
var i = this.displayed_[this.row_];
i += t,
this.displayed_[this.row_] = i
}
;
var Bt = {
CaptionStream: Dt,
Cea608Stream: Ft
}
, jt = {
H264_STREAM_TYPE: 27,
ADTS_STREAM_TYPE: 15,
METADATA_STREAM_TYPE: 21
}
, Vt = 8589934592
, qt = 4294967296
, Ht = "shared"
, Wt = function(e, t) {
var i = 1;
for (e > t && (i = -1); Math.abs(t - e) > qt; )
e += i * Vt;
return e
}
, zt = function qn(e) {
var t, i;
qn.prototype.init.call(this),
this.type_ = e || Ht,
this.push = function(e) {
(this.type_ === Ht || e.type === this.type_) && (void 0 === i && (i = e.dts),
e.dts = Wt(e.dts, i),
e.pts = Wt(e.pts, i),
t = e.dts,
this.trigger("data", e))
}
,
this.flush = function() {
i = t,
this.trigger("done")
}
,
this.endTimeline = function() {
this.flush(),
this.trigger("endedtimeline")
}
,
this.discontinuity = function() {
i = void 0,
t = void 0
}
,
this.reset = function() {
this.discontinuity(),
this.trigger("reset")
}
};
zt.prototype = new F;
var Gt, Xt = {
TimestampRolloverStream: zt,
handleRollover: Wt
}, Kt = function(e, t, i) {
var n, r = "";
for (n = t; i > n; n++)
r += "%" + ("00" + e[n].toString(16)).slice(-2);
return r
}, Yt = function(e, t, i) {
return decodeURIComponent(Kt(e, t, i))
}, $t = function(e, t, i) {
return unescape(Kt(e, t, i))
}, Qt = function(e) {
return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
}, Jt = {
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 = Yt(e.data, 1, t),
e.value = Yt(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 = Yt(e.data, 1, t),
e.url = Yt(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 = $t(e.data, 0, t);
break
}
e.privateData = e.data.subarray(t + 1),
e.data = e.privateData
}
};
Gt = function(e) {
var t, i = {
debug: !(!e || !e.debug),
descriptor: e && e.descriptor
}, n = 0, r = [], a = 0;
if (Gt.prototype.init.call(this),
this.dispatchType = jt.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, s, o, u, l, c;
if ("timed-metadata" === e.type) {
if (e.dataAlignmentIndicator && (a = 0,
r.length = 0),
0 === r.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 (r.push(e),
a += e.data.byteLength,
1 === r.length && (n = Qt(e.data.subarray(6, 10)),
n += 10),
!(n > a)) {
for (t = {
data: new Uint8Array(n),
frames: [],
pts: r[0].pts,
dts: r[0].dts
},
l = 0; n > l; )
t.data.set(r[0].data.subarray(0, n - l), l),
l += r[0].data.byteLength,
a -= r[0].data.byteLength,
r.shift();
s = 10,
64 & t.data[5] && (s += 4,
s += Qt(t.data.subarray(10, 14)),
n -= Qt(t.data.subarray(16, 20)));
do {
if (o = Qt(t.data.subarray(s + 4, s + 8)),
1 > o)
return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");
if (c = String.fromCharCode(t.data[s], t.data[s + 1], t.data[s + 2], t.data[s + 3]),
u = {
id: c,
data: t.data.subarray(s + 10, s + o + 10)
},
u.key = u.id,
Jt[u.id] && (Jt[u.id](u),
"com.apple.streaming.transportStreamTimestamp" === u.owner)) {
var d = u.data
, h = (1 & d[3]) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;
h *= 4,
h += 3 & d[7],
u.timeStamp = h,
void 0 === t.pts && void 0 === t.dts && (t.pts = u.timeStamp,
t.dts = u.timeStamp),
this.trigger("timestamp", u)
}
t.frames.push(u),
s += 10,
s += o
} while (n > s);
this.trigger("data", t)
}
}
}
}
,
Gt.prototype = new F;
var Zt, ei, ti, ii = Gt, ni = Xt.TimestampRolloverStream, ri = 188, ai = 71;
Zt = function() {
var e = new Uint8Array(ri)
, t = 0;
Zt.prototype.init.call(this),
this.push = function(i) {
var n, r = 0, a = ri;
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; )
n[r] !== ai || n[a] !== ai ? (r++,
a++) : (this.trigger("data", n.subarray(r, a)),
r += ri,
a += ri);
r < n.byteLength && (e.set(n.subarray(r), 0),
t = n.byteLength - r)
}
,
this.flush = function() {
t === ri && e[0] === ai && (this.trigger("data", e),
t = 0),
this.trigger("done")
}
,
this.endTimeline = function() {
this.flush(),
this.trigger("endedtimeline")
}
,
this.reset = function() {
t = 0,
this.trigger("reset")
}
}
,
Zt.prototype = new F,
ei = function() {
var e, t, i, n;
ei.prototype.init.call(this),
n = this,
this.packetsWaitingForPmt = [],
this.programMapTable = void 0,
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 = {
video: null,
audio: null,
"timed-metadata": {}
},
i = (15 & e[1]) << 8 | e[2],
r = 3 + i - 4,
a = (15 & e[10]) << 8 | e[11],
s = 12 + a; r > s; ) {
var o = e[s]
, u = (31 & e[s + 1]) << 8 | e[s + 2];
o === jt.H264_STREAM_TYPE && null === n.programMapTable.video ? n.programMapTable.video = u : o === jt.ADTS_STREAM_TYPE && null === n.programMapTable.audio ? n.programMapTable.audio = u : o === jt.METADATA_STREAM_TYPE && (n.programMapTable["timed-metadata"][u] = o),
s += ((15 & e[s + 3]) << 8 | e[s + 4]) + 5
}
t.programMapTable = n.programMapTable
}
}
,
this.push = function(t) {
var i = {}
, n = 4;
if (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);
else if (i.pid === this.pmtPid)
for (i.type = "pmt",
e(t.subarray(n), i),
this.trigger("data", i); this.packetsWaitingForPmt.length; )
this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
else
void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, n, i]) : this.processPes_(t, n, i)
}
,
this.processPes_ = function(e, t, i) {
i.streamType = i.pid === this.programMapTable.video ? jt.H264_STREAM_TYPE : i.pid === this.programMapTable.audio ? jt.ADTS_STREAM_TYPE : this.programMapTable["timed-metadata"][i.pid],
i.type = "pes",
i.data = e.subarray(t),
this.trigger("data", i)
}
}
,
ei.prototype = new F,
ei.STREAM_TYPES = {
h264: 27,
adts: 15
},
ti = function() {
var e, t = this, i = {
data: [],
size: 0
}, n = {
data: [],
size: 0
}, r = {
data: [],
size: 0
}, a = 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(e, i, n) {
var r, s = new Uint8Array(e.size), o = {
type: i
}, u = 0, l = 0, c = !1;
if (e.data.length && !(e.size < 9)) {
for (o.trackId = e.data[0].pid,
u = 0; u < e.data.length; u++)
r = e.data[u],
s.set(r.data, l),
l += r.data.byteLength;
a(s, o),
c = "video" === i || o.packetLength <= e.size,
(n || c) && (e.size = 0,
e.data.length = 0),
c && t.trigger("data", o)
}
};
ti.prototype.init.call(this),
this.push = function(a) {
({
pat: function() {},
pes: function() {
var e, t;
switch (a.streamType) {
case jt.H264_STREAM_TYPE:
e = i,
t = "video";
break;
case jt.ADTS_STREAM_TYPE:
e = n,
t = "audio";
break;
case jt.METADATA_STREAM_TYPE:
e = r,
t = "timed-metadata";
break;
default:
return
}
a.payloadUnitStartIndicator && s(e, t, !0),
e.data.push(a),
e.size += a.data.byteLength
},
pmt: function() {
var i = {
type: "metadata",
tracks: []
};
e = a.programMapTable,
null !== e.video && i.tracks.push({
timelineStartInfo: {
baseMediaDecodeTime: 0
},
id: +e.video,
codec: "avc",
type: "video"
}),
null !== e.audio && i.tracks.push({
timelineStartInfo: {
baseMediaDecodeTime: 0
},
id: +e.audio,
codec: "adts",
type: "audio"
}),
t.trigger("data", i)
}
})[a.type]()
}
,
this.reset = function() {
i.size = 0,
i.data.length = 0,
n.size = 0,
n.data.length = 0,
this.trigger("reset")
}
,
this.flushStreams_ = function() {
s(i, "video"),
s(n, "audio"),
s(r, "timed-metadata")
}
,
this.flush = function() {
this.flushStreams_(),
this.trigger("done")
}
}
,
ti.prototype = new F;
var si = {
PAT_PID: 0,
MP2T_PACKET_LENGTH: ri,
TransportPacketStream: Zt,
TransportParseStream: ei,
ElementaryStream: ti,
TimestampRolloverStream: ni,
CaptionStream: Bt.CaptionStream,
Cea608Stream: Bt.Cea608Stream,
MetadataStream: ii
};
for (var oi in jt)
jt.hasOwnProperty(oi) && (si[oi] = jt[oi]);
var ui, li = si, ci = dt.ONE_SECOND_IN_TS, di = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
ui = function(e) {
var t, i = 0;
ui.prototype.init.call(this),
this.push = function(n) {
var r, a, s, o, u, l, c = 0;
if (e || (i = 0),
"audio" === n.type)
for (t ? (o = t,
t = new Uint8Array(o.byteLength + n.data.byteLength),
t.set(o),
t.set(n.data, o.byteLength)) : t = n.data; c + 5 < t.length; )
if (255 === t[c] && 240 === (246 & t[c + 1])) {
if (a = 2 * (1 & ~t[c + 1]),
r = (3 & t[c + 3]) << 11 | t[c + 4] << 3 | (224 & t[c + 5]) >> 5,
u = 1024 * ((3 & t[c + 6]) + 1),
l = u * ci / di[(60 & t[c + 2]) >>> 2],
s = c + r,
t.byteLength < s)
return;
if (this.trigger("data", {
pts: n.pts + i * l,
dts: n.dts + i * l,
sampleCount: u,
audioobjecttype: (t[c + 2] >>> 6 & 3) + 1,
channelcount: (1 & t[c + 2]) << 2 | (192 & t[c + 3]) >>> 6,
samplerate: di[(60 & t[c + 2]) >>> 2],
samplingfrequencyindex: (60 & t[c + 2]) >>> 2,
samplesize: 16,
data: t.subarray(c + 7 + a, s)
}),
i++,
t.byteLength === s)
return void (t = void 0);
t = t.subarray(s)
} else
c++
}
,
this.flush = function() {
i = 0,
this.trigger("done")
}
,
this.reset = function() {
t = void 0,
this.trigger("reset")
}
,
this.endTimeline = function() {
t = void 0,
this.trigger("endedtimeline")
}
}
,
ui.prototype = new F;
var hi, fi = ui;
hi = 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; n > e; ++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()
}
;
var pi, mi, gi, vi = hi;
mi = function() {
var e, t, i = 0;
mi.prototype.init.call(this),
this.push = function(n) {
var r;
t ? (r = new Uint8Array(t.byteLength + n.data.byteLength),
r.set(t),
r.set(n.data, t.byteLength),
t = r) : t = n.data;
for (var a = t.byteLength; a - 3 > i; i++)
if (1 === t[i + 2]) {
e = i + 5;
break
}
for (; a > e; )
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] && a > e);
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.reset = function() {
t = null,
i = 0,
this.trigger("reset")
}
,
this.flush = function() {
t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)),
t = null,
i = 0,
this.trigger("done")
}
,
this.endTimeline = function() {
this.flush(),
this.trigger("endedtimeline")
}
}
,
mi.prototype = new F,
gi = {
100: !0,
110: !0,
122: !0,
244: !0,
44: !0,
83: !0,
86: !0,
118: !0,
128: !0,
138: !0,
139: !0,
134: !0
},
pi = function() {
var e, t, i, n, r, a, s, o = new mi;
pi.prototype.init.call(this),
e = this,
this.push = function(e) {
"video" === e.type && (t = e.trackId,
i = e.pts,
n = e.dts,
o.push(e))
}
,
o.on("data", function(s) {
var o = {
trackId: t,
pts: i,
dts: n,
data: s
};
switch (31 & s[0]) {
case 5:
o.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
break;
case 6:
o.nalUnitType = "sei_rbsp",
o.escapedRBSP = r(s.subarray(1));
break;
case 7:
o.nalUnitType = "seq_parameter_set_rbsp",
o.escapedRBSP = r(s.subarray(1)),
o.config = a(o.escapedRBSP);
break;
case 8:
o.nalUnitType = "pic_parameter_set_rbsp";
break;
case 9:
o.nalUnitType = "access_unit_delimiter_rbsp"
}
e.trigger("data", o)
}),
o.on("done", function() {
e.trigger("done")
}),
o.on("partialdone", function() {
e.trigger("partialdone")
}),
o.on("reset", function() {
e.trigger("reset")
}),
o.on("endedtimeline", function() {
e.trigger("endedtimeline")
}),
this.flush = function() {
o.flush()
}
,
this.partialFlush = function() {
o.partialFlush()
}
,
this.reset = function() {
o.reset()
}
,
this.endTimeline = function() {
o.endTimeline()
}
,
s = function(e, t) {
var i, n, r = 8, a = 8;
for (i = 0; e > i; i++)
0 !== a && (n = t.readExpGolomb(),
a = (r + n + 256) % 256),
r = 0 === a ? r : a
}
,
r = function(e) {
for (var t, i, n = e.byteLength, r = [], a = 1; n - 2 > a; )
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; t > a; s++,
a++)
s === r[0] && (s++,
r.shift()),
i[a] = e[s];
return i
}
,
a = function(e) {
var t, i, n, r, a, o, u, l, c, d, h, f, p, m, g = 0, v = 0, y = 0, _ = 0, b = 1;
if (t = new vi(e),
i = t.readUnsignedByte(),
r = t.readUnsignedByte(),
n = t.readUnsignedByte(),
t.skipUnsignedExpGolomb(),
gi[i] && (a = t.readUnsignedExpGolomb(),
3 === a && t.skipBits(1),
t.skipUnsignedExpGolomb(),
t.skipUnsignedExpGolomb(),
t.skipBits(1),
t.readBoolean()))
for (h = 3 !== a ? 8 : 12,
m = 0; h > m; m++)
t.readBoolean() && (6 > m ? s(16, t) : s(64, t));
if (t.skipUnsignedExpGolomb(),
o = t.readUnsignedExpGolomb(),
0 === o)
t.readUnsignedExpGolomb();
else if (1 === o)
for (t.skipBits(1),
t.skipExpGolomb(),
t.skipExpGolomb(),
u = t.readUnsignedExpGolomb(),
m = 0; u > m; m++)
t.skipExpGolomb();
if (t.skipUnsignedExpGolomb(),
t.skipBits(1),
l = t.readUnsignedExpGolomb(),
c = t.readUnsignedExpGolomb(),
d = t.readBits(1),
0 === d && t.skipBits(1),
t.skipBits(1),
t.readBoolean() && (g = t.readUnsignedExpGolomb(),
v = t.readUnsignedExpGolomb(),
y = t.readUnsignedExpGolomb(),
_ = t.readUnsignedExpGolomb()),
t.readBoolean() && t.readBoolean()) {
switch (p = t.readUnsignedByte()) {
case 1:
f = [1, 1];
break;
case 2:
f = [12, 11];
break;
case 3:
f = [10, 11];
break;
case 4:
f = [16, 11];
break;
case 5:
f = [40, 33];
break;
case 6:
f = [24, 11];
break;
case 7:
f = [20, 11];
break;
case 8:
f = [32, 11];
break;
case 9:
f = [80, 33];
break;
case 10:
f = [18, 11];
break;
case 11:
f = [15, 11];
break;
case 12:
f = [64, 33];
break;
case 13:
f = [160, 99];
break;
case 14:
f = [4, 3];
break;
case 15:
f = [3, 2];
break;
case 16:
f = [2, 1];
break;
case 255:
f = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t.readUnsignedByte()]
}
f && (b = f[0] / f[1])
}
return {
profileIdc: i,
levelIdc: n,
profileCompatibility: r,
width: Math.ceil((16 * (l + 1) - 2 * g - 2 * v) * b),
height: (2 - d) * (c + 1) * 16 - 2 * y - 2 * _,
sarRatio: f
}
}
}
,
pi.prototype = new F;
var yi, _i = {
H264Stream: pi,
NalByteStream: mi
}, bi = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], Ti = function(e, t) {
var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]
, n = e[t + 5]
, r = (16 & n) >> 4;
return i = i >= 0 ? i : 0,
r ? i + 20 : i + 10
}, Si = function Hn(e, t) {
return e.length - t < 10 || e[t] !== "I".charCodeAt(0) || e[t + 1] !== "D".charCodeAt(0) || e[t + 2] !== "3".charCodeAt(0) ? t : (t += Ti(e, t),
Hn(e, t))
}, Ci = function(e) {
var t = Si(e, 0);
return e.length >= t + 2 && 255 === (255 & e[t]) && 240 === (240 & e[t + 1]) && 16 === (22 & e[t + 1])
}, Ei = function(e) {
return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
}, ki = function(e, t, i) {
var n, r = "";
for (n = t; i > n; n++)
r += "%" + ("00" + e[n].toString(16)).slice(-2);
return r
}, wi = function(e, t, i) {
return unescape(ki(e, t, i))
}, Ii = function(e, t) {
var i = (224 & e[t + 5]) >> 5
, n = e[t + 4] << 3
, r = 6144 & e[t + 3];
return r | n | i
}, Ai = function(e, t) {
return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3".charCodeAt(0) ? "timed-metadata" : e[t] & !0 && 240 === (240 & e[t + 1]) ? "audio" : null
}, xi = function(e) {
for (var t = 0; t + 5 < e.length; ) {
if (255 === e[t] && 240 === (246 & e[t + 1]))
return bi[(60 & e[t + 2]) >>> 2];
t++
}
return null
}, Pi = function(e) {
var t, i, n, r;
t = 10,
64 & e[5] && (t += 4,
t += Ei(e.subarray(10, 14)));
do {
if (i = Ei(e.subarray(t + 4, t + 8)),
1 > i)
return null;
if (r = String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3]),
"PRIV" === r) {
n = e.subarray(t + 10, t + i + 10);
for (var a = 0; a < n.byteLength; a++)
if (0 === n[a]) {
var s = wi(n, 0, a);
if ("com.apple.streaming.transportStreamTimestamp" === s) {
var o = n.subarray(a + 1)
, u = (1 & o[3]) << 30 | o[4] << 22 | o[5] << 14 | o[6] << 6 | o[7] >>> 2;
return u *= 4,
u += 3 & o[7]
}
break
}
}
t += 10,
t += i
} while (t < e.byteLength);
return null
}, Li = {
isLikelyAacData: Ci,
parseId3TagSize: Ti,
parseAdtsSize: Ii,
parseType: Ai,
parseSampleRate: xi,
parseAacTimestamp: Pi
};
yi = function() {
var e = new Uint8Array
, t = 0;
yi.prototype.init.call(this),
this.setTimestamp = function(e) {
t = e
}
,
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 (255 !== (255 & e[u]) || 240 !== (240 & e[u + 1]))
u++;
else {
if (e.length - u < 7)
break;
if (o = Li.parseAdtsSize(e, u),
u + o > e.length)
break;
a = {
type: "audio",
data: e.subarray(u, u + o),
pts: t,
dts: t
},
this.trigger("data", a),
u += o
}
else {
if (e.length - u < 10)
break;
if (o = Li.parseId3TagSize(e, u),
u + o > 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
}
,
this.reset = function() {
e = new Uint8Array,
this.trigger("reset")
}
,
this.endTimeline = function() {
e = new Uint8Array,
this.trigger("endedtimeline")
}
}
,
yi.prototype = new F;
var Di, Oi, Ni, Mi, Ri = yi, Ui = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"], Fi = Ui, Bi = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"], ji = Bi, Vi = _i.H264Stream, qi = Li.isLikelyAacData, Hi = dt.ONE_SECOND_IN_TS, Wi = 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
}, zi = function(e, t, i, n, r, a) {
var s = i - t
, o = n - t
, u = r - i;
return {
start: {
dts: e,
pts: e + s
},
end: {
dts: e + o,
pts: e + u
},
prependedContentDuration: a,
baseMediaDecodeTime: e
}
};
Oi = function(e, t) {
var i = []
, n = 0
, r = 0
, a = 0
, s = 1 / 0;
t = t || {},
Oi.prototype.init.call(this),
this.push = function(t) {
Et.collectDtsInfo(e, t),
e && Fi.forEach(function(i) {
e[i] = t[i]
}),
i.push(t)
}
,
this.setEarliestDts = function(e) {
r = e
}
,
this.setVideoBaseMediaDecodeTime = function(e) {
s = e
}
,
this.setAudioAppendStart = function(e) {
a = e
}
,
this.flush = function() {
var o, u, l, c, d;
return 0 === i.length ? void this.trigger("done", "AudioSegmentStream") : (o = _t.trimAdtsFramesByEarliestDts(i, e, r),
e.baseMediaDecodeTime = Et.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps),
_t.prefixWithSilence(e, o, a, s),
e.samples = _t.generateSampleTable(o),
l = K.mdat(_t.concatenateFrameData(o)),
i = [],
u = K.moof(n, [e]),
c = new Uint8Array(u.byteLength + l.byteLength),
n++,
c.set(u),
c.set(l, u.byteLength),
Et.clearDtsInfo(e),
d = Math.ceil(1024 * Hi / e.samplerate),
o.length && this.trigger("timingInfo", {
start: o[0].pts,
end: o[0].pts + o.length * d
}),
this.trigger("data", {
track: e,
boxes: c
}),
void this.trigger("done", "AudioSegmentStream"))
}
,
this.reset = function() {
Et.clearDtsInfo(e),
i = [],
this.trigger("reset")
}
}
,
Oi.prototype = new F,
Di = function(e, t) {
var i, n, r = 0, a = [], s = [];
t = t || {},
Di.prototype.init.call(this),
delete e.minPTS,
this.gopCache_ = [],
this.push = function(t) {
Et.collectDtsInfo(e, t),
"seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config,
e.sps = [t.data],
ji.forEach(function(t) {
e[t] = i[t]
}, this)),
"pic_parameter_set_rbsp" !== t.nalUnitType || n || (n = t.data,
e.pps = [t.data]),
a.push(t)
}
,
this.flush = function() {
for (var i, n, o, u, l, c, d, h, f = 0; a.length && "access_unit_delimiter_rbsp" !== a[0].nalUnitType; )
a.shift();
if (0 === a.length)
return this.resetStream_(),
void this.trigger("done", "VideoSegmentStream");
if (i = rt.groupNalsIntoFrames(a),
o = rt.groupFramesIntoGops(i),
o[0][0].keyFrame || (n = this.getGopForFusion_(a[0], e),
n ? (f = n.duration,
o.unshift(n),
o.byteLength += n.byteLength,
o.nalCount += n.nalCount,
o.pts = n.pts,
o.dts = n.dts,
o.duration += n.duration) : o = rt.extendFirstKeyFrame(o)),
s.length) {
var p;
if (p = t.alignGopsAtEnd ? this.alignGopsAtEnd_(o) : this.alignGopsAtStart_(o),
!p)
return this.gopCache_.unshift({
gop: o.pop(),
pps: e.pps,
sps: e.sps
}),
this.gopCache_.length = Math.min(6, this.gopCache_.length),
a = [],
this.resetStream_(),
void this.trigger("done", "VideoSegmentStream");
Et.clearDtsInfo(e),
o = p
}
Et.collectDtsInfo(e, o),
e.samples = rt.generateSampleTable(o),
l = K.mdat(rt.concatenateNalData(o)),
e.baseMediaDecodeTime = Et.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps),
this.trigger("processedGopsInfo", o.map(function(e) {
return {
pts: e.pts,
dts: e.dts,
byteLength: e.byteLength
}
})),
d = o[0],
h = o[o.length - 1],
this.trigger("segmentTimingInfo", zi(e.baseMediaDecodeTime, d.dts, d.pts, h.dts + h.duration, h.pts + h.duration, f)),
this.trigger("timingInfo", {
start: o[0].pts,
end: o[o.length - 1].pts + o[o.length - 1].duration
}),
this.gopCache_.unshift({
gop: o.pop(),
pps: e.pps,
sps: e.sps
}),
this.gopCache_.length = Math.min(6, this.gopCache_.length),
a = [],
this.trigger("baseMediaDecodeTime", e.baseMediaDecodeTime),
this.trigger("timelineStartInfo", e.timelineStartInfo),
u = K.moof(r, [e]),
c = new Uint8Array(u.byteLength + l.byteLength),
r++,
c.set(u),
c.set(l, u.byteLength),
this.trigger("data", {
track: e,
boxes: c
}),
this.resetStream_(),
this.trigger("done", "VideoSegmentStream")
}
,
this.reset = function() {
this.resetStream_(),
a = [],
this.gopCache_.length = 0,
s.length = 0,
this.trigger("reset")
}
,
this.resetStream_ = function() {
Et.clearDtsInfo(e),
i = void 0,
n = void 0
}
,
this.getGopForFusion_ = function(t) {
var i, n, r, a, s, o = 45e3, u = 1e4, l = 1 / 0;
for (s = 0; s < this.gopCache_.length; s++)
a = this.gopCache_[s],
r = a.gop,
e.pps && Wi(e.pps[0], a.pps[0]) && e.sps && Wi(e.sps[0], a.sps[0]) && (r.dts < e.timelineStartInfo.dts || (i = t.dts - r.dts - r.duration,
i >= -u && o >= i && (!n || l > i) && (n = a,
l = i)));
return n ? n.gop : null
}
,
this.alignGopsAtStart_ = function(e) {
var t, i, n, r, a, o, u, l;
for (a = e.byteLength,
o = e.nalCount,
u = e.duration,
t = i = 0; t < s.length && i < e.length && (n = s[t],
r = e[i],
n.pts !== r.pts); )
r.pts > n.pts ? t++ : (i++,
a -= r.byteLength,
o -= r.nalCount,
u -= r.duration);
return 0 === i ? e : i === e.length ? null : (l = e.slice(i),
l.byteLength = a,
l.duration = u,
l.nalCount = o,
l.pts = l[0].pts,
l.dts = l[0].dts,
l)
}
,
this.alignGopsAtEnd_ = function(e) {
var t, i, n, r, a, o;
for (t = s.length - 1,
i = e.length - 1,
a = null,
o = !1; t >= 0 && i >= 0; ) {
if (n = s[t],
r = e[i],
n.pts === r.pts) {
o = !0;
break
}
n.pts > r.pts ? t-- : (t === s.length - 1 && (a = i),
i--)
}
if (!o && null === a)
return null;
var u;
if (u = o ? i : a,
0 === u)
return e;
var l = e.slice(u)
, c = l.reduce(function(e, t) {
return e.byteLength += t.byteLength,
e.duration += t.duration,
e.nalCount += t.nalCount,
e
}, {
byteLength: 0,
duration: 0,
nalCount: 0
});
return l.byteLength = c.byteLength,
l.duration = c.duration,
l.nalCount = c.nalCount,
l.pts = l[0].pts,
l.dts = l[0].dts,
l
}
,
this.alignGopsWith = function(e) {
s = e
}
}
,
Di.prototype = new F,
Mi = function(e, t) {
this.numberOfTracks = 0,
this.metadataStream = t,
e = e || {},
this.remuxTracks = "undefined" != typeof e.remux ? !!e.remux : !0,
this.keepOriginalTimestamps = "boolean" == typeof e.keepOriginalTimestamps ? e.keepOriginalTimestamps : !1,
this.pendingTracks = [],
this.videoTrack = null,
this.pendingBoxes = [],
this.pendingCaptions = [],
this.pendingMetadata = [],
this.pendingBytes = 0,
this.emittedTracks = 0,
Mi.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.pendingBytes += e.boxes.byteLength,
"video" === e.track.type && (this.videoTrack = e.track,
this.pendingBoxes.push(e.boxes)),
void ("audio" === e.track.type && (this.audioTrack = e.track,
this.pendingBoxes.unshift(e.boxes))))
}
}
,
Mi.prototype = new F,
Mi.prototype.flush = function(e) {
var t, i, n, r, a = 0, s = {
captions: [],
captionStreams: {},
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 this.emittedTracks++,
void (this.emittedTracks >= this.numberOfTracks && (this.trigger("done"),
this.emittedTracks = 0))
}
if (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts,
ji.forEach(function(e) {
s.info[e] = this.videoTrack[e]
}, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts,
Fi.forEach(function(e) {
s.info[e] = this.audioTrack[e]
}, this)),
this.videoTrack || this.audioTrack) {
for (s.type = 1 === this.pendingTracks.length ? this.pendingTracks[0].type : "combined",
this.emittedTracks += this.pendingTracks.length,
n = K.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 = dt.metadataTsToSeconds(t.startPts, o, this.keepOriginalTimestamps),
t.endTime = dt.metadataTsToSeconds(t.endPts, o, this.keepOriginalTimestamps),
s.captionStreams[t.stream] = !0,
s.captions.push(t);
for (r = 0; r < this.pendingMetadata.length; r++)
i = this.pendingMetadata[r],
i.cueTime = dt.metadataTsToSeconds(i.pts, o, this.keepOriginalTimestamps),
s.metadata.push(i);
for (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),
r = 0; r < s.captions.length; r++)
t = s.captions[r],
this.trigger("caption", t);
for (r = 0; r < s.metadata.length; r++)
i = s.metadata[r],
this.trigger("id3Frame", i)
}
this.emittedTracks >= this.numberOfTracks && (this.trigger("done"),
this.emittedTracks = 0)
}
,
Mi.prototype.setRemux = function(e) {
this.remuxTracks = e
}
,
Ni = function(e) {
var t, i, n = this, r = !0;
Ni.prototype.init.call(this),
e = e || {},
this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0,
this.transmuxPipeline_ = {},
this.setupAacPipeline = function() {
var r = {};
this.transmuxPipeline_ = r,
r.type = "aac",
r.metadataStream = new li.MetadataStream,
r.aacStream = new Ri,
r.audioTimestampRolloverStream = new li.TimestampRolloverStream("audio"),
r.timedMetadataTimestampRolloverStream = new li.TimestampRolloverStream("timed-metadata"),
r.adtsStream = new fi,
r.coalesceStream = new Mi(e,r.metadataStream),
r.headOfPipeline = r.aacStream,
r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),
r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),
r.metadataStream.on("timestamp", function(e) {
r.aacStream.setTimestamp(e.timeStamp)
}),
r.aacStream.on("data", function(a) {
"timed-metadata" !== a.type && "audio" !== a.type || r.audioSegmentStream || (i = i || {
timelineStartInfo: {
baseMediaDecodeTime: n.baseMediaDecodeTime
},
codec: "adts",
type: "audio"
},
r.coalesceStream.numberOfTracks++,
r.audioSegmentStream = new Oi(i,e),
r.audioSegmentStream.on("timingInfo", n.trigger.bind(n, "audioTimingInfo")),
r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),
n.trigger("trackinfo", {
hasAudio: !!i,
hasVideo: !!t
}))
}),
r.coalesceStream.on("data", this.trigger.bind(this, "data")),
r.coalesceStream.on("done", this.trigger.bind(this, "done"))
}
,
this.setupTsPipeline = function() {
var r = {};
this.transmuxPipeline_ = r,
r.type = "ts",
r.metadataStream = new li.MetadataStream,
r.packetStream = new li.TransportPacketStream,
r.parseStream = new li.TransportParseStream,
r.elementaryStream = new li.ElementaryStream,
r.timestampRolloverStream = new li.TimestampRolloverStream,
r.adtsStream = new fi,
r.h264Stream = new Vi,
r.captionStream = new li.CaptionStream,
r.coalesceStream = new Mi(e,r.metadataStream),
r.headOfPipeline = r.packetStream,
r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),
r.timestampRolloverStream.pipe(r.h264Stream),
r.timestampRolloverStream.pipe(r.adtsStream),
r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),
r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),
r.elementaryStream.on("data", function(a) {
var s;
if ("metadata" === a.type) {
for (s = a.tracks.length; s--; )
t || "video" !== a.tracks[s].type ? i || "audio" !== a.tracks[s].type || (i = a.tracks[s],
i.timelineStartInfo.baseMediaDecodeTime = n.baseMediaDecodeTime) : (t = a.tracks[s],
t.timelineStartInfo.baseMediaDecodeTime = n.baseMediaDecodeTime);
t && !r.videoSegmentStream && (r.coalesceStream.numberOfTracks++,
r.videoSegmentStream = new Di(t,e),
r.videoSegmentStream.on("timelineStartInfo", function(t) {
i && !e.keepOriginalTimestamps && (i.timelineStartInfo = t,
r.audioSegmentStream.setEarliestDts(t.dts - n.baseMediaDecodeTime))
}),
r.videoSegmentStream.on("processedGopsInfo", n.trigger.bind(n, "gopInfo")),
r.videoSegmentStream.on("segmentTimingInfo", n.trigger.bind(n, "videoSegmentTimingInfo")),
r.videoSegmentStream.on("baseMediaDecodeTime", function(e) {
i && r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)
}),
r.videoSegmentStream.on("timingInfo", n.trigger.bind(n, "videoTimingInfo")),
r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),
i && !r.audioSegmentStream && (r.coalesceStream.numberOfTracks++,
r.audioSegmentStream = new Oi(i,e),
r.audioSegmentStream.on("timingInfo", n.trigger.bind(n, "audioTimingInfo")),
r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),
n.trigger("trackinfo", {
hasAudio: !!i,
hasVideo: !!t
})
}
}),
r.coalesceStream.on("data", this.trigger.bind(this, "data")),
r.coalesceStream.on("id3Frame", function(e) {
e.dispatchType = r.metadataStream.dispatchType,
n.trigger("id3Frame", e)
}),
r.coalesceStream.on("caption", this.trigger.bind(this, "caption")),
r.coalesceStream.on("done", this.trigger.bind(this, "done"))
}
,
this.setBaseMediaDecodeTime = function(n) {
var r = this.transmuxPipeline_;
e.keepOriginalTimestamps || (this.baseMediaDecodeTime = n),
i && (i.timelineStartInfo.dts = void 0,
i.timelineStartInfo.pts = void 0,
Et.clearDtsInfo(i),
r.audioTimestampRolloverStream && r.audioTimestampRolloverStream.discontinuity()),
t && (r.videoSegmentStream && (r.videoSegmentStream.gopCache_ = []),
t.timelineStartInfo.dts = void 0,
t.timelineStartInfo.pts = void 0,
Et.clearDtsInfo(t),
r.captionStream.reset()),
r.timestampRolloverStream && r.timestampRolloverStream.discontinuity()
}
,
this.setAudioAppendStart = function(e) {
i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)
}
,
this.setRemux = function(t) {
var i = this.transmuxPipeline_;
e.remux = t,
i && i.coalesceStream && i.coalesceStream.setRemux(t)
}
,
this.alignGopsWith = function(e) {
t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)
}
,
this.push = function(e) {
if (r) {
var t = qi(e);
t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this.transmuxPipeline_.type || this.setupTsPipeline(),
r = !1
}
this.transmuxPipeline_.headOfPipeline.push(e)
}
,
this.flush = function() {
r = !0,
this.transmuxPipeline_.headOfPipeline.flush()
}
,
this.endTimeline = function() {
this.transmuxPipeline_.headOfPipeline.endTimeline()
}
,
this.reset = function() {
this.transmuxPipeline_.headOfPipeline && this.transmuxPipeline_.headOfPipeline.reset()
}
,
this.resetCaptions = function() {
this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset()
}
}
,
Ni.prototype = new F;
var Gi = {
Transmuxer: Ni,
VideoSegmentStream: Di,
AudioSegmentStream: Oi,
AUDIO_PROPERTIES: Fi,
VIDEO_PROPERTIES: ji,
generateVideoSegmentTimingInfo: zi
}
, Xi = Gi.Transmuxer
, Ki = {
Adts: fi,
h264: _i
}
, Yi = dt.ONE_SECOND_IN_TS
, $i = function Wn(e, t) {
var i = []
, n = 0
, r = 0
, a = 0
, s = 1 / 0
, o = null
, u = null;
t = t || {},
Wn.prototype.init.call(this),
this.push = function(t) {
Et.collectDtsInfo(e, t),
e && Fi.forEach(function(i) {
e[i] = t[i]
}),
i.push(t)
}
,
this.setEarliestDts = function(e) {
r = e
}
,
this.setVideoBaseMediaDecodeTime = function(e) {
s = e
}
,
this.setAudioAppendStart = function(e) {
a = e
}
,
this.processFrames_ = function() {
var l, c, d, h, f;
0 !== i.length && (l = _t.trimAdtsFramesByEarliestDts(i, e, r),
0 !== l.length && (e.baseMediaDecodeTime = Et.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps),
_t.prefixWithSilence(e, l, a, s),
e.samples = _t.generateSampleTable(l),
d = K.mdat(_t.concatenateFrameData(l)),
i = [],
c = K.moof(n, [e]),
n++,
e.initSegment = K.initSegment([e]),
h = new Uint8Array(c.byteLength + d.byteLength),
h.set(c),
h.set(d, c.byteLength),
Et.clearDtsInfo(e),
null === o && (u = o = l[0].pts),
u += l.length * (1024 * Yi / e.samplerate),
f = {
start: o
},
this.trigger("timingInfo", f),
this.trigger("data", {
track: e,
boxes: h
})))
}
,
this.flush = function() {
this.processFrames_(),
this.trigger("timingInfo", {
start: o,
end: u
}),
this.resetTiming_(),
this.trigger("done", "AudioSegmentStream")
}
,
this.partialFlush = function() {
this.processFrames_(),
this.trigger("partialdone", "AudioSegmentStream")
}
,
this.endTimeline = function() {
this.flush(),
this.trigger("endedtimeline", "AudioSegmentStream")
}
,
this.resetTiming_ = function() {
Et.clearDtsInfo(e),
o = null,
u = null
}
,
this.reset = function() {
this.resetTiming_(),
i = [],
this.trigger("reset")
}
};
$i.prototype = new F;
var Qi = $i
, Ji = function zn(e, t) {
var i, n, r, a = 0, s = [], o = [], u = null, l = null, c = !0;
t = t || {},
zn.prototype.init.call(this),
this.push = function(t) {
Et.collectDtsInfo(e, t),
"undefined" == typeof e.timelineStartInfo.dts && (e.timelineStartInfo.dts = t.dts),
"seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config,
e.sps = [t.data],
ji.forEach(function(t) {
e[t] = i[t]
}, this)),
"pic_parameter_set_rbsp" !== t.nalUnitType || n || (n = t.data,
e.pps = [t.data]),
s.push(t)
}
,
this.processNals_ = function(i) {
var n;
for (s = o.concat(s); s.length && "access_unit_delimiter_rbsp" !== s[0].nalUnitType; )
s.shift();
if (0 !== s.length) {
var d = rt.groupNalsIntoFrames(s);
if (d.length) {
if (o = d[d.length - 1],
i && (d.pop(),
d.duration -= o.duration,
d.nalCount -= o.length,
d.byteLength -= o.byteLength),
!d.length)
return void (s = []);
if (this.trigger("timelineStartInfo", e.timelineStartInfo),
c) {
if (r = rt.groupFramesIntoGops(d),
!r[0][0].keyFrame) {
if (r = rt.extendFirstKeyFrame(r),
!r[0][0].keyFrame)
return s = [].concat.apply([], d).concat(o),
void (o = []);
d = [].concat.apply([], r),
d.duration = r.duration
}
c = !1
}
for (null === u && (u = d[0].pts,
l = u),
l += d.duration,
this.trigger("timingInfo", {
start: u,
end: l
}),
n = 0; n < d.length; n++) {
var h = d[n];
e.samples = rt.generateSampleTableForFrame(h);
var f = K.mdat(rt.concatenateNalDataForFrame(h));
Et.clearDtsInfo(e),
Et.collectDtsInfo(e, h),
e.baseMediaDecodeTime = Et.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps);
var p = K.moof(a, [e]);
a++,
e.initSegment = K.initSegment([e]);
var m = new Uint8Array(p.byteLength + f.byteLength);
m.set(p),
m.set(f, p.byteLength),
this.trigger("data", {
track: e,
boxes: m,
sequence: a,
videoFrameDts: h.dts,
videoFramePts: h.pts
})
}
s = []
}
}
}
,
this.resetTimingAndConfig_ = function() {
i = void 0,
n = void 0,
u = null,
l = null
}
,
this.partialFlush = function() {
this.processNals_(!0),
this.trigger("partialdone", "VideoSegmentStream")
}
,
this.flush = function() {
this.processNals_(!1),
this.resetTimingAndConfig_(),
this.trigger("done", "VideoSegmentStream")
}
,
this.endTimeline = function() {
this.flush(),
this.trigger("endedtimeline", "VideoSegmentStream")
}
,
this.reset = function() {
this.resetTimingAndConfig_(),
o = [],
s = [],
c = !0,
this.trigger("reset")
}
};
Ji.prototype = new F;
var Zi = Ji
, en = Li.isLikelyAacData
, tn = function(e) {
return e.prototype = new F,
e.prototype.init.call(e),
e
}
, nn = function(e) {
var t = {
type: "ts",
tracks: {
audio: null,
video: null
},
packet: new li.TransportPacketStream,
parse: new li.TransportParseStream,
elementary: new li.ElementaryStream,
timestampRollover: new li.TimestampRolloverStream,
adts: new Ki.Adts,
h264: new Ki.h264.H264Stream,
captionStream: new li.CaptionStream,
metadataStream: new li.MetadataStream
};
return t.headOfPipeline = t.packet,
t.packet.pipe(t.parse).pipe(t.elementary).pipe(t.timestampRollover),
t.timestampRollover.pipe(t.h264),
t.h264.pipe(t.captionStream),
t.timestampRollover.pipe(t.metadataStream),
t.timestampRollover.pipe(t.adts),
t.elementary.on("data", function(i) {
if ("metadata" === i.type) {
for (var n = 0; n < i.tracks.length; n++)
t.tracks[i.tracks[n].type] || (t.tracks[i.tracks[n].type] = i.tracks[n],
t.tracks[i.tracks[n].type].timelineStartInfo.baseMediaDecodeTime = e.baseMediaDecodeTime);
t.tracks.video && !t.videoSegmentStream && (t.videoSegmentStream = new Zi(t.tracks.video,e),
t.videoSegmentStream.on("timelineStartInfo", function(i) {
t.tracks.audio && !e.keepOriginalTimestamps && t.audioSegmentStream.setEarliestDts(i.dts - e.baseMediaDecodeTime)
}),
t.videoSegmentStream.on("timingInfo", t.trigger.bind(t, "videoTimingInfo")),
t.videoSegmentStream.on("data", function(e) {
t.trigger("data", {
type: "video",
data: e
})
}),
t.videoSegmentStream.on("done", t.trigger.bind(t, "done")),
t.videoSegmentStream.on("partialdone", t.trigger.bind(t, "partialdone")),
t.videoSegmentStream.on("endedtimeline", t.trigger.bind(t, "endedtimeline")),
t.h264.pipe(t.videoSegmentStream)),
t.tracks.audio && !t.audioSegmentStream && (t.audioSegmentStream = new Qi(t.tracks.audio,e),
t.audioSegmentStream.on("data", function(e) {
t.trigger("data", {
type: "audio",
data: e
})
}),
t.audioSegmentStream.on("done", t.trigger.bind(t, "done")),
t.audioSegmentStream.on("partialdone", t.trigger.bind(t, "partialdone")),
t.audioSegmentStream.on("endedtimeline", t.trigger.bind(t, "endedtimeline")),
t.audioSegmentStream.on("timingInfo", t.trigger.bind(t, "audioTimingInfo")),
t.adts.pipe(t.audioSegmentStream)),
t.trigger("trackinfo", {
hasAudio: !!t.tracks.audio,
hasVideo: !!t.tracks.video
})
}
}),
t.captionStream.on("data", function(i) {
var n;
n = t.tracks.video ? t.tracks.video.timelineStartInfo.pts || 0 : 0,
i.startTime = dt.metadataTsToSeconds(i.startPts, n, e.keepOriginalTimestamps),
i.endTime = dt.metadataTsToSeconds(i.endPts, n, e.keepOriginalTimestamps),
t.trigger("caption", i)
}),
t = tn(t),
t.metadataStream.on("data", t.trigger.bind(t, "id3Frame")),
t
}
, rn = function(e) {
var t = {
type: "aac",
tracks: {
audio: null
},
metadataStream: new li.MetadataStream,
aacStream: new Ri,
audioRollover: new li.TimestampRolloverStream("audio"),
timedMetadataRollover: new li.TimestampRolloverStream("timed-metadata"),
adtsStream: new fi(!0)
};
return t.headOfPipeline = t.aacStream,
t.aacStream.pipe(t.audioRollover).pipe(t.adtsStream),
t.aacStream.pipe(t.timedMetadataRollover).pipe(t.metadataStream),
t.metadataStream.on("timestamp", function(e) {
t.aacStream.setTimestamp(e.timeStamp)
}),
t.aacStream.on("data", function(i) {
"timed-metadata" !== i.type && "audio" !== i.type || t.audioSegmentStream || (t.tracks.audio = t.tracks.audio || {
timelineStartInfo: {
baseMediaDecodeTime: e.baseMediaDecodeTime
},
codec: "adts",
type: "audio"
},
t.audioSegmentStream = new Qi(t.tracks.audio,e),
t.audioSegmentStream.on("data", function(e) {
t.trigger("data", {
type: "audio",
data: e
})
}),
t.audioSegmentStream.on("partialdone", t.trigger.bind(t, "partialdone")),
t.audioSegmentStream.on("done", t.trigger.bind(t, "done")),
t.audioSegmentStream.on("endedtimeline", t.trigger.bind(t, "endedtimeline")),
t.audioSegmentStream.on("timingInfo", t.trigger.bind(t, "audioTimingInfo")),
t.adtsStream.pipe(t.audioSegmentStream),
t.trigger("trackinfo", {
hasAudio: !!t.tracks.audio,
hasVideo: !!t.tracks.video
}))
}),
t = tn(t),
t.metadataStream.on("data", t.trigger.bind(t, "id3Frame")),
t
}
, an = function(e, t) {
e.on("data", t.trigger.bind(t, "data")),
e.on("done", t.trigger.bind(t, "done")),
e.on("partialdone", t.trigger.bind(t, "partialdone")),
e.on("endedtimeline", t.trigger.bind(t, "endedtimeline")),
e.on("audioTimingInfo", t.trigger.bind(t, "audioTimingInfo")),
e.on("videoTimingInfo", t.trigger.bind(t, "videoTimingInfo")),
e.on("trackinfo", t.trigger.bind(t, "trackinfo")),
e.on("id3Frame", function(i) {
i.dispatchType = e.metadataStream.dispatchType,
i.cueTime = dt.videoTsToSeconds(i.pts),
t.trigger("id3Frame", i)
}),
e.on("caption", function(e) {
t.trigger("caption", e)
})
}
, sn = function Gn(e) {
var t = null
, i = !0;
e = e || {},
Gn.prototype.init.call(this),
e.baseMediaDecodeTime = e.baseMediaDecodeTime || 0,
this.push = function(n) {
if (i) {
var r = en(n);
!r || t && "aac" === t.type ? r || t && "ts" === t.type || (t = nn(e),
an(t, this)) : (t = rn(e),
an(t, this)),
i = !1
}
t.headOfPipeline.push(n)
}
,
this.flush = function() {
t && (i = !0,
t.headOfPipeline.flush())
}
,
this.partialFlush = function() {
t && t.headOfPipeline.partialFlush()
}
,
this.endTimeline = function() {
t && t.headOfPipeline.endTimeline()
}
,
this.reset = function() {
t && t.headOfPipeline.reset()
}
,
this.setBaseMediaDecodeTime = function(i) {
e.keepOriginalTimestamps || (e.baseMediaDecodeTime = i),
t && (t.tracks.audio && (t.tracks.audio.timelineStartInfo.dts = void 0,
t.tracks.audio.timelineStartInfo.pts = void 0,
Et.clearDtsInfo(t.tracks.audio),
t.audioRollover && t.audioRollover.discontinuity()),
t.tracks.video && (t.videoSegmentStream && (t.videoSegmentStream.gopCache_ = []),
t.tracks.video.timelineStartInfo.dts = void 0,
t.tracks.video.timelineStartInfo.pts = void 0,
Et.clearDtsInfo(t.tracks.video)),
t.timestampRollover && t.timestampRollover.discontinuity())
}
,
this.setRemux = function(i) {
e.remux = i,
t && t.coalesceStream && t.coalesceStream.setRemux(i)
}
,
this.setAudioAppendStart = function(e) {
t && t.tracks.audio && t.audioSegmentStream && t.audioSegmentStream.setAudioAppendStart(e)
}
,
this.alignGopsWith = function() {}
};
sn.prototype = new F;
var on = sn
, un = function(e) {
return e >>> 0
}
, ln = function(e) {
return ("00" + e.toString(16)).slice(-2)
}
, cn = {
toUnsigned: un,
toHexString: ln
}
, dn = 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])
}
, hn = dn
, fn = cn.toUnsigned
, pn = function Xn(e, t) {
var i, n, r, a, s, o = [];
if (!t.length)
return null;
for (i = 0; i < e.byteLength; )
n = fn(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]),
r = hn(e.subarray(i + 4, i + 8)),
a = n > 1 ? i + n : e.byteLength,
r === t[0] && (1 === t.length ? o.push(e.subarray(i + 8, a)) : (s = Xn(e.subarray(i + 8, a), t.slice(1)),
s.length && (o = o.concat(s)))),
i = a;
return o
}
, mn = pn
, gn = cn.toUnsigned
, vn = function(e) {
var t = {
version: e[0],
flags: new Uint8Array(e.subarray(1, 4)),
baseMediaDecodeTime: gn(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7])
};
return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32),
t.baseMediaDecodeTime += gn(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])),
t
}
, yn = vn
, _n = function(e) {
return {
isLeading: (12 & e[0]) >>> 2,
dependsOn: 3 & e[0],
isDependedOn: (192 & e[1]) >>> 6,
hasRedundancy: (48 & e[1]) >>> 4,
paddingValue: (14 & e[1]) >>> 1,
isNonSyncSample: 1 & e[1],
degradationPriority: e[2] << 8 | e[3]
}
}
, bn = _n
, Tn = function(e) {
var t, i = {
version: e[0],
flags: new Uint8Array(e.subarray(1, 4)),
samples: []
}, n = new DataView(e.buffer,e.byteOffset,e.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), d = 8;
for (r && (i.dataOffset = n.getInt32(d),
d += 4),
a && c && (t = {
flags: bn(e.subarray(d, d + 4))
},
d += 4,
s && (t.duration = n.getUint32(d),
d += 4),
o && (t.size = n.getUint32(d),
d += 4),
l && (t.compositionTimeOffset = 1 === i.version ? n.getInt32(d) : n.getUint32(d),
d += 4),
i.samples.push(t),
c--); c--; )
t = {},
s && (t.duration = n.getUint32(d),
d += 4),
o && (t.size = n.getUint32(d),
d += 4),
u && (t.flags = bn(e.subarray(d, d + 4)),
d += 4),
l && (t.compositionTimeOffset = 1 === i.version ? n.getInt32(d) : n.getUint32(d),
d += 4),
i.samples.push(t);
return i
}
, Sn = Tn
, Cn = function(e) {
var t, i = new DataView(e.buffer,e.byteOffset,e.byteLength), n = {
version: e[0],
flags: new Uint8Array(e.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 t = 8,
r && (t += 4,
n.baseDataOffset = i.getUint32(12),
t += 4),
a && (n.sampleDescriptionIndex = i.getUint32(t),
t += 4),
s && (n.defaultSampleDuration = i.getUint32(t),
t += 4),
o && (n.defaultSampleSize = i.getUint32(t),
t += 4),
u && (n.defaultSampleFlags = i.getUint32(t)),
l && (n.durationIsEmpty = !0),
!r && c && (n.baseDataOffsetIsMoof = !0),
n
}
, En = Cn
, kn = Lt.discardEmulationPreventionBytes
, wn = Bt.CaptionStream
, In = function(e, t) {
for (var i = e, n = 0; n < t.length; n++) {
var r = t[n];
if (i < r.size)
return r;
i -= r.size
}
return null
}
, An = function(e, t, i) {
var n, r, a, s, o = new DataView(e.buffer,e.byteOffset,e.byteLength), u = [];
for (r = 0; r + 4 < e.length; r += a)
if (a = o.getUint32(r),
r += 4,
!(0 >= a))
switch (31 & e[r]) {
case 6:
var l = e.subarray(r + 1, r + 1 + a)
, c = In(r, t);
if (n = {
nalUnitType: "sei_rbsp",
size: a,
data: l,
escapedRBSP: kn(l),
trackId: i
},
c)
n.pts = c.pts,
n.dts = c.dts,
s = c;
else {
if (!s) {
console.log("We've encountered a nal unit without data. See mux.js#233.");
break
}
n.pts = s.pts,
n.dts = s.dts
}
u.push(n)
}
return u
}
, xn = function(e, t, i) {
var n = t
, r = i.defaultSampleDuration || 0
, a = i.defaultSampleSize || 0
, s = i.trackId
, o = [];
return e.forEach(function(e) {
var t = Sn(e)
, i = t.samples;
i.forEach(function(e) {
void 0 === e.duration && (e.duration = r),
void 0 === e.size && (e.size = a),
e.trackId = s,
e.dts = n,
void 0 === e.compositionTimeOffset && (e.compositionTimeOffset = 0),
e.pts = n + e.compositionTimeOffset,
n += e.duration
}),
o = o.concat(i)
}),
o
}
, Pn = function(e, t) {
var i = mn(e, ["moof", "traf"])
, n = mn(e, ["mdat"])
, r = {}
, a = [];
return n.forEach(function(e, t) {
var n = i[t];
a.push({
mdat: e,
traf: n
})
}),
a.forEach(function(e) {
var i, n, a = e.mdat, s = e.traf, o = mn(s, ["tfhd"]), u = En(o[0]), l = u.trackId, c = mn(s, ["tfdt"]), d = c.length > 0 ? yn(c[0]).baseMediaDecodeTime : 0, h = mn(s, ["trun"]);
t === l && h.length > 0 && (i = xn(h, d, u),
n = An(a, i, l),
r[l] || (r[l] = []),
r[l] = r[l].concat(n))
}),
r
}
, Ln = function(e, t, i) {
var n;
return null === t ? null : (n = Pn(e, t),
{
seiNals: n[t],
timescale: i
})
}
, Dn = function() {
var e, t, i, n, r, a, s = !1;
this.isInitialized = function() {
return s
}
,
this.init = function(t) {
e = new wn,
s = !0,
a = t ? t.isPartial : !1,
e.on("data", function(e) {
e.startTime = e.startPts / n,
e.endTime = e.endPts / n,
r.captions.push(e),
r.captionStreams[e.stream] = !0
})
}
,
this.isNewInit = function(e, t) {
return e && 0 === e.length || t && "object" == typeof t && 0 === Object.keys(t).length ? !1 : i !== e[0] || n !== t[i]
}
,
this.parse = function(e, a, s) {
var o;
if (!this.isInitialized())
return null;
if (!a || !s)
return null;
if (this.isNewInit(a, s))
i = a[0],
n = s[i];
else if (null === i || !n)
return t.push(e),
null;
for (; t.length > 0; ) {
var u = t.shift();
this.parse(u, a, s)
}
return o = Ln(e, i, n),
null !== o && o.seiNals ? (this.pushNals(o.seiNals),
this.flushStream(),
r) : null
}
,
this.pushNals = function(t) {
return this.isInitialized() && t && 0 !== t.length ? void t.forEach(function(t) {
e.push(t)
}) : null
}
,
this.flushStream = function() {
return this.isInitialized() ? void (a ? e.partialFlush() : e.flush()) : null
}
,
this.clearParsedCaptions = function() {
r.captions = [],
r.captionStreams = {}
}
,
this.resetCaptionStream = function() {
return this.isInitialized() ? void e.reset() : null
}
,
this.clearAllCaptions = function() {
this.clearParsedCaptions(),
this.resetCaptionStream()
}
,
this.reset = function() {
t = [],
i = null,
n = null,
r ? this.clearParsedCaptions() : r = {
captions: [],
captionStreams: {}
},
this.resetCaptionStream()
}
,
this.reset()
}
, On = Dn
, Nn = function(e) {
return "AudioSegmentStream" === e ? "audio" : "VideoSegmentStream" === e ? "video" : ""
}
, Mn = function(e, t) {
t.on("data", function(t) {
var i = t.initSegment;
t.initSegment = {
data: i.buffer,
byteOffset: i.byteOffset,
byteLength: i.byteLength
};
var n = t.data;
t.data = n.buffer,
e.postMessage({
action: "data",
segment: t,
byteOffset: n.byteOffset,
byteLength: n.byteLength
}, [t.data])
}),
t.on("done", function() {
e.postMessage({
action: "done"
})
}),
t.on("gopInfo", function(t) {
e.postMessage({
action: "gopInfo",
gopInfo: t
})
}),
t.on("videoSegmentTimingInfo", function(t) {
var i = {
start: {
decode: ft(t.start.dts),
presentation: ft(t.start.pts)
},
end: {
decode: ft(t.end.dts),
presentation: ft(t.end.pts)
},
baseMediaDecodeTime: ft(t.baseMediaDecodeTime)
};
t.prependedContentDuration && (i.prependedContentDuration = ft(t.prependedContentDuration)),
e.postMessage({
action: "videoSegmentTimingInfo",
videoSegmentTimingInfo: i
})
}),
t.on("id3Frame", function(t) {
e.postMessage({
action: "id3Frame",
id3Frame: t
})
}),
t.on("caption", function(t) {
e.postMessage({
action: "caption",
caption: t
})
}),
t.on("trackinfo", function(t) {
e.postMessage({
action: "trackinfo",
trackInfo: t
})
}),
t.on("audioTimingInfo", function(t) {
e.postMessage({
action: "audioTimingInfo",
audioTimingInfo: {
start: ft(t.start),
end: ft(t.end)
}
})
}),
t.on("videoTimingInfo", function(t) {
e.postMessage({
action: "videoTimingInfo",
videoTimingInfo: {
start: ft(t.start),
end: ft(t.end)
}
})
})
}
, Rn = function(e, t) {
t.on("data", function(t) {
var i = {
data: t.data.track.initSegment.buffer,
byteOffset: t.data.track.initSegment.byteOffset,
byteLength: t.data.track.initSegment.byteLength
}
, n = {
data: t.data.boxes.buffer,
byteOffset: t.data.boxes.byteOffset,
byteLength: t.data.boxes.byteLength
}
, r = {
boxes: n,
initSegment: i,
type: t.type,
sequence: t.data.sequence
};
"undefined" != typeof t.data.videoFrameDts && (r.videoFrameDtsTime = ft(t.data.videoFrameDts)),
"undefined" != typeof t.data.videoFramePts && (r.videoFramePtsTime = ft(t.data.videoFramePts)),
e.postMessage({
action: "data",
segment: r
}, [r.boxes.data, r.initSegment.data])
}),
t.on("id3Frame", function(t) {
e.postMessage({
action: "id3Frame",
id3Frame: t
})
}),
t.on("caption", function(t) {
e.postMessage({
action: "caption",
caption: t
})
}),
t.on("done", function(t) {
e.postMessage({
action: "done",
type: Nn(t)
})
}),
t.on("partialdone", function(t) {
e.postMessage({
action: "partialdone",
type: Nn(t)
})
}),
t.on("endedsegment", function(t) {
e.postMessage({
action: "endedSegment",
type: Nn(t)
})
}),
t.on("trackinfo", function(t) {
e.postMessage({
action: "trackinfo",
trackInfo: t
})
}),
t.on("audioTimingInfo", function(t) {
if (null === t.start)
return void e.postMessage({
action: "audioTimingInfo",
audioTimingInfo: t
});
var i = {
start: ft(t.start)
};
t.end && (i.end = ft(t.end)),
e.postMessage({
action: "audioTimingInfo",
audioTimingInfo: i
})
}),
t.on("videoTimingInfo", function(t) {
var i = {
start: ft(t.start)
};
t.end && (i.end = ft(t.end)),
e.postMessage({
action: "videoTimingInfo",
videoTimingInfo: i
})
})
}
, Un = function() {
function t(e, t) {
this.options = t || {},
this.self = e,
this.init()
}
var i = t.prototype;
return i.init = function() {
this.transmuxer && this.transmuxer.dispose(),
this.transmuxer = this.options.handlePartialData ? new on(this.options) : new Xi(this.options),
this.options.handlePartialData ? Rn(this.self, this.transmuxer) : Mn(this.self, this.transmuxer)
}
,
i.pushMp4Captions = function(e) {
this.captionParser || (this.captionParser = new On,
this.captionParser.init());
var t = new Uint8Array(e.data,e.byteOffset,e.byteLength)
, i = this.captionParser.parse(t, e.trackIds, e.timescales);
this.self.postMessage({
action: "mp4Captions",
captions: i && i.captions || [],
data: t.buffer
}, [t.buffer])
}
,
i.clearAllMp4Captions = function() {
this.captionParser && this.captionParser.clearAllCaptions()
}
,
i.clearParsedMp4Captions = function() {
this.captionParser && this.captionParser.clearParsedCaptions()
}
,
i.push = function(e) {
var t = new Uint8Array(e.data,e.byteOffset,e.byteLength);
this.transmuxer.push(t)
}
,
i.reset = function() {
this.transmuxer.reset()
}
,
i.setTimestampOffset = function(e) {
var t = e.timestampOffset || 0;
this.transmuxer.setBaseMediaDecodeTime(Math.round(ht(t)))
}
,
i.setAudioAppendStart = function(e) {
this.transmuxer.setAudioAppendStart(Math.ceil(ht(e.appendStart)))
}
,
i.setRemux = function(e) {
this.transmuxer.setRemux(e.remux)
}
,
i.flush = function() {
this.transmuxer.flush(),
e.postMessage({
action: "done",
type: "transmuxed"
})
}
,
i.partialFlush = function() {
this.transmuxer.partialFlush(),
e.postMessage({
action: "partialdone",
type: "transmuxed"
})
}
,
i.endTimeline = function() {
this.transmuxer.endTimeline(),
e.postMessage({
action: "endedtimeline",
type: "transmuxed"
})
}
,
i.alignGopsWith = function(e) {
this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())
}
,
t
}()
, Fn = function(e) {
e.onmessage = function(t) {
return "init" === t.data.action && t.data.options ? void (this.messageHandlers = new Un(e,t.data.options)) : (this.messageHandlers || (this.messageHandlers = new Un(e)),
void (t.data && t.data.action && "init" !== t.data.action && this.messageHandlers[t.data.action] && this.messageHandlers[t.data.action](t.data)))
}
}
, Bn = new Fn(e);
return Bn
}()
}
), xm = function(e) {
var t = e.attributes || {};
return t.CODECS ? Bu(t.CODECS) : void 0
}, Pm = function(e, t) {
var i = t.attributes || {};
return e && e.mediaGroups && e.mediaGroups.AUDIO && i.AUDIO && e.mediaGroups.AUDIO[i.AUDIO]
}, Lm = function(e, t) {
if (!Pm(e, t))
return !0;
var i = t.attributes || {}
, n = e.mediaGroups.AUDIO[i.AUDIO];
for (var r in n)
if (!n[r].uri && !n[r].playlists)
return !0;
return !1
}, Dm = function(e, t) {
var i = t.attributes || {}
, n = xm(t) || {};
if (Pm(e, t) && !n.audio && !Lm(e, t)) {
var r = Nu(e, i.AUDIO);
r && (n.audio = r.audio)
}
var a = {};
return n.video && (a.video = ju("" + n.video.type + n.video.details)),
n.audio && (a.audio = ju("" + n.audio.type + n.audio.details)),
a
}, Om = function(e) {
return pn.log.debug ? pn.log.debug.bind(pn, "VHS:", e + " >") : function() {}
}, Nm = Om("PlaylistSelector"), Mm = function(e) {
if (e && e.playlist) {
var t = e.playlist;
return JSON.stringify({
id: t.id,
bandwidth: e.bandwidth,
width: e.width,
height: e.height,
codecs: t.attributes && t.attributes.CODECS || ""
})
}
}, Rm = function(e, t) {
if (!e)
return "";
var i = dr["default"].getComputedStyle(e);
return i ? i[t] : ""
}, Um = 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
})
}, Fm = function(e, t) {
var i, n;
return e.attributes.BANDWIDTH && (i = e.attributes.BANDWIDTH),
i = i || dr["default"].Number.MAX_VALUE,
t.attributes.BANDWIDTH && (n = t.attributes.BANDWIDTH),
n = n || dr["default"].Number.MAX_VALUE,
i - n
}, Bm = function(e, t) {
var i, n;
return e.attributes.RESOLUTION && e.attributes.RESOLUTION.width && (i = e.attributes.RESOLUTION.width),
i = i || dr["default"].Number.MAX_VALUE,
t.attributes.RESOLUTION && t.attributes.RESOLUTION.width && (n = t.attributes.RESOLUTION.width),
n = n || dr["default"].Number.MAX_VALUE,
i === n && e.attributes.BANDWIDTH && t.attributes.BANDWIDTH ? e.attributes.BANDWIDTH - t.attributes.BANDWIDTH : i - n
}, jm = function(e, t, i, n, r) {
var a = {
bandwidth: t,
width: i,
height: n,
limitRenditionByPlayerDimensions: r
}
, s = e.playlists.map(function(e) {
var t, i = e.attributes.RESOLUTION && e.attributes.RESOLUTION.width, n = e.attributes.RESOLUTION && e.attributes.RESOLUTION.height;
return t = e.attributes.BANDWIDTH,
t = t || dr["default"].Number.MAX_VALUE,
{
bandwidth: t,
width: i,
height: n,
playlist: e
}
});
Um(s, function(e, t) {
return e.bandwidth - t.bandwidth
}),
s = s.filter(function(e) {
return !ip.isIncompatible(e.playlist)
});
var o = s.filter(function(e) {
return ip.isEnabled(e.playlist)
});
o.length || (o = s.filter(function(e) {
return !ip.isDisabled(e.playlist)
}));
var u = o.filter(function(e) {
return e.bandwidth * jp.BANDWIDTH_VARIANCE < t
})
, l = u[u.length - 1]
, c = u.filter(function(e) {
return e.bandwidth === l.bandwidth
})[0];
if (r === !1) {
var d = c || o[0] || s[0];
if (d && d.playlist) {
var h = "sortedPlaylistReps";
return c && (h = "bandwidthBestRep"),
o[0] && (h = "enabledPlaylistReps"),
Nm("choosing " + Mm(d) + " using " + h + " with options", a),
d.playlist
}
return Nm("could not choose a playlist with options", a),
null
}
var f = u.filter(function(e) {
return e.width && e.height
});
Um(f, function(e, t) {
return e.width - t.width
});
var p = f.filter(function(e) {
return e.width === i && e.height === n
});
l = p[p.length - 1];
var m, g, v, y = p.filter(function(e) {
return e.bandwidth === l.bandwidth
})[0];
y || (m = f.filter(function(e) {
return e.width > i || e.height > n
}),
g = m.filter(function(e) {
return e.width === m[0].width && e.height === m[0].height
}),
l = g[g.length - 1],
v = g.filter(function(e) {
return e.bandwidth === l.bandwidth
})[0]);
var _ = v || y || c || o[0] || s[0];
if (_ && _.playlist) {
var b = "sortedPlaylistReps";
return v ? b = "resolutionPlusOneRep" : y ? b = "resolutionBestRep" : c ? b = "bandwidthBestRep" : o[0] && (b = "enabledPlaylistReps"),
Nm("choosing " + Mm(_) + " using " + b + " with options", a),
_.playlist
}
return Nm("could not choose a playlist with options", a),
null
}, Vm = function() {
var e = this.useDevicePixelRatio ? dr["default"].devicePixelRatio || 1 : 1;
return jm(this.playlists.master, this.systemBandwidth, parseInt(Rm(this.tech_.el(), "width"), 10) * e, parseInt(Rm(this.tech_.el(), "height"), 10) * e, this.limitRenditionByPlayerDimensions)
}, qm = function(e) {
var t = e.master
, i = e.currentTime
, n = e.bandwidth
, r = e.duration
, a = e.segmentDuration
, s = e.timeUntilRebuffer
, o = e.currentTimeline
, u = e.syncController
, l = t.playlists.filter(function(e) {
return !ip.isIncompatible(e)
})
, c = l.filter(ip.isEnabled);
c.length || (c = l.filter(function(e) {
return !ip.isDisabled(e)
}));
var d = c.filter(ip.hasAttribute.bind(null, "BANDWIDTH"))
, h = d.map(function(e) {
var t = u.getSyncPoint(e, r, o, i)
, l = t ? 1 : 2
, c = ip.estimateSegmentRequestTime(a, n, e)
, d = c * l - s;
return {
playlist: e,
rebufferingImpact: d
}
})
, f = h.filter(function(e) {
return e.rebufferingImpact <= 0
});
return Um(f, function(e, t) {
return Fm(t.playlist, e.playlist)
}),
f.length ? f[0] : (Um(h, function(e, t) {
return e.rebufferingImpact - t.rebufferingImpact
}),
h[0] || null)
}, Hm = function() {
var e = this
, t = this.playlists.master.playlists.filter(ip.isEnabled);
Um(t, function(e, t) {
return Fm(e, t)
});
var i = t.filter(function(t) {
return !!Dm(e.playlists.master, t).video
});
return i[0] || null
}, Wm = function(e, t, i) {
if (!e[i]) {
t.trigger({
type: "usage",
name: "vhs-608"
}),
t.trigger({
type: "usage",
name: "hls-608"
});
var n = t.textTracks().getTrackById(i);
e[i] = n ? n : t.addRemoteTextTrack({
kind: "captions",
id: i,
label: i
}, !1).track
}
}, zm = function(e) {
var t = e.inbandTextTracks
, i = e.captionArray
, n = e.timestampOffset;
if (i) {
var r = dr["default"].WebKitDataCue || dr["default"].VTTCue;
i.forEach(function(e) {
var i = e.stream;
t[i].addCue(new r(e.startTime + n,e.endTime + n,e.text))
})
}
}, Gm = function(e) {
Object.defineProperties(e.frame, {
id: {
get: function() {
return pn.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),
e.value.key
}
},
value: {
get: function() {
return pn.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),
e.value.data
}
},
privateData: {
get: function() {
return pn.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),
e.value.data
}
}
})
}, Xm = function(e) {
var t = e.inbandTextTracks
, i = e.metadataArray
, n = e.timestampOffset
, r = e.videoDuration;
if (i) {
var a = dr["default"].WebKitDataCue || dr["default"].VTTCue
, s = t.metadataTrack_;
if (s && (i.forEach(function(e) {
var t = e.cueTime + n;
!("number" != typeof t || dr["default"].isNaN(t) || 0 > t) && 1 / 0 > t && e.frames.forEach(function(e) {
var i = new a(t,t,e.value || e.url || e.data || "");
i.frame = e,
i.value = e,
Gm(i),
s.addCue(i)
})
}),
s.cues && s.cues.length)) {
for (var o = s.cues, u = [], l = 0; l < o.length; l++)
o[l] && u.push(o[l]);
var c = u.reduce(function(e, t) {
var i = e[t.startTime] || [];
return i.push(t),
e[t.startTime] = i,
e
}, {})
, d = Object.keys(c).sort(function(e, t) {
return Number(e) - Number(t)
});
d.forEach(function(e, t) {
var i = c[e]
, n = Number(d[t + 1]) || r;
i.forEach(function(e) {
e.endTime = n
})
})
}
}
}, Km = function(e, t, i) {
e.metadataTrack_ || (e.metadataTrack_ = i.addRemoteTextTrack({
kind: "metadata",
label: "Timed Metadata"
}, !1).track,
e.metadataTrack_.inBandMetadataTrackDispatchType = t)
}, Ym = function(e, t, i) {
var n, r;
if (i && i.cues)
for (n = i.cues.length; n--; )
r = i.cues[n],
r.startTime >= e && r.endTime <= t && i.removeCue(r)
}, $m = function(e, t, i) {
if ("undefined" == typeof t || null === t || !e.length)
return [];
var n, r = Math.ceil((t - i + 3) * Wo);
for (n = 0; n < e.length && !(e[n].pts > r); n++)
;
return e.slice(n)
}, Qm = function(e, t, i) {
if (!t.length)
return e;
if (i)
return t.slice();
var n = t[0].pts
, r = 0;
for (r; r < e.length && !(e[r].pts >= n); r++)
;
return e.slice(0, r).concat(t)
}, Jm = function(e, t, i, n) {
for (var r = Math.ceil((t - n) * Wo), a = Math.ceil((i - n) * Wo), s = e.slice(), o = e.length; o-- && !(e[o].pts <= a); )
;
if (-1 === o)
return s;
for (var u = o + 1; u-- && !(e[u].pts <= r); )
;
return u = Math.max(u, 0),
s.splice(u, o - u + 1),
s
}, Zm = function(e, t) {
if (!e && !t || !e && t || e && !t)
return !1;
if (e === t)
return !0;
var i = Object.keys(e).sort()
, n = Object.keys(t).sort();
if (i.length !== n.length)
return !1;
for (var r = 0; r < i.length; r++) {
var a = i[r];
if (a !== n[r])
return !1;
if (e[a] !== t[a])
return !1
}
return !0
}, eg = 500, tg = function(e) {
return "number" == typeof e && isFinite(e)
}, ig = function(e, t, i) {
return "main" === e && t && i ? i.hasAudio || i.hasVideo ? t.hasVideo && !i.hasVideo ? "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." : !t.hasVideo && i.hasVideo ? "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
}, ng = function(e, t, i) {
var n = t - jp.BACK_BUFFER_LENGTH;
e.length && (n = Math.max(n, e.start(0)));
var r = t - i;
return Math.min(r, n)
}, rg = function(e) {
var t = e.segment
, i = t.start
, n = t.end
, r = e.playlist
, a = r.mediaSequence
, s = r.id
, o = r.segments
, u = void 0 === o ? [] : o
, l = e.mediaIndex
, c = e.timeline;
return ["appending [" + l + "] of [" + a + ", " + (a + u.length) + "] from playlist [" + s + "]", "[" + i + " => " + n + "] in timeline [" + c + "]"].join(" ")
}, ag = function(e) {
return e + "TimingInfo"
}, sg = function(e) {
var t = e.segmentTimeline
, i = e.currentTimeline
, n = e.startOfSegment
, r = e.buffered
, a = e.overrideCheck;
return a || t !== i ? r.length ? r.end(r.length - 1) : n : null
}, og = function(e) {
var t = e.timelineChangeController
, i = e.currentTimeline
, n = e.segmentTimeline
, r = e.loaderType
, a = e.audioDisabled;
if (i === n)
return !1;
if ("audio" === r) {
var s = t.lastTimelineChange({
type: "main"
});
return !s || s.to !== n
}
if ("main" === r && a) {
var o = t.pendingTimelineChange({
type: "audio"
});
return o && o.to === n ? !1 : !0
}
return !1
}, ug = function(e) {
function t(t) {
var i;
if (i = e.call(this) || this,
!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 i.bandwidth = t.bandwidth,
i.throughput = {
rate: 0,
count: 0
},
i.roundTrip = 0 / 0,
i.resetStats_(),
i.mediaIndex = null,
i.hasPlayed_ = t.hasPlayed,
i.currentTime_ = t.currentTime,
i.seekable_ = t.seekable,
i.seeking_ = t.seeking,
i.duration_ = t.duration,
i.mediaSource_ = t.mediaSource,
i.vhs_ = t.vhs,
i.loaderType_ = t.loaderType,
i.currentMediaInfo_ = void 0,
i.startingMediaInfo_ = void 0,
i.segmentMetadataTrack_ = t.segmentMetadataTrack,
i.goalBufferLength_ = t.goalBufferLength,
i.sourceType_ = t.sourceType,
i.sourceUpdater_ = t.sourceUpdater,
i.inbandTextTracks_ = t.inbandTextTracks,
i.state_ = "INIT",
i.handlePartialData_ = t.handlePartialData,
i.timelineChangeController_ = t.timelineChangeController,
i.shouldSaveSegmentTimingInfo_ = !0,
i.checkBufferTimeout_ = null,
i.error_ = void 0,
i.currentTimeline_ = -1,
i.pendingSegment_ = null,
i.xhrOptions_ = null,
i.pendingSegments_ = [],
i.audioDisabled_ = !1,
i.isPendingTimestampOffset_ = !1,
i.gopBuffer_ = [],
i.timeMapping_ = 0,
i.safeAppend_ = pn.browser.IE_VERSION >= 11,
i.appendInitSegment_ = {
audio: !0,
video: !0
},
i.playlistOfLastInitSegment_ = {
audio: null,
video: null
},
i.callQueue_ = [],
i.loadQueue_ = [],
i.metadataQueue_ = {
id3: [],
caption: []
},
i.activeInitSegmentId_ = null,
i.initSegments_ = {},
i.cacheEncryptionKeys_ = t.cacheEncryptionKeys,
i.keyCache_ = {},
i.decrypter_ = t.decrypter,
i.syncController_ = t.syncController,
i.syncPoint_ = {
segmentIndex: 0,
time: 0
},
i.transmuxer_ = i.createTransmuxer_(),
i.triggerSyncInfoUpdate_ = function() {
return i.trigger("syncinfoupdate")
}
,
i.syncController_.on("syncinfoupdate", i.triggerSyncInfoUpdate_),
i.mediaSource_.addEventListener("sourceopen", function() {
i.isEndOfStream_() || (i.ended_ = !1)
}),
i.fetchAtBuffer_ = !1,
i.logger_ = Om("SegmentLoader[" + i.loaderType_ + "]"),
Object.defineProperty(mr(i), "state", {
get: function() {
return this.state_
},
set: function(e) {
e !== this.state_ && (this.logger_(this.state_ + " -> " + e),
this.state_ = e,
this.trigger("statechange"))
}
}),
i.sourceUpdater_.on("ready", function() {
i.hasEnoughInfoToAppend_() && i.processCallQueue_()
}),
"main" === i.loaderType_ && i.timelineChangeController_.on("pendingtimelinechange", function() {
i.hasEnoughInfoToAppend_() && i.processCallQueue_()
}),
"audio" === i.loaderType_ && i.timelineChangeController_.on("timelinechange", function() {
i.hasEnoughInfoToLoad_() && i.processLoadQueue_(),
i.hasEnoughInfoToAppend_() && i.processCallQueue_()
}),
i
}
gr(t, e);
var i = t.prototype;
return i.createTransmuxer_ = function() {
var e = new Am;
return e.postMessage({
action: "init",
options: {
remux: !1,
alignGopsAtEnd: this.safeAppend_,
keepOriginalTimestamps: !0,
handlePartialData: this.handlePartialData_
}
}),
e
}
,
i.resetStats_ = function() {
this.mediaBytesTransferred = 0,
this.mediaRequests = 0,
this.mediaRequestsAborted = 0,
this.mediaRequestsTimedout = 0,
this.mediaRequestsErrored = 0,
this.mediaTransferDuration = 0,
this.mediaSecondsLoaded = 0
}
,
i.dispose = function() {
this.trigger("dispose"),
this.state = "DISPOSED",
this.pause(),
this.abort_(),
this.transmuxer_ && (this.transmuxer_.terminate(),
em.dispose()),
this.resetStats_(),
this.checkBufferTimeout_ && dr["default"].clearTimeout(this.checkBufferTimeout_),
this.syncController_ && this.triggerSyncInfoUpdate_ && this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_),
this.off()
}
,
i.setAudio = function(e) {
this.audioDisabled_ = !e,
e ? this.appendInitSegment_.audio = !0 : this.sourceUpdater_.removeAudio(0, this.duration_())
}
,
i.abort = function() {
return "WAITING" !== this.state ? void (this.pendingSegment_ && (this.pendingSegment_ = null)) : (this.abort_(),
this.state = "READY",
void (this.paused() || this.monitorBuffer_()))
}
,
i.abort_ = function() {
this.pendingSegment_ && this.pendingSegment_.abortRequests && this.pendingSegment_.abortRequests(),
this.pendingSegment_ = null,
this.callQueue_ = [],
this.loadQueue_ = [],
this.metadataQueue_.id3 = [],
this.metadataQueue_.caption = [],
this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_)
}
,
i.checkForAbort_ = function(e) {
return "APPENDING" !== this.state || this.pendingSegment_ ? this.pendingSegment_ && this.pendingSegment_.requestId === e ? !1 : !0 : (this.state = "READY",
!0)
}
,
i.error = function(e) {
return "undefined" != typeof e && (this.logger_("error occurred:", e),
this.error_ = e),
this.pendingSegment_ = null,
this.error_
}
,
i.endOfStream = function() {
this.ended_ = !0,
this.transmuxer_ && em.reset(this.transmuxer_),
this.gopBuffer_.length = 0,
this.pause(),
this.trigger("ended")
}
,
i.buffered_ = function() {
if (!this.sourceUpdater_ || !this.startingMediaInfo_)
return pn.createTimeRanges();
if ("main" === this.loaderType_) {
var e = this.startingMediaInfo_
, t = e.hasAudio
, i = e.hasVideo
, n = e.isMuxed;
if (i && t && !this.audioDisabled_ && !n)
return this.sourceUpdater_.buffered();
if (i)
return this.sourceUpdater_.videoBuffered()
}
return this.sourceUpdater_.audioBuffered()
}
,
i.initSegmentForMap = function(e, t) {
if (void 0 === t && (t = !1),
!e)
return null;
var i = fp(e)
, n = this.initSegments_[i];
return t && !n && e.bytes && (this.initSegments_[i] = n = {
resolvedUri: e.resolvedUri,
byterange: e.byterange,
bytes: e.bytes,
tracks: e.tracks,
timescales: e.timescales
}),
n || e
}
,
i.segmentKey = function(e, t) {
if (void 0 === t && (t = !1),
!e)
return null;
var i = pp(e)
, n = this.keyCache_[i];
this.cacheEncryptionKeys_ && t && !n && e.bytes && (this.keyCache_[i] = n = {
resolvedUri: e.resolvedUri,
bytes: e.bytes
});
var r = {
resolvedUri: (n || e).resolvedUri
};
return n && (r.bytes = n.bytes),
r
}
,
i.couldBeginLoading_ = function() {
return this.playlist_ && !this.paused()
}
,
i.load = function() {
return this.monitorBuffer_(),
this.playlist_ ? (this.syncController_.setDateTimeMapping(this.playlist_),
"INIT" === this.state && this.couldBeginLoading_() ? this.init_() : void (!this.couldBeginLoading_() || "READY" !== this.state && "INIT" !== this.state || (this.state = "READY"))) : void 0
}
,
i.init_ = function() {
return this.state = "READY",
this.resetEverything(),
this.monitorBuffer_()
}
,
i.playlist = function(e, t) {
if (void 0 === t && (t = {}),
e) {
var i = this.playlist_
, n = this.pendingSegment_;
this.playlist_ = e,
this.xhrOptions_ = t,
"INIT" === this.state && (e.syncInfo = {
mediaSequence: e.mediaSequence,
time: 0
});
var r = null;
if (i && (i.id ? r = i.id : i.uri && (r = i.uri)),
this.logger_("playlist update [" + r + " => " + (e.id || e.uri) + "]"),
this.trigger("syncinfoupdate"),
"INIT" === this.state && this.couldBeginLoading_())
return this.init_();
if (!i || i.uri !== e.uri)
return (null !== this.mediaIndex || this.handlePartialData_) && this.resyncLoader(),
this.currentMediaInfo_ = void 0,
void this.trigger("playlistupdate");
var a = e.mediaSequence - i.mediaSequence;
this.logger_("live window shift [" + a + "]"),
null !== this.mediaIndex && (this.mediaIndex -= a),
n && (n.mediaIndex -= a,
n.mediaIndex >= 0 && (n.segment = e.segments[n.mediaIndex])),
this.syncController_.saveExpiredSegmentInfo(i, e)
}
}
,
i.pause = function() {
this.checkBufferTimeout_ && (dr["default"].clearTimeout(this.checkBufferTimeout_),
this.checkBufferTimeout_ = null)
}
,
i.paused = function() {
return null === this.checkBufferTimeout_
}
,
i.resetEverything = function(e) {
this.ended_ = !1,
this.appendInitSegment_ = {
audio: !0,
video: !0
},
this.resetLoader(),
this.remove(0, 1 / 0, e),
this.transmuxer_ && this.transmuxer_.postMessage({
action: "clearAllMp4Captions"
})
}
,
i.resetLoader = function() {
this.fetchAtBuffer_ = !1,
this.resyncLoader()
}
,
i.resyncLoader = function() {
this.transmuxer_ && em.reset(this.transmuxer_),
this.mediaIndex = null,
this.syncPoint_ = null,
this.isPendingTimestampOffset_ = !1,
this.callQueue_ = [],
this.loadQueue_ = [],
this.metadataQueue_.id3 = [],
this.metadataQueue_.caption = [],
this.abort(),
this.transmuxer_ && this.transmuxer_.postMessage({
action: "clearParsedMp4Captions"
})
}
,
i.remove = function(e, t, i) {
if (void 0 === i && (i = function() {}
),
1 / 0 === t && (t = this.duration_()),
this.sourceUpdater_ && this.currentMediaInfo_) {
var n = 1
, r = function() {
n--,
0 === n && i()
};
this.audioDisabled_ || (n++,
this.sourceUpdater_.removeAudio(e, t, r)),
"main" === this.loaderType_ && this.currentMediaInfo_ && this.currentMediaInfo_.hasVideo && (this.gopBuffer_ = Jm(this.gopBuffer_, e, t, this.timeMapping_),
n++,
this.sourceUpdater_.removeVideo(e, t, r));
for (var a in this.inbandTextTracks_)
Ym(e, t, this.inbandTextTracks_[a]);
Ym(e, t, this.segmentMetadataTrack_),
r()
}
}
,
i.monitorBuffer_ = function() {
this.checkBufferTimeout_ && dr["default"].clearTimeout(this.checkBufferTimeout_),
this.checkBufferTimeout_ = dr["default"].setTimeout(this.monitorBufferTick_.bind(this), 1)
}
,
i.monitorBufferTick_ = function() {
"READY" === this.state && this.fillBuffer_(),
this.checkBufferTimeout_ && dr["default"].clearTimeout(this.checkBufferTimeout_),
this.checkBufferTimeout_ = dr["default"].setTimeout(this.monitorBufferTick_.bind(this), eg)
}
,
i.fillBuffer_ = function() {
if (!this.sourceUpdater_.updating()) {
this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()));
var e = this.buffered_()
, t = this.checkBuffer_(e, this.playlist_, this.mediaIndex, this.hasPlayed_(), this.currentTime_(), this.syncPoint_);
t && (t.timestampOffset = sg({
segmentTimeline: t.timeline,
currentTimeline: this.currentTimeline_,
startOfSegment: t.startOfSegment,
buffered: e,
overrideCheck: this.isPendingTimestampOffset_
}),
this.isPendingTimestampOffset_ = !1,
"number" == typeof t.timestampOffset && this.timelineChangeController_.pendingTimelineChange({
type: this.loaderType_,
from: this.currentTimeline_,
to: t.timeline
}),
this.loadSegment_(t))
}
}
,
i.isEndOfStream_ = function(e, t) {
if (void 0 === e && (e = this.mediaIndex),
void 0 === t && (t = this.playlist_),
!t || !this.mediaSource_)
return !1;
var i = e + 1 === t.segments.length;
return t.endList && "open" === this.mediaSource_.readyState && i
}
,
i.checkBuffer_ = function(e, t, i, n, r, a) {
var s = 0;
e.length && (s = e.end(e.length - 1));
var o = Math.max(0, s - r);
if (!t.segments.length)
return null;
if (o >= this.goalBufferLength_())
return null;
if (!n && o >= 1)
return null;
var u, l = null, c = !1;
if (null === a)
l = this.getSyncSegmentCandidate_(t),
c = !0;
else if (null !== i) {
var d = t.segments[i];
u = d && d.end ? d.end : s,
l = i + 1
} else if (this.fetchAtBuffer_) {
var h = ip.getMediaInfoForTime(t, s, a.segmentIndex, a.time);
l = h.mediaIndex,
u = h.startTime
} else {
var f = ip.getMediaInfoForTime(t, r, a.segmentIndex, a.time);
l = f.mediaIndex,
u = f.startTime
}
var p = this.generateSegmentInfo_(t, l, u, c);
return !p || this.mediaSource_ && this.playlist_ && p.mediaIndex === this.playlist_.segments.length - 1 && "ended" === this.mediaSource_.readyState && !this.seeking_() ? void 0 : (this.logger_("checkBuffer_ returning " + p.uri, {
segmentInfo: p,
playlist: t,
currentMediaIndex: i,
nextMediaIndex: l,
startOfSegment: u,
isSyncRequest: c
}),
p)
}
,
i.getSyncSegmentCandidate_ = 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)
}
,
i.generateSegmentInfo_ = function(e, t, i, n) {
if (0 > t || t >= e.segments.length)
return null;
var r, a, s = e.segments[t], o = this.sourceUpdater_.audioBuffered(), u = this.sourceUpdater_.videoBuffered();
return o.length && (r = o.end(o.length - 1) - this.sourceUpdater_.audioTimestampOffset()),
u.length && (a = $m(this.gopBuffer_, this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_)),
{
requestId: "segment-loader-" + Math.random(),
uri: s.resolvedUri,
mediaIndex: t,
isSyncRequest: n,
startOfSegment: i,
playlist: e,
bytes: null,
encryptedBytes: null,
timestampOffset: null,
timeline: s.timeline,
duration: s.duration,
segment: s,
byteLength: 0,
transmuxer: this.transmuxer_,
audioAppendStart: r,
gopsToAlignWith: a
}
}
,
i.abortRequestEarly_ = function(e) {
if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !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 = ip.estimateSegmentRequestTime(n, i, this.playlist_, e.bytesReceived)
, a = Mf(this.buffered_(), t, this.vhs_.tech_.playbackRate()) - 1;
if (a >= r)
return !1;
var s = qm({
master: this.vhs_.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
, l = .5;
return If >= a && (l = 1),
!s.playlist || s.playlist.uri === this.playlist_.uri || l > u ? !1 : (this.bandwidth = s.playlist.attributes.BANDWIDTH * jp.BANDWIDTH_VARIANCE + 1,
this.abort(),
this.trigger("earlyabort"),
!0)
}
}
,
i.handleAbort_ = function() {
this.mediaRequestsAborted += 1
}
,
i.handleProgress_ = function(e, t) {
this.checkForAbort_(t.requestId) || this.abortRequestEarly_(t.stats) || this.trigger("progress")
}
,
i.handleTrackInfo_ = function(e, t) {
this.checkForAbort_(e.requestId) || this.abortRequestEarly_(e.stats) || this.checkForIllegalMediaSwitch(t) || (t = t || {},
Zm(this.currentMediaInfo_, t) || (this.appendInitSegment_ = {
audio: !0,
video: !0
},
this.startingMediaInfo_ = t,
this.currentMediaInfo_ = t,
this.logger_("trackinfo update", t),
this.trigger("trackinfo")),
this.checkForAbort_(e.requestId) || this.abortRequestEarly_(e.stats) || (this.pendingSegment_.trackInfo = t,
this.hasEnoughInfoToAppend_() && this.processCallQueue_()))
}
,
i.handleTimingInfo_ = function(e, t, i, n) {
if (!this.checkForAbort_(e.requestId) && !this.abortRequestEarly_(e.stats)) {
var r = this.pendingSegment_
, a = ag(t);
r[a] = r[a] || {},
r[a][i] = n,
this.logger_("timinginfo: " + t + " - " + i + " - " + n),
this.hasEnoughInfoToAppend_() && this.processCallQueue_()
}
}
,
i.handleCaptions_ = function(e, t) {
var i = this;
if (!this.checkForAbort_(e.requestId) && !this.abortRequestEarly_(e.stats)) {
if (0 === t.length)
return void this.logger_("SegmentLoader received no captions from a caption event");
var n = this.pendingSegment_;
if (!n.hasAppendedData_)
return void this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, e, t));
var r = null === this.sourceUpdater_.videoTimestampOffset() ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset()
, a = {};
t.forEach(function(e) {
a[e.stream] = a[e.stream] || {
startTime: 1 / 0,
captions: [],
endTime: 0
};
var t = a[e.stream];
t.startTime = Math.min(t.startTime, e.startTime + r),
t.endTime = Math.max(t.endTime, e.endTime + r),
t.captions.push(e)
}),
Object.keys(a).forEach(function(e) {
var t = a[e]
, n = t.startTime
, s = t.endTime
, o = t.captions
, u = i.inbandTextTracks_;
i.logger_("adding cues from " + n + " -> " + s + " for " + e),
Wm(u, i.vhs_.tech_, e),
Ym(n, s, u[e]),
zm({
captionArray: o,
inbandTextTracks: u,
timestampOffset: r
})
}),
this.transmuxer_ && this.transmuxer_.postMessage({
action: "clearParsedMp4Captions"
})
}
}
,
i.handleId3_ = function(e, t, i) {
if (!this.checkForAbort_(e.requestId) && !this.abortRequestEarly_(e.stats)) {
var n = this.pendingSegment_;
if (!n.hasAppendedData_)
return void this.metadataQueue_.id3.push(this.handleId3_.bind(this, e, t, i));
var r = null === this.sourceUpdater_.videoTimestampOffset() ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
Km(this.inbandTextTracks_, i, this.vhs_.tech_),
Xm({
inbandTextTracks: this.inbandTextTracks_,
metadataArray: t,
timestampOffset: r,
videoDuration: this.duration_()
})
}
}
,
i.processMetadataQueue_ = function() {
this.metadataQueue_.id3.forEach(function(e) {
return e()
}),
this.metadataQueue_.caption.forEach(function(e) {
return e()
}),
this.metadataQueue_.id3 = [],
this.metadataQueue_.caption = []
}
,
i.processCallQueue_ = function() {
var e = this.callQueue_;
this.callQueue_ = [],
e.forEach(function(e) {
return e()
})
}
,
i.processLoadQueue_ = function() {
var e = this.loadQueue_;
this.loadQueue_ = [],
e.forEach(function(e) {
return e()
})
}
,
i.hasEnoughInfoToLoad_ = function() {
if ("audio" !== this.loaderType_)
return !0;
var e = this.pendingSegment_;
return e ? this.currentMediaInfo_ && og({
timelineChangeController: this.timelineChangeController_,
currentTimeline: this.currentTimeline_,
segmentTimeline: e.timeline,
loaderType: this.loaderType_,
audioDisabled: this.audioDisabled_
}) ? !1 : !0 : !1
}
,
i.hasEnoughInfoToAppend_ = function() {
if (!this.sourceUpdater_.ready())
return !1;
var e = this.pendingSegment_;
if (!e || !e.trackInfo)
return !1;
if (!this.handlePartialData_) {
var t = this.currentMediaInfo_
, i = t.hasAudio
, n = t.hasVideo
, r = t.isMuxed;
if (n && !e.videoTimingInfo)
return !1;
if (i && !this.audioDisabled_ && !r && !e.audioTimingInfo)
return !1
}
return og({
timelineChangeController: this.timelineChangeController_,
currentTimeline: this.currentTimeline_,
segmentTimeline: e.timeline,
loaderType: this.loaderType_,
audioDisabled: this.audioDisabled_
}) ? !1 : !0
}
,
i.handleData_ = function(e, t) {
if (!this.checkForAbort_(e.requestId) && !this.abortRequestEarly_(e.stats)) {
if (this.callQueue_.length || !this.hasEnoughInfoToAppend_())
return void this.callQueue_.push(this.handleData_.bind(this, e, t));
var i = this.pendingSegment_;
if (this.setTimeMapping_(i.timeline),
this.updateMediaSecondsLoaded_(i.segment),
"closed" !== this.mediaSource_.readyState) {
if (e.map && (e.map = this.initSegmentForMap(e.map, !0),
i.segment.map = e.map),
e.key && this.segmentKey(e.key, !0),
i.isFmp4 = e.isFmp4,
i.timingInfo = i.timingInfo || {},
i.isFmp4)
this.trigger("fmp4"),
i.timingInfo.start = i[ag(t.type)].start;
else {
var n, r = "main" === this.loaderType_ && this.currentMediaInfo_.hasVideo;
r && (n = this.handlePartialData_ ? t.videoFramePtsTime : i.videoTimingInfo.start),
i.timingInfo.start = this.trueSegmentStart_({
currentStart: i.timingInfo.start,
playlist: i.playlist,
mediaIndex: i.mediaIndex,
currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
useVideoTimingInfo: r,
firstVideoFrameTimeForData: n,
videoTimingInfo: i.videoTimingInfo,
audioTimingInfo: i.audioTimingInfo
})
}
this.updateAppendInitSegmentStatus(i, t.type),
this.updateSourceBufferTimestampOffset_(i),
i.hasAppendedData_ = !0,
this.processMetadataQueue_(),
this.appendData_(i, t)
}
}
}
,
i.updateAppendInitSegmentStatus = function(e, t) {
"main" !== this.loaderType_ || "number" != typeof e.timestampOffset || e.changedTimestampOffset || (this.appendInitSegment_ = {
audio: !0,
video: !0
}),
this.playlistOfLastInitSegment_[t] !== e.playlist && (this.appendInitSegment_[t] = !0)
}
,
i.getInitSegmentAndUpdateState_ = function(e) {
var t = e.type
, i = e.initSegment
, n = e.map
, r = e.playlist;
if (n) {
var a = fp(n);
if (this.activeInitSegmentId_ === a)
return null;
i = this.initSegmentForMap(n, !0).bytes,
this.activeInitSegmentId_ = a
}
return i && this.appendInitSegment_[t] ? (this.playlistOfLastInitSegment_[t] = r,
this.appendInitSegment_[t] = n ? !0 : !1,
this.activeInitSegmentId_ = null,
i) : null
}
,
i.appendToSourceBuffer_ = function(e) {
var t = this
, i = e.segmentInfo
, n = e.type
, r = e.initSegment
, a = e.data
, s = [a]
, o = a.byteLength;
r && (s.unshift(r),
o += r.byteLength);
var u = im({
bytes: o,
segments: s
});
this.sourceUpdater_.appendBuffer({
segmentInfo: i,
type: n,
bytes: u
}, function(e) {
e && (t.error(n + " append of " + u.length + "b failed for segment #" + i.mediaIndex + " in playlist " + i.playlist.id),
t.trigger("appenderror"))
})
}
,
i.handleVideoSegmentTimingInfo_ = function(e, t) {
if (this.pendingSegment_ && e === this.pendingSegment_.requestId) {
var i = this.pendingSegment_.segment;
i.videoTimingInfo || (i.videoTimingInfo = {}),
i.videoTimingInfo.transmuxerPrependedSeconds = t.prependedContentDuration || 0,
i.videoTimingInfo.transmuxedPresentationStart = t.start.presentation,
i.videoTimingInfo.transmuxedPresentationEnd = t.end.presentation,
i.videoTimingInfo.baseMediaDecodeTime = t.baseMediaDecodeTime
}
}
,
i.appendData_ = function(e, t) {
var i = t.type
, n = t.data;
if (n && n.byteLength && ("audio" !== i || !this.audioDisabled_)) {
var r = this.getInitSegmentAndUpdateState_({
type: i,
initSegment: t.initSegment,
playlist: e.playlist,
map: e.isFmp4 ? e.segment.map : null
});
this.appendToSourceBuffer_({
segmentInfo: e,
type: i,
initSegment: r,
data: n
})
}
}
,
i.loadSegment_ = function(e) {
var t = this;
return this.state = "WAITING",
this.pendingSegment_ = e,
this.trimBackBuffer_(e),
"number" == typeof e.timestampOffset && this.transmuxer_ && this.transmuxer_.postMessage({
action: "clearAllMp4Captions"
}),
this.hasEnoughInfoToLoad_() ? void this.updateTransmuxerAndRequestSegment_(e) : void this.loadQueue_.push(function() {
var i = t.buffered_();
"number" == typeof e.timestampOffset && (e.timestampOffset = sg({
segmentTimeline: e.timeline,
currentTimeline: t.currentTimeline_,
startOfSegment: e.startOfSegment,
buffered: i,
overrideCheck: !0
})),
delete e.audioAppendStart;
var n = t.sourceUpdater_.audioBuffered();
n.length && (e.audioAppendStart = n.end(n.length - 1) - t.sourceUpdater_.audioTimestampOffset()),
t.updateTransmuxerAndRequestSegment_(e)
})
}
,
i.updateTransmuxerAndRequestSegment_ = function(e) {
this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset) && (this.gopBuffer_.length = 0,
e.gopsToAlignWith = [],
this.timeMapping_ = 0,
this.transmuxer_.postMessage({
action: "reset"
}),
this.transmuxer_.postMessage({
action: "setTimestampOffset",
timestampOffset: e.timestampOffset
}));
var t = this.createSimplifiedSegmentObj_(e);
e.abortRequests = vm({
xhr: this.vhs_.xhr,
xhrOptions: this.xhrOptions_,
decryptionWorker: this.decrypter_,
segment: t,
handlePartialData: this.handlePartialData_,
abortFn: this.handleAbort_.bind(this),
progressFn: this.handleProgress_.bind(this),
trackInfoFn: this.handleTrackInfo_.bind(this),
timingInfoFn: this.handleTimingInfo_.bind(this),
videoSegmentTimingInfoFn: this.handleVideoSegmentTimingInfo_.bind(this, e.requestId),
captionsFn: this.handleCaptions_.bind(this),
id3Fn: this.handleId3_.bind(this),
dataFn: this.handleData_.bind(this),
doneFn: this.segmentRequestFinished_.bind(this)
})
}
,
i.trimBackBuffer_ = function() {
var e = ng(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
e > 0 && this.remove(0, e)
}
,
i.createSimplifiedSegmentObj_ = function(e) {
var t = e.segment
, i = {
resolvedUri: t.resolvedUri,
byterange: t.byterange,
requestId: e.requestId,
transmuxer: e.transmuxer,
audioAppendStart: e.audioAppendStart,
gopsToAlignWith: e.gopsToAlignWith
}
, n = e.playlist.segments[e.mediaIndex];
if (n && n.end && n.timeline === t.timeline && (i.baseStartTime = n.end + e.timestampOffset),
t.key) {
var r = t.key.iv || new Uint32Array([0, 0, 0, e.mediaIndex + e.playlist.mediaSequence]);
i.key = this.segmentKey(t.key),
i.key.iv = r
}
return t.map && (i.map = this.initSegmentForMap(t.map)),
i
}
,
i.saveTransferStats_ = function(e) {
this.mediaRequests += 1,
e && (this.mediaBytesTransferred += e.bytesReceived,
this.mediaTransferDuration += e.roundTripTime)
}
,
i.saveBandwidthRelatedStats_ = function(e) {
this.bandwidth = e.bandwidth,
this.roundTrip = e.roundTripTime,
this.pendingSegment_.byteLength = e.bytesReceived
}
,
i.handleTimeout_ = function() {
this.mediaRequestsTimedout += 1,
this.bandwidth = 1,
this.roundTrip = 0 / 0,
this.trigger("bandwidthupdate")
}
,
i.segmentRequestFinished_ = function(e, t, i) {
if (this.callQueue_.length)
return void this.callQueue_.push(this.segmentRequestFinished_.bind(this, e, t, i));
if (this.saveTransferStats_(t.stats),
this.pendingSegment_ && t.requestId === this.pendingSegment_.requestId) {
if (e) {
if (this.pendingSegment_ = null,
this.state = "READY",
e.code === nm.ABORTED)
return;
return this.pause(),
e.code === nm.TIMEOUT ? void this.handleTimeout_() : (this.mediaRequestsErrored += 1,
this.error(e),
void this.trigger("error"))
}
this.saveBandwidthRelatedStats_(t.stats);
var n = this.pendingSegment_;
n.endOfAllRequests = t.endOfAllRequests,
i.gopInfo && (this.gopBuffer_ = Qm(this.gopBuffer_, i.gopInfo, this.safeAppend_)),
this.state = "APPENDING";
var r = this.isEndOfStream_(n.mediaIndex, n.playlist)
, a = null !== this.mediaIndex
, s = n.timeline !== this.currentTimeline_ && n.timeline > 0;
!n.isFmp4 && (r || a && s) && em.endTimeline(this.transmuxer_),
this.trigger("appending"),
this.waitForAppendsToComplete_(n)
}
}
,
i.setTimeMapping_ = function(e) {
var t = this.syncController_.mappingForTimeline(e);
null !== t && (this.timeMapping_ = t)
}
,
i.updateMediaSecondsLoaded_ = function(e) {
this.mediaSecondsLoaded += "number" == typeof e.start && "number" == typeof e.end ? e.end - e.start : e.duration
}
,
i.shouldUpdateTransmuxerTimestampOffset_ = function(e) {
return null === e ? !1 : "main" === this.loaderType_ && e !== this.sourceUpdater_.videoTimestampOffset() ? !0 : this.audioDisabled_ || e === this.sourceUpdater_.audioTimestampOffset() ? !1 : !0
}
,
i.trueSegmentStart_ = function(e) {
var t = e.currentStart
, i = e.playlist
, n = e.mediaIndex
, r = e.firstVideoFrameTimeForData
, a = e.currentVideoTimestampOffset
, s = e.useVideoTimingInfo
, o = e.videoTimingInfo
, u = e.audioTimingInfo;
if ("undefined" != typeof t)
return t;
if (!s)
return u.start;
var l = i.segments[n - 1];
return 0 !== n && l && "undefined" != typeof l.start && l.end === r + a ? o.start : r
}
,
i.waitForAppendsToComplete_ = function(e) {
if (!this.currentMediaInfo_)
return this.error({
message: "No starting media returned, likely due to an unsupported media format.",
blacklistDuration: 1 / 0
}),
void this.trigger("error");
var t = this.currentMediaInfo_
, i = t.hasAudio
, n = t.hasVideo
, r = t.isMuxed
, a = "main" === this.loaderType_ && n
, s = !this.audioDisabled_ && i && !r;
return e.waitingOnAppends = 0,
e.hasAppendedData_ ? (a && e.waitingOnAppends++,
s && e.waitingOnAppends++,
a && this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, e)),
void (s && this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, e)))) : (e.timingInfo || "number" != typeof e.timestampOffset || (this.isPendingTimestampOffset_ = !0),
e.timingInfo = {
start: 0
},
e.waitingOnAppends++,
this.isPendingTimestampOffset_ || (this.updateSourceBufferTimestampOffset_(e),
this.processMetadataQueue_()),
void this.checkAppendsDone_(e))
}
,
i.checkAppendsDone_ = function(e) {
this.checkForAbort_(e.requestId) || (e.waitingOnAppends--,
0 === e.waitingOnAppends && this.handleAppendsDone_())
}
,
i.checkForIllegalMediaSwitch = function(e) {
var t = ig(this.loaderType_, this.currentMediaInfo_, e);
return t ? (this.error({
message: t,
blacklistDuration: 1 / 0
}),
this.trigger("error"),
!0) : !1
}
,
i.updateSourceBufferTimestampOffset_ = function(e) {
if (null !== e.timestampOffset && "number" == typeof e.timingInfo.start && !e.changedTimestampOffset && "main" === this.loaderType_) {
var t = !1;
e.timestampOffset -= e.timingInfo.start,
e.changedTimestampOffset = !0,
e.timestampOffset !== this.sourceUpdater_.videoTimestampOffset() && (this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),
t = !0),
e.timestampOffset !== this.sourceUpdater_.audioTimestampOffset() && (this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),
t = !0),
t && this.trigger("timestampoffset")
}
}
,
i.updateTimingInfoEnd_ = function(e) {
e.timingInfo = e.timingInfo || {};
var t = "main" === this.loaderType_ && this.currentMediaInfo_.hasVideo
, i = t && e.videoTimingInfo ? e.videoTimingInfo : e.audioTimingInfo;
i && (e.timingInfo.end = "number" == typeof i.end ? i.end : i.start + e.duration)
}
,
i.handleAppendsDone_ = function() {
if (this.pendingSegment_ && this.trigger("appendsdone"),
!this.pendingSegment_)
return this.state = "READY",
void (this.paused() || this.monitorBuffer_());
var e = this.pendingSegment_;
if (this.updateTimingInfoEnd_(e),
this.shouldSaveSegmentTimingInfo_ && this.syncController_.saveSegmentTimingInfo({
segmentInfo: e,
shouldSaveTimelineMapping: "main" === this.loaderType_
}),
this.logger_(rg(e)),
this.recordThroughput_(e),
this.pendingSegment_ = null,
this.state = "READY",
e.isSyncRequest)
return void this.trigger("syncinfoupdate");
this.addSegmentMetadataCue_(e),
this.fetchAtBuffer_ = !0,
this.currentTimeline_ !== e.timeline && (this.timelineChangeController_.lastTimelineChange({
type: this.loaderType_,
from: this.currentTimeline_,
to: e.timeline
}),
"main" !== this.loaderType_ || this.audioDisabled_ || this.timelineChangeController_.lastTimelineChange({
type: "audio",
from: this.currentTimeline_,
to: e.timeline
})),
this.currentTimeline_ = e.timeline,
this.trigger("syncinfoupdate");
var t = e.segment;
if (t.end && this.currentTime_() - t.end > 3 * e.playlist.targetDuration)
return void this.resetEverything();
var i = null !== this.mediaIndex;
i && this.trigger("bandwidthupdate"),
this.trigger("progress"),
this.mediaIndex = e.mediaIndex,
this.isEndOfStream_(e.mediaIndex, e.playlist) && this.endOfStream(),
this.trigger("appended"),
this.paused() || this.monitorBuffer_()
}
,
i.recordThroughput_ = 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
}
,
i.addSegmentMetadataCue_ = function(e) {
if (this.segmentMetadataTrack_) {
var t = e.segment
, i = t.start
, n = t.end;
if (tg(i) && tg(n)) {
Ym(i, n, this.segmentMetadataTrack_);
var r = dr["default"].WebKitDataCue || dr["default"].VTTCue
, a = {
custom: t.custom,
dateTimeObject: t.dateTimeObject,
dateTimeString: t.dateTimeString,
bandwidth: e.playlist.attributes.BANDWIDTH,
resolution: e.playlist.attributes.RESOLUTION,
codecs: e.playlist.attributes.CODECS,
byteLength: e.byteLength,
uri: e.uri,
timeline: e.timeline,
playlist: e.playlist.id,
start: i,
end: n
}
, s = JSON.stringify(a)
, o = new r(i,n,s);
o.value = a,
this.segmentMetadataTrack_.addCue(o)
}
}
}
,
t
}(pn.EventTarget), lg = function(e) {
return "string" != typeof e ? e : e.replace(/./, function(e) {
return e.toUpperCase()
})
}, cg = ["video", "audio"], dg = function(e, t) {
var i = t[e + "Buffer"];
return i && i.updating || t.queuePending[e]
}, hg = function(e, t) {
for (var i = 0; i < t.length; i++) {
var n = t[i];
if ("mediaSource" === n.type)
return null;
if (n.type === e)
return i
}
return null
}, fg = function Yy(e, t) {
if (0 !== t.queue.length) {
var i = 0
, n = t.queue[i];
if ("mediaSource" === n.type)
return void (t.updating() || "closed" === t.mediaSource.readyState || (t.queue.shift(),
n.action(t),
n.doneFn && n.doneFn(),
Yy("audio", t),
Yy("video", t)));
if ("mediaSource" !== e && t.started_ && "closed" !== t.mediaSource.readyState && !dg(e, t)) {
if (n.type !== e) {
if (i = hg(e, t.queue),
null === i)
return;
n = t.queue[i]
}
return t.queue.splice(i, 1),
n.action(e, t),
n.doneFn ? void (t.queuePending[e] = n) : void Yy(e, t)
}
}
}, pg = function(e, t) {
var i = t[e + "Buffer"]
, n = lg(e);
i && (i.removeEventListener("updateend", t["on" + n + "UpdateEnd_"]),
i.removeEventListener("error", t["on" + n + "Error_"]),
t.codecs[e] = null,
t[e + "Buffer"] = null)
}, mg = function(e, t) {
return e && t && -1 !== Array.prototype.indexOf.call(e.sourceBuffers, t)
}, gg = {
appendBuffer: function(e, t) {
return function(i, n) {
var r = n[i + "Buffer"];
mg(n.mediaSource, r) && (n.logger_("Appending segment " + t.mediaIndex + "'s " + e.length + " bytes to " + i + "Buffer"),
r.appendBuffer(e))
}
},
remove: function(e, t) {
return function(i, n) {
var r = n[i + "Buffer"];
mg(n.mediaSource, r) && (n.logger_("Removing " + e + " to " + t + " from " + i + "Buffer"),
r.remove(e, t))
}
},
timestampOffset: function(e) {
return function(t, i) {
var n = i[t + "Buffer"];
mg(i.mediaSource, n) && (i.logger_("Setting " + t + "timestampOffset to " + e),
n.timestampOffset = e)
}
},
callback: function(e) {
return function() {
e()
}
},
endOfStream: function(e) {
return function(t) {
if ("open" === t.mediaSource.readyState) {
t.logger_("Calling mediaSource endOfStream(" + (e || "") + ")");
try {
t.mediaSource.endOfStream(e)
} catch (i) {
pn.log.warn("Failed to call media source endOfStream", i)
}
}
}
},
duration: function(e) {
return function(t) {
t.logger_("Setting mediaSource duration to " + e);
try {
t.mediaSource.duration = e
} catch (i) {
pn.log.warn("Failed to set media source duration", i)
}
}
},
abort: function() {
return function(e, t) {
if ("open" === t.mediaSource.readyState) {
var i = t[e + "Buffer"];
if (mg(t.mediaSource, i)) {
t.logger_("calling abort on " + e + "Buffer");
try {
i.abort()
} catch (n) {
pn.log.warn("Failed to abort on " + e + "Buffer", n)
}
}
}
}
},
addSourceBuffer: function(e, t) {
return function(i) {
var n = lg(e)
, r = Mu(t);
i.logger_("Adding " + e + "Buffer with codec " + t + " to mediaSource");
var a = i.mediaSource.addSourceBuffer(r);
a.addEventListener("updateend", i["on" + n + "UpdateEnd_"]),
a.addEventListener("error", i["on" + n + "Error_"]),
i.codecs[e] = t,
i[e + "Buffer"] = a
}
},
removeSourceBuffer: function(e) {
return function(t) {
var i = t[e + "Buffer"];
if (pg(e, t),
mg(t.mediaSource, i)) {
t.logger_("Removing " + e + "Buffer with codec " + t.codecs[e] + " from mediaSource");
try {
t.mediaSource.removeSourceBuffer(i)
} catch (n) {
pn.log.warn("Failed to removeSourceBuffer " + e + "Buffer", n)
}
}
}
},
changeType: function(e) {
return function(t, i) {
var n = i[t + "Buffer"]
, r = Mu(e);
mg(i.mediaSource, n) && i.codecs[t] !== e && (i.logger_("changing " + t + "Buffer codec from " + i.codecs[t] + " to " + e),
n.changeType(r),
i.codecs[t] = e)
}
}
}, vg = function(e) {
var t = e.type
, i = e.sourceUpdater
, n = e.action
, r = e.doneFn
, a = e.name;
i.queue.push({
type: t,
action: n,
doneFn: r,
name: a
}),
fg(t, i)
}, yg = function(e, t) {
return function() {
if (t.queuePending[e]) {
var i = t.queuePending[e].doneFn;
t.queuePending[e] = null,
i && i(t[e + "Error_"])
}
fg(e, t)
}
}, _g = function(e) {
function t(t) {
var i;
return i = e.call(this) || this,
i.mediaSource = t,
i.sourceopenListener_ = function() {
return fg("mediaSource", mr(i))
}
,
i.mediaSource.addEventListener("sourceopen", i.sourceopenListener_),
i.logger_ = Om("SourceUpdater"),
i.audioTimestampOffset_ = 0,
i.videoTimestampOffset_ = 0,
i.queue = [],
i.queuePending = {
audio: null,
video: null
},
i.delayedAudioAppendQueue_ = [],
i.videoAppendQueued_ = !1,
i.codecs = {},
i.onVideoUpdateEnd_ = yg("video", mr(i)),
i.onAudioUpdateEnd_ = yg("audio", mr(i)),
i.onVideoError_ = function(e) {
i.videoError_ = e
}
,
i.onAudioError_ = function(e) {
i.audioError_ = e
}
,
i.started_ = !1,
i
}
gr(t, e);
var i = t.prototype;
return i.ready = function() {
return this.started_
}
,
i.createSourceBuffers = function(e) {
this.ready() || (this.addOrChangeSourceBuffers(e),
this.started_ = !0,
this.trigger("ready"))
}
,
i.addSourceBuffer = function(e, t) {
vg({
type: "mediaSource",
sourceUpdater: this,
action: gg.addSourceBuffer(e, t),
name: "addSourceBuffer"
})
}
,
i.abort = function(e) {
vg({
type: e,
sourceUpdater: this,
action: gg.abort(e),
name: "abort"
})
}
,
i.removeSourceBuffer = function(e) {
return this.canRemoveSourceBuffer() ? void vg({
type: "mediaSource",
sourceUpdater: this,
action: gg.removeSourceBuffer(e),
name: "removeSourceBuffer"
}) : void pn.log.error("removeSourceBuffer is not supported!")
}
,
i.canRemoveSourceBuffer = function() {
return !pn.browser.IE_VERSION && dr["default"].MediaSource && dr["default"].MediaSource.prototype && "function" == typeof dr["default"].MediaSource.prototype.removeSourceBuffer
}
,
t.canChangeType = function() {
return dr["default"].SourceBuffer && dr["default"].SourceBuffer.prototype && "function" == typeof dr["default"].SourceBuffer.prototype.changeType
}
,
i.canChangeType = function() {
return this.constructor.canChangeType()
}
,
i.changeType = function(e, t) {
return this.canChangeType() ? void vg({
type: e,
sourceUpdater: this,
action: gg.changeType(t),
name: "changeType"
}) : void pn.log.error("changeType is not supported!")
}
,
i.addOrChangeSourceBuffers = function(e) {
var t = this;
if (!e || "object" != typeof e || 0 === Object.keys(e).length)
throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
Object.keys(e).forEach(function(i) {
var n = e[i];
return t.ready() ? void (t.canChangeType() && t.changeType(i, n)) : t.addSourceBuffer(i, n)
})
}
,
i.appendBuffer = function(e, t) {
var i = this
, n = e.segmentInfo
, r = e.type
, a = e.bytes;
if (this.processedAppend_ = !0,
"audio" === r && this.videoBuffer && !this.videoAppendQueued_)
return this.delayedAudioAppendQueue_.push([e, t]),
void this.logger_("delayed audio append of " + a.length + " until video append");
if (vg({
type: r,
sourceUpdater: this,
action: gg.appendBuffer(a, n || {
mediaIndex: -1
}),
doneFn: t,
name: "appendBuffer"
}),
"video" === r) {
if (this.videoAppendQueued_ = !0,
!this.delayedAudioAppendQueue_.length)
return;
var s = this.delayedAudioAppendQueue_.slice();
this.logger_("queuing delayed audio " + s.length + " appendBuffers"),
this.delayedAudioAppendQueue_.length = 0,
s.forEach(function(e) {
i.appendBuffer.apply(i, e)
})
}
}
,
i.audioBuffered = function() {
return mg(this.mediaSource, this.audioBuffer) && this.audioBuffer.buffered ? this.audioBuffer.buffered : pn.createTimeRange()
}
,
i.videoBuffered = function() {
return mg(this.mediaSource, this.videoBuffer) && this.videoBuffer.buffered ? this.videoBuffer.buffered : pn.createTimeRange()
}
,
i.buffered = function() {
var e = mg(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null
, t = mg(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
return t && !e ? this.audioBuffered() : e && !t ? this.videoBuffered() : Of(this.audioBuffered(), this.videoBuffered())
}
,
i.setDuration = function(e, t) {
void 0 === t && (t = yn),
vg({
type: "mediaSource",
sourceUpdater: this,
action: gg.duration(e),
name: "duration",
doneFn: t
})
}
,
i.endOfStream = function(e, t) {
void 0 === e && (e = null),
void 0 === t && (t = yn),
"string" != typeof e && (e = void 0),
vg({
type: "mediaSource",
sourceUpdater: this,
action: gg.endOfStream(e),
name: "endOfStream",
doneFn: t
})
}
,
i.removeAudio = function(e, t, i) {
return void 0 === i && (i = yn),
this.audioBuffered().length && 0 !== this.audioBuffered().end(0) ? void vg({
type: "audio",
sourceUpdater: this,
action: gg.remove(e, t),
doneFn: i,
name: "remove"
}) : void i()
}
,
i.removeVideo = function(e, t, i) {
return void 0 === i && (i = yn),
this.videoBuffered().length && 0 !== this.videoBuffered().end(0) ? void vg({
type: "video",
sourceUpdater: this,
action: gg.remove(e, t),
doneFn: i,
name: "remove"
}) : void i()
}
,
i.updating = function() {
return dg("audio", this) || dg("video", this) ? !0 : !1
}
,
i.audioTimestampOffset = function(e) {
return "undefined" != typeof e && this.audioBuffer && this.audioTimestampOffset_ !== e && (vg({
type: "audio",
sourceUpdater: this,
action: gg.timestampOffset(e),
name: "timestampOffset"
}),
this.audioTimestampOffset_ = e),
this.audioTimestampOffset_
}
,
i.videoTimestampOffset = function(e) {
return "undefined" != typeof e && this.videoBuffer && this.videoTimestampOffset !== e && (vg({
type: "video",
sourceUpdater: this,
action: gg.timestampOffset(e),
name: "timestampOffset"
}),
this.videoTimestampOffset_ = e),
this.videoTimestampOffset_
}
,
i.audioQueueCallback = function(e) {
this.audioBuffer && vg({
type: "audio",
sourceUpdater: this,
action: gg.callback(e),
name: "callback"
})
}
,
i.videoQueueCallback = function(e) {
this.videoBuffer && vg({
type: "video",
sourceUpdater: this,
action: gg.callback(e),
name: "callback"
})
}
,
i.dispose = function() {
var e = this;
this.trigger("dispose"),
cg.forEach(function(t) {
e.abort(t),
e.canRemoveSourceBuffer() ? e.removeSourceBuffer(t) : e[t + "QueueCallback"](function() {
return pg(t, e)
})
}),
this.videoAppendQueued_ = !1,
this.delayedAudioAppendQueue_.length = 0,
this.sourceopenListener_ && this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_),
this.off()
}
,
t
}(pn.EventTarget), bg = function(e) {
return decodeURIComponent(escape(String.fromCharCode.apply(null, e)))
}, Tg = new Uint8Array("\n\n".split("").map(function(e) {
return e.charCodeAt(0)
})), Sg = function(e) {
function t(t, i) {
var n;
return void 0 === i && (i = {}),
n = e.call(this, t, i) || this,
n.handlePartialData_ = !1,
n.mediaSource_ = null,
n.subtitlesTrack_ = null,
n.loaderType_ = "subtitle",
n.featuresNativeTextTracks_ = t.featuresNativeTextTracks,
n.shouldSaveSegmentTimingInfo_ = !1,
n
}
gr(t, e);
var i = t.prototype;
return i.createTransmuxer_ = function() {
return null
}
,
i.buffered_ = function() {
if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length)
return pn.createTimeRanges();
var e = this.subtitlesTrack_.cues
, t = e[0].startTime
, i = e[e.length - 1].startTime;
return pn.createTimeRanges([[t, i]])
}
,
i.initSegmentForMap = function(e, t) {
if (void 0 === t && (t = !1),
!e)
return null;
var i = fp(e)
, n = this.initSegments_[i];
if (t && !n && e.bytes) {
var r = Tg.byteLength + e.bytes.byteLength
, a = new Uint8Array(r);
a.set(e.bytes),
a.set(Tg, e.bytes.byteLength),
this.initSegments_[i] = n = {
resolvedUri: e.resolvedUri,
byterange: e.byterange,
bytes: a
}
}
return n || e
}
,
i.couldBeginLoading_ = function() {
return this.playlist_ && this.subtitlesTrack_ && !this.paused()
}
,
i.init_ = function() {
return this.state = "READY",
this.resetEverything(),
this.monitorBuffer_()
}
,
i.track = function(e) {
return "undefined" == typeof e ? this.subtitlesTrack_ : (this.subtitlesTrack_ = e,
"INIT" === this.state && this.couldBeginLoading_() && this.init_(),
this.subtitlesTrack_)
}
,
i.remove = function(e, t) {
Ym(e, t, this.subtitlesTrack_)
}
,
i.fillBuffer_ = 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)
}
}
,
i.skipEmptySegments_ = function(e) {
for (; e && e.segment.empty; )
e = this.generateSegmentInfo_(e.playlist, e.mediaIndex + 1, e.startOfSegment + e.duration, e.isSyncRequest);
return e
}
,
i.stopForError = function(e) {
this.error(e),
this.state = "READY",
this.pause(),
this.trigger("error")
}
,
i.segmentRequestFinished_ = function(e, t, i) {
var n = this;
if (!this.subtitlesTrack_)
return void (this.state = "READY");
if (this.saveTransferStats_(t.stats),
!this.pendingSegment_)
return this.state = "READY",
void (this.mediaRequestsAborted += 1);
if (e)
return e.code === nm.TIMEOUT && this.handleTimeout_(),
e.code === nm.ABORTED ? this.mediaRequestsAborted += 1 : this.mediaRequestsErrored += 1,
void this.stopForError(e);
this.saveBandwidthRelatedStats_(t.stats),
this.state = "APPENDING",
this.trigger("appending");
var r = this.pendingSegment_
, a = r.segment;
if (a.map && (a.map.bytes = t.map.bytes),
r.bytes = t.bytes,
"function" != typeof dr["default"].WebVTT && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) {
var s, o = function() {
n.subtitlesTrack_.tech_.off("vttjsloaded", s),
n.stopForError({
message: "Error loading vtt.js"
})
};
return s = function() {
n.subtitlesTrack_.tech_.off("vttjserror", o),
n.segmentRequestFinished_(e, t, i)
}
,
this.state = "WAITING_ON_VTTJS",
this.subtitlesTrack_.tech_.one("vttjsloaded", s),
void this.subtitlesTrack_.tech_.one("vttjserror", o)
}
a.requested = !0;
try {
this.parseVTTCues_(r)
} catch (u) {
return void this.stopForError({
message: u.message
})
}
return this.updateTimeMapping_(r, this.syncController_.timelines[r.timeline], this.playlist_),
r.timingInfo = r.cues.length ? {
start: r.cues[0].startTime,
end: r.cues[r.cues.length - 1].endTime
} : {
start: r.startOfSegment,
end: r.startOfSegment + r.duration
},
r.isSyncRequest ? (this.trigger("syncinfoupdate"),
this.pendingSegment_ = null,
void (this.state = "READY")) : (r.byteLength = r.bytes.byteLength,
this.mediaSecondsLoaded += a.duration,
r.cues.forEach(function(e) {
n.remove(e.startTime, e.endTime),
n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_ ? new dr["default"].VTTCue(e.startTime,e.endTime,e.text) : e)
}),
void this.handleAppendsDone_())
}
,
i.handleData_ = function() {}
,
i.updateTimingInfoEnd_ = function() {}
,
i.parseVTTCues_ = function(e) {
var t, i = !1;
"function" == typeof dr["default"].TextDecoder ? t = new dr["default"].TextDecoder("utf8") : (t = dr["default"].WebVTT.StringDecoder(),
i = !0);
var n = new dr["default"].WebVTT.Parser(dr["default"],dr["default"].vttjs,t);
if (e.cues = [],
e.timestampmap = {
MPEGTS: 0,
LOCAL: 0
},
n.oncue = e.cues.push.bind(e.cues),
n.ontimestampmap = function(t) {
e.timestampmap = t
}
,
n.onparsingerror = function(e) {
pn.log.warn("Error encountered when parsing cues: " + e.message)
}
,
e.segment.map) {
var r = e.segment.map.bytes;
i && (r = bg(r)),
n.parse(r)
}
var a = e.bytes;
i && (a = bg(a)),
n.parse(a),
n.flush()
}
,
i.updateTimeMapping_ = 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 / Wo - 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
}(ug), Cg = 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
}, Eg = function(e, t, i) {
if (void 0 === i && (i = 0),
e.segments)
for (var n, r = i, a = 0; a < e.segments.length; a++) {
var s = e.segments[a];
if (n || (n = Cg(t, r + s.duration / 2)),
n) {
if ("cueIn"in s) {
n.endTime = r,
n.adEndTime = r,
r += s.duration,
n = null;
continue
}
if (r < n.endTime) {
r += s.duration;
continue
}
n.endTime += s.duration
} else if ("cueOut"in s && (n = new dr["default"].VTTCue(r,r + s.duration,s.cueOut),
n.adStartTime = r,
n.adEndTime = r + parseFloat(s.cueOut),
t.addCue(n)),
"cueOutCont"in s) {
var o = s.cueOutCont.split("/").map(parseFloat)
, u = o[0]
, l = o[1];
n = new dr["default"].VTTCue(r,r + s.duration,""),
n.adStartTime = r - u,
n.adEndTime = n.adStartTime + l,
t.addCue(n)
}
r += s.duration
}
}, kg = [{
name: "VOD",
run: function(e, t, i) {
if (1 / 0 !== i) {
var n = {
time: 0,
segmentIndex: 0
};
return n
}
return null
}
}, {
name: "ProgramDateTime",
run: function(e, t, i, n, r) {
if (!e.datetimeToDisplayTime)
return null;
var a = t.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
, d = c + e.datetimeToDisplayTime
, h = Math.abs(r - d);
if (null !== o && (0 === h || h > o))
break;
o = h,
s = {
time: d,
segmentIndex: u
}
}
}
return s
}
}, {
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 l = a[u];
if (l.timeline === n && "undefined" != typeof l.start) {
var c = Math.abs(r - l.start);
if (null !== o && c > o)
break;
(!s || null === o || o >= c) && (o = c,
s = {
time: l.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]
, l = t.discontinuitySequence + o + 1
, c = e.discontinuities[l];
if (c) {
var d = Math.abs(r - c.time);
if (null !== s && d > s)
break;
(!a || null === s || s >= d) && (s = d,
a = {
time: c.time,
segmentIndex: u
})
}
}
return a
}
}, {
name: "Playlist",
run: function(e, t) {
if (t.syncInfo) {
var i = {
time: t.syncInfo.time,
segmentIndex: t.syncInfo.mediaSequence - t.mediaSequence
};
return i
}
return null
}
}], wg = function(e) {
function t() {
var t;
return t = e.call(this) || this,
t.timelines = [],
t.discontinuities = [],
t.datetimeToDisplayTime = null,
t.logger_ = Om("SyncController"),
t
}
gr(t, e);
var i = t.prototype;
return i.getSyncPoint = function(e, t, i, n) {
var r = this.runStrategies_(e, t, i, n);
return r.length ? this.selectSyncPoint_(r, {
key: "time",
value: n
}) : null
}
,
i.getExpiredTime = 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 + Hf(e, n.segmentIndex, 0))
}
,
i.runStrategies_ = function(e, t, i, n) {
for (var r = [], a = 0; a < kg.length; a++) {
var s = kg[a]
, o = s.run(this, e, t, i, n);
o && (o.strategy = s.name,
r.push({
strategy: s.name,
syncPoint: o
}))
}
return r
}
,
i.selectSyncPoint_ = 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);
n > s && (n = s,
i = e[a].syncPoint,
r = e[a].strategy)
}
return this.logger_("syncPoint for [" + t.key + ": " + t.value + "] chosen with strategy" + (" [" + r + "]: [time:" + i.time + ",") + (" segmentIndex:" + i.segmentIndex + "]")),
i
}
,
i.saveExpiredSegmentInfo = 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 refresh sync: [time:" + t.syncInfo.time + "," + (" mediaSequence: " + t.syncInfo.mediaSequence + "]")),
this.trigger("syncinfoupdate");
break
}
}
}
,
i.setDateTimeMapping = function(e) {
if (!this.datetimeToDisplayTime && e.segments && e.segments.length && e.segments[0].dateTimeObject) {
var t = e.segments[0].dateTimeObject.getTime() / 1e3;
this.datetimeToDisplayTime = -t
}
}
,
i.saveSegmentTimingInfo = function(e) {
var t = e.segmentInfo
, i = e.shouldSaveTimelineMapping
, n = this.calculateSegmentTimeMapping_(t, t.timingInfo, i);
n && (this.saveDiscontinuitySyncInfo_(t),
t.playlist.syncInfo || (t.playlist.syncInfo = {
mediaSequence: t.playlist.mediaSequence + t.mediaIndex,
time: t.segment.start
}))
}
,
i.timestampOffsetForTimeline = function(e) {
return "undefined" == typeof this.timelines[e] ? null : this.timelines[e].time
}
,
i.mappingForTimeline = function(e) {
return "undefined" == typeof this.timelines[e] ? null : this.timelines[e].mapping
}
,
i.calculateSegmentTimeMapping_ = function(e, t, i) {
var n = e.segment
, r = this.timelines[e.timeline];
if (null !== e.timestampOffset)
r = {
time: e.startOfSegment,
mapping: e.startOfSegment - t.start
},
i && (this.timelines[e.timeline] = r,
this.trigger("timestampoffset"),
this.logger_("time mapping for timeline " + e.timeline + ": " + ("[time: " + r.time + "] [mapping: " + r.mapping + "]"))),
n.start = e.startOfSegment,
n.end = t.end + r.mapping;
else {
if (!r)
return !1;
n.start = t.start + r.mapping,
n.end = t.end + r.mapping
}
return !0
}
,
i.saveDiscontinuitySyncInfo_ = 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 && 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 = void 0;
u = 0 > s ? i.start - Hf(t, e.mediaIndex, r) : i.end + Hf(t, e.mediaIndex + 1, r),
this.discontinuities[a] = {
time: u,
accuracy: o
}
}
}
}
,
i.dispose = function() {
this.trigger("dispose"),
this.off()
}
,
t
}(pn.EventTarget), Ig = function(e) {
function t() {
var t;
return t = e.call(this) || this,
t.pendingTimelineChanges_ = {},
t.lastTimelineChanges_ = {},
t
}
gr(t, e);
var i = t.prototype;
return i.clearPendingTimelineChange = function(e) {
this.pendingTimelineChanges_[e] = null,
this.trigger("pendingtimelinechange")
}
,
i.pendingTimelineChange = function(e) {
var t = e.type
, i = e.from
, n = e.to;
return "number" == typeof i && "number" == typeof n && (this.pendingTimelineChanges_[t] = {
type: t,
from: i,
to: n
},
this.trigger("pendingtimelinechange")),
this.pendingTimelineChanges_[t]
}
,
i.lastTimelineChange = function(e) {
var t = e.type
, i = e.from
, n = e.to;
return "number" == typeof i && "number" == typeof n && (this.lastTimelineChanges_[t] = {
type: t,
from: i,
to: n
},
delete this.pendingTimelineChanges_[t],
this.trigger("timelinechange")),
this.lastTimelineChanges_[t]
}
,
i.dispose = function() {
this.trigger("dispose"),
this.pendingTimelineChanges_ = {},
this.lastTimelineChanges_ = {},
this.off()
}
,
t
}(pn.EventTarget), Ag = new mn("./decrypter-worker.worker.js",function() {
var e = this;
!function() {
function t(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)
}
}
function i(e, i, n) {
return i && t(e.prototype, i),
n && t(e, n),
e
}
function n(e, t) {
e.prototype = Object.create(t.prototype),
e.prototype.constructor = e,
e.__proto__ = t
}
function r(e) {
return e.subarray(0, e.byteLength - e[e.byteLength - 1])
}
var a = i
, s = n
, o = function() {
function e() {
this.listeners = {}
}
var t = e.prototype;
return t.on = function(e, t) {
this.listeners[e] || (this.listeners[e] = []),
this.listeners[e].push(t)
}
,
t.off = function(e, t) {
if (!this.listeners[e])
return !1;
var i = this.listeners[e].indexOf(t);
return this.listeners[e] = this.listeners[e].slice(0),
this.listeners[e].splice(i, 1),
i > -1
}
,
t.trigger = function(e) {
var t = this.listeners[e];
if (t)
if (2 === arguments.length)
for (var i = t.length, n = 0; i > n; ++n)
t[n].call(this, arguments[1]);
else
for (var r = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; a > s; ++s)
t[s].apply(this, r)
}
,
t.dispose = function() {
this.listeners = {}
}
,
t.pipe = function(e) {
this.on("data", function(t) {
e.push(t)
})
}
,
e
}()
, u = o
, l = function() {
var e, t, i, n, r, a, s, o, u, l = [[[], [], [], [], []], [[], [], [], [], []]], c = l[0], d = l[1], h = c[4], f = d[4], p = [], m = [];
for (e = 0; 256 > e; e++)
m[(p[e] = e << 1 ^ 283 * (e >> 7)) ^ e] = e;
for (t = i = 0; !h[t]; t ^= n || 1,
i = m[i] || 1)
for (s = i ^ i << 1 ^ i << 2 ^ i << 3 ^ i << 4,
s = s >> 8 ^ 255 & s ^ 99,
h[t] = s,
f[s] = t,
a = p[r = p[n = p[t]]],
u = 16843009 * a ^ 65537 * r ^ 257 * n ^ 16843008 * t,
o = 257 * p[s] ^ 16843008 * s,
e = 0; 4 > e; e++)
c[e][t] = o = o << 24 ^ o >>> 8,
d[e][s] = u = u << 24 ^ u >>> 8;
for (e = 0; 5 > e; e++)
c[e] = c[e].slice(0),
d[e] = d[e].slice(0);
return l
}
, c = null
, d = function() {
function e(e) {
c || (c = l()),
this._tables = [[c[0][0].slice(), c[0][1].slice(), c[0][2].slice(), c[0][3].slice(), c[0][4].slice()], [c[1][0].slice(), c[1][1].slice(), c[1][2].slice(), c[1][3].slice(), c[1][4].slice()]];
var t, i, n, r = this._tables[0][4], a = this._tables[1], s = e.length, o = 1;
if (4 !== s && 6 !== s && 8 !== s)
throw new Error("Invalid aes key size");
var u = e.slice(0)
, d = [];
for (this._key = [u, d],
t = s; 4 * s + 28 > t; t++)
n = u[t - 1],
(t % s === 0 || 8 === s && t % s === 4) && (n = r[n >>> 24] << 24 ^ r[n >> 16 & 255] << 16 ^ r[n >> 8 & 255] << 8 ^ r[255 & n],
t % s === 0 && (n = n << 8 ^ n >>> 24 ^ o << 24,
o = o << 1 ^ 283 * (o >> 7))),
u[t] = u[t - s] ^ n;
for (i = 0; t; i++,
t--)
n = u[3 & i ? t : t - 4],
d[i] = 4 >= t || 4 > i ? n : a[0][r[n >>> 24]] ^ a[1][r[n >> 16 & 255]] ^ a[2][r[n >> 8 & 255]] ^ a[3][r[255 & n]]
}
var t = e.prototype;
return t.decrypt = function(e, t, i, n, r, a) {
var s, o, u, l, c = this._key[1], d = e ^ c[0], h = n ^ c[1], f = i ^ c[2], p = t ^ c[3], m = c.length / 4 - 2, g = 4, v = this._tables[1], y = v[0], _ = v[1], b = v[2], T = v[3], S = v[4];
for (l = 0; m > l; l++)
s = y[d >>> 24] ^ _[h >> 16 & 255] ^ b[f >> 8 & 255] ^ T[255 & p] ^ c[g],
o = y[h >>> 24] ^ _[f >> 16 & 255] ^ b[p >> 8 & 255] ^ T[255 & d] ^ c[g + 1],
u = y[f >>> 24] ^ _[p >> 16 & 255] ^ b[d >> 8 & 255] ^ T[255 & h] ^ c[g + 2],
p = y[p >>> 24] ^ _[d >> 16 & 255] ^ b[h >> 8 & 255] ^ T[255 & f] ^ c[g + 3],
g += 4,
d = s,
h = o,
f = u;
for (l = 0; 4 > l; l++)
r[(3 & -l) + a] = S[d >>> 24] << 24 ^ S[h >> 16 & 255] << 16 ^ S[f >> 8 & 255] << 8 ^ S[255 & p] ^ c[g++],
s = d,
d = h,
h = f,
f = p,
p = s
}
,
e
}()
, h = function(e) {
function t() {
var t;
return t = e.call(this, u) || this,
t.jobs = [],
t.delay = 1,
t.timeout_ = null,
t
}
s(t, e);
var i = t.prototype;
return i.processJob_ = function() {
this.jobs.shift()(),
this.timeout_ = this.jobs.length ? setTimeout(this.processJob_.bind(this), this.delay) : null
}
,
i.push = function(e) {
this.jobs.push(e),
this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay))
}
,
t
}(u)
, f = function(e) {
return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
}
, p = function(e, t, i) {
var n, r, a, s, o, u, l, c, h, p = new Int32Array(e.buffer,e.byteOffset,e.byteLength >> 2), m = new d(Array.prototype.slice.call(t)), g = new Uint8Array(e.byteLength), v = new Int32Array(g.buffer);
for (n = i[0],
r = i[1],
a = i[2],
s = i[3],
h = 0; h < p.length; h += 4)
o = f(p[h]),
u = f(p[h + 1]),
l = f(p[h + 2]),
c = f(p[h + 3]),
m.decrypt(o, u, l, c, v, h),
v[h] = f(v[h] ^ n),
v[h + 1] = f(v[h + 1] ^ r),
v[h + 2] = f(v[h + 2] ^ a),
v[h + 3] = f(v[h + 3] ^ s),
n = o,
r = u,
a = l,
s = c;
return g
}
, m = function() {
function e(t, i, n, a) {
var s = e.STEP
, o = new Int32Array(t.buffer)
, u = new Uint8Array(t.byteLength)
, l = 0;
for (this.asyncStream_ = new h,
this.asyncStream_.push(this.decryptChunk_(o.subarray(l, l + s), i, n, u)),
l = s; l < o.length; l += s)
n = new Uint32Array([f(o[l - 4]), f(o[l - 3]), f(o[l - 2]), f(o[l - 1])]),
this.asyncStream_.push(this.decryptChunk_(o.subarray(l, l + s), i, n, u));
this.asyncStream_.push(function() {
a(null, r(u))
})
}
var t = e.prototype;
return t.decryptChunk_ = function(e, t, i, n) {
return function() {
var r = p(e, t, i);
n.set(r, e.byteOffset)
}
}
,
a(e, null, [{
key: "STEP",
get: function() {
return 32e3
}
}]),
e
}()
, g = function(e) {
var t = {};
return Object.keys(e).forEach(function(i) {
var n = e[i];
t[i] = ArrayBuffer.isView(n) ? {
bytes: n.buffer,
byteOffset: n.byteOffset,
byteLength: n.byteLength
} : n
}),
t
}
, v = function(e) {
e.onmessage = function(t) {
var i = t.data
, n = new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength)
, r = new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength / 4)
, a = new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength / 4);
new m(n,r,a,function(t, n) {
e.postMessage(g({
source: i.source,
decrypted: n
}), [n.buffer])
}
)
}
}
, y = new v(e);
return y
}()
}
), xg = function(e) {
var t = e["default"] ? "main" : "alternative";
return e.characteristics && e.characteristics.indexOf("public.accessibility.describes-video") >= 0 && (t = "main-desc"),
t
}, Pg = function(e, t) {
e.abort(),
e.pause(),
t && t.activePlaylistLoader && (t.activePlaylistLoader.pause(),
t.activePlaylistLoader = null)
}, Lg = function(e, t) {
t.activePlaylistLoader = e,
e.load()
}, Dg = function(e, t) {
return function() {
var i = t.segmentLoaders
, n = i[e]
, r = i.main
, a = t.mediaTypes[e]
, s = a.activeTrack()
, o = a.activeGroup(s)
, u = a.activePlaylistLoader;
if (Pg(n, a),
o) {
if (!o.playlistLoader)
return void (u && r.resetEverything());
n.resyncLoader(),
Lg(o.playlistLoader, a)
}
}
}, Og = function(e, t) {
return function() {
var i = t.segmentLoaders[e];
i.abort(),
i.pause()
}
}, Ng = function(e, t) {
return function() {
var i = t.segmentLoaders
, n = i[e]
, r = i.main
, a = t.mediaTypes[e]
, s = a.activeTrack()
, o = a.activeGroup(s)
, u = a.activePlaylistLoader;
if (Pg(n, a),
o) {
if ("AUDIO" === e) {
if (!o.playlistLoader)
return r.setAudio(!0),
void r.resetEverything();
n.setAudio(!0),
r.setAudio(!1)
}
if (u === o.playlistLoader)
return void Lg(o.playlistLoader, a);
n.track && n.track(s),
n.resetEverything(),
Lg(o.playlistLoader, a)
}
}
}, Mg = {
AUDIO: function(e, t) {
return function() {
var i = t.segmentLoaders[e]
, n = t.mediaTypes[e]
, r = t.blacklistCurrentPlaylist;
Pg(i, n);
var a = n.activeTrack()
, s = n.activeGroup()
, o = (s.filter(function(e) {
return e["default"]
})[0] || s[0]).id
, u = n.tracks[o];
if (a === u)
return void r({
message: "Problem encountered loading the default audio track."
});
pn.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
for (var l in n.tracks)
n.tracks[l].enabled = n.tracks[l] === u;
n.onTrackChanged()
}
},
SUBTITLES: function(e, t) {
return function() {
var i = t.segmentLoaders[e]
, n = t.mediaTypes[e];
pn.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),
Pg(i, n);
var r = n.activeTrack();
r && (r.mode = "disabled"),
n.onTrackChanged()
}
}
}, Rg = {
AUDIO: function(e, t, i) {
if (t) {
var n = i.tech
, r = i.requestOptions
, a = i.segmentLoaders[e];
t.on("loadedmetadata", function() {
var e = t.media();
a.playlist(e, r),
(!n.paused() || e.endList && "none" !== n.preload()) && a.load()
}),
t.on("loadedplaylist", function() {
a.playlist(t.media(), r),
n.paused() || a.load()
}),
t.on("error", Mg[e](e, i))
}
},
SUBTITLES: function(e, t, i) {
var n = i.tech
, r = i.requestOptions
, a = i.segmentLoaders[e]
, s = i.mediaTypes[e];
t.on("loadedmetadata", function() {
var e = t.media();
a.playlist(e, r),
a.track(s.activeTrack()),
(!n.paused() || e.endList && "none" !== n.preload()) && a.load()
}),
t.on("loadedplaylist", function() {
a.playlist(t.media(), r),
n.paused() || a.load()
}),
t.on("error", Mg[e](e, i))
}
}, Ug = {
AUDIO: function(e, t) {
var i = t.vhs
, n = t.sourceType
, r = t.segmentLoaders[e]
, a = t.requestOptions
, s = t.master
, o = s.mediaGroups
, u = s.playlists
, l = t.mediaTypes[e]
, c = l.groups
, d = l.tracks
, h = t.masterPlaylistLoader;
o[e] && 0 !== Object.keys(o[e]).length || (o[e] = {
main: {
"default": {
"default": !0
}
}
});
var f = function(r) {
c[r] || (c[r] = []);
var s = u.filter(function(t) {
return t.attributes[e] === r
})
, l = function(u) {
var l = o[e][r][u]
, f = s.filter(function(e) {
return e.resolvedUri === l.resolvedUri
});
f.length && delete l.resolvedUri;
var p = void 0;
if (p = "vhs-json" === n && l.playlists ? new wf(l.playlists[0],i,a) : l.resolvedUri ? new wf(l.resolvedUri,i,a) : l.playlists && "dash" === n ? new Bp(l.playlists[0],i,a,h) : null,
l = pn.mergeOptions({
id: u,
playlistLoader: p
}, l),
Rg[e](e, l.playlistLoader, t),
c[r].push(l),
"undefined" == typeof d[u]) {
var m = new pn.AudioTrack({
id: u,
kind: xg(l),
enabled: !1,
language: l.language,
"default": l["default"],
label: u
});
d[u] = m
}
};
for (var f in o[e][r])
l(f)
};
for (var p in o[e])
f(p);
r.on("error", Mg[e](e, t))
},
SUBTITLES: function(e, t) {
var i = t.tech
, n = t.vhs
, r = t.sourceType
, a = t.segmentLoaders[e]
, s = t.requestOptions
, o = t.master.mediaGroups
, u = t.mediaTypes[e]
, l = u.groups
, c = u.tracks
, d = t.masterPlaylistLoader;
for (var h in o[e]) {
l[h] || (l[h] = []);
for (var f in o[e][h])
if (!o[e][h][f].forced) {
var p = o[e][h][f]
, m = void 0;
if ("hls" === r ? m = new wf(p.resolvedUri,n,s) : "dash" === r ? m = new Bp(p.playlists[0],n,s,d) : "vhs-json" === r && (m = new wf(p.playlists ? p.playlists[0] : p.resolvedUri,n,s)),
p = pn.mergeOptions({
id: f,
playlistLoader: m
}, p),
Rg[e](e, p.playlistLoader, t),
l[h].push(p),
"undefined" == typeof c[f]) {
var g = i.addRemoteTextTrack({
id: f,
kind: "subtitles",
"default": p["default"] && p.autoselect,
language: p.language,
label: f
}, !1).track;
c[f] = g
}
}
}
a.on("error", Mg[e](e, t))
},
"CLOSED-CAPTIONS": function(e, t) {
var i = t.tech
, n = t.master.mediaGroups
, r = t.mediaTypes[e]
, a = r.groups
, s = r.tracks;
for (var o in n[e]) {
a[o] || (a[o] = []);
for (var u in n[e][o]) {
var l = n[e][o][u];
if (l.instreamId.match(/CC\d/) && (a[o].push(pn.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
}
}
}
}
}, Fg = function(e, t) {
return function(i) {
var n = t.masterPlaylistLoader
, r = t.mediaTypes[e].groups
, a = n.media();
if (!a)
return null;
var s = null;
return a.attributes[e] && (s = r[a.attributes[e]]),
s = s || r.main,
"undefined" == typeof i ? s : null === i ? null : s.filter(function(e) {
return e.id === i.id
})[0] || null
}
}, Bg = {
AUDIO: function(e, t) {
return function() {
var i = t.mediaTypes[e].tracks;
for (var n in i)
if (i[n].enabled)
return i[n];
return null
}
},
SUBTITLES: function(e, t) {
return function() {
var i = t.mediaTypes[e].tracks;
for (var n in i)
if ("showing" === i[n].mode || "hidden" === i[n].mode)
return i[n];
return null
}
}
}, jg = function(e) {
["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) {
Ug[t](t, e)
});
var t = e.mediaTypes
, i = e.masterPlaylistLoader
, n = e.tech
, r = e.vhs;
["AUDIO", "SUBTITLES"].forEach(function(i) {
t[i].activeGroup = Fg(i, e),
t[i].activeTrack = Bg[i](i, e),
t[i].onGroupChanged = Dg(i, e),
t[i].onGroupChanging = Og(i, e),
t[i].onTrackChanged = Ng(i, e)
});
var a = t.AUDIO.activeGroup();
if (a) {
var s = (a.filter(function(e) {
return e["default"]
})[0] || a[0]).id;
t.AUDIO.tracks[s].enabled = !0,
t.AUDIO.onTrackChanged()
}
i.on("mediachange", function() {
["AUDIO", "SUBTITLES"].forEach(function(e) {
return t[e].onGroupChanged()
})
}),
i.on("mediachanging", function() {
["AUDIO", "SUBTITLES"].forEach(function(e) {
return t[e].onGroupChanging()
})
});
var o = function() {
t.AUDIO.onTrackChanged(),
n.trigger({
type: "usage",
name: "vhs-audio-change"
}),
n.trigger({
type: "usage",
name: "hls-audio-change"
})
};
n.audioTracks().addEventListener("change", o),
n.remoteTextTracks().addEventListener("change", t.SUBTITLES.onTrackChanged),
r.on("dispose", function() {
n.audioTracks().removeEventListener("change", o),
n.remoteTextTracks().removeEventListener("change", t.SUBTITLES.onTrackChanged)
}),
n.clearTracks("audio");
for (var u in t.AUDIO.tracks)
n.audioTracks().addTrack(t.AUDIO.tracks[u])
}, Vg = function() {
var e = {};
return ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) {
e[t] = {
groups: {},
tracks: {},
activePlaylistLoader: null,
activeGroup: yn,
activeTrack: yn,
onGroupChanged: yn,
onTrackChanged: yn
}
}),
e
}, qg = 120, Hg = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred"], Wg = function(e) {
return this.audioSegmentLoader_[e] + this.mainSegmentLoader_[e]
}, zg = function(e) {
var t = e.currentPlaylist
, i = e.nextPlaylist
, n = e.forwardBuffer
, r = e.bufferLowWaterLine
, a = e.duration;
return e.log,
i ? t.endList ? a < jp.MAX_BUFFER_LOW_WATER_LINE ? !0 : i.attributes.BANDWIDTH < t.attributes.BANDWIDTH ? !0 : n >= r ? !0 : !1 : !0 : (pn.log.warn("We received no playlist to switch to. Please check your stream."),
!1)
}, Gg = function(e) {
function t(t) {
var i;
i = e.call(this) || this;
var n = t.src
, r = t.handleManifestRedirects
, a = t.withCredentials
, s = t.tech
, o = t.bandwidth
, u = t.externVhs
, l = t.useCueTags
, c = t.blacklistDuration
, d = t.enableLowInitialPlaylist
, h = t.sourceType
, f = t.cacheEncryptionKeys
, p = t.handlePartialData;
if (!n)
throw new Error("A non-empty playlist URL or JSON manifest string is required");
Im = u,
i.withCredentials = a,
i.tech_ = s,
i.vhs_ = s.vhs,
i.sourceType_ = h,
i.useCueTags_ = l,
i.blacklistDuration = c,
i.enableLowInitialPlaylist = d,
i.useCueTags_ && (i.cueTagsTrack_ = i.tech_.addTextTrack("metadata", "ad-cues"),
i.cueTagsTrack_.inBandMetadataTrackDispatchType = ""),
i.requestOptions_ = {
withCredentials: a,
handleManifestRedirects: r,
timeout: null
},
i.on("error", i.pauseLoading),
i.mediaTypes_ = Vg(),
i.mediaSource = new dr["default"].MediaSource,
i.handleDurationChange_ = i.handleDurationChange_.bind(mr(i)),
i.handleSourceOpen_ = i.handleSourceOpen_.bind(mr(i)),
i.handleSourceEnded_ = i.handleSourceEnded_.bind(mr(i)),
i.mediaSource.addEventListener("durationchange", i.handleDurationChange_),
i.mediaSource.addEventListener("sourceopen", i.handleSourceOpen_),
i.mediaSource.addEventListener("sourceended", i.handleSourceEnded_),
i.seekable_ = pn.createTimeRanges(),
i.hasPlayed_ = !1,
i.syncController_ = new wg(t),
i.segmentMetadataTrack_ = s.addRemoteTextTrack({
kind: "metadata",
label: "segment-metadata"
}, !1).track,
i.decrypter_ = new Ag,
i.sourceUpdater_ = new _g(i.mediaSource),
i.inbandTextTracks_ = {},
i.timelineChangeController_ = new Ig;
var m = {
vhs: i.vhs_,
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.duration()
},
hasPlayed: function() {
return i.hasPlayed_
},
goalBufferLength: function() {
return i.goalBufferLength()
},
bandwidth: o,
syncController: i.syncController_,
decrypter: i.decrypter_,
sourceType: i.sourceType_,
inbandTextTracks: i.inbandTextTracks_,
cacheEncryptionKeys: f,
handlePartialData: p,
sourceUpdater: i.sourceUpdater_,
timelineChangeController: i.timelineChangeController_
};
return i.masterPlaylistLoader_ = "dash" === i.sourceType_ ? new Bp(n,i.vhs_,i.requestOptions_) : new wf(n,i.vhs_,i.requestOptions_),
i.setupMasterPlaylistLoaderListeners_(),
i.mainSegmentLoader_ = new ug(pn.mergeOptions(m, {
segmentMetadataTrack: i.segmentMetadataTrack_,
loaderType: "main"
}),t),
i.audioSegmentLoader_ = new ug(pn.mergeOptions(m, {
loaderType: "audio"
}),t),
i.subtitleSegmentLoader_ = new Sg(pn.mergeOptions(m, {
loaderType: "vtt",
featuresNativeTextTracks: i.tech_.featuresNativeTextTracks
}),t),
i.setupSegmentLoaderListeners_(),
Hg.forEach(function(e) {
i[e + "_"] = Wg.bind(mr(i), e)
}),
i.logger_ = Om("MPC"),
i.triggeredFmp4Usage = !1,
i.masterPlaylistLoader_.load(),
i
}
gr(t, e);
var i = t.prototype;
return i.setupMasterPlaylistLoaderListeners_ = function() {
var e = this;
this.masterPlaylistLoader_.on("loadedmetadata", function() {
var t = e.masterPlaylistLoader_.media()
, i = 1.5 * t.targetDuration * 1e3;
e.requestOptions_.timeout = tp(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? 0 : i,
t.endList && "none" !== e.tech_.preload() && (e.mainSegmentLoader_.playlist(t, e.requestOptions_),
e.mainSegmentLoader_.load()),
jg({
sourceType: e.sourceType_,
segmentLoaders: {
AUDIO: e.audioSegmentLoader_,
SUBTITLES: e.subtitleSegmentLoader_,
main: e.mainSegmentLoader_
},
tech: e.tech_,
requestOptions: e.requestOptions_,
masterPlaylistLoader: e.masterPlaylistLoader_,
vhs: e.vhs_,
master: e.master(),
mediaTypes: e.mediaTypes_,
blacklistCurrentPlaylist: e.blacklistCurrentPlaylist.bind(e)
}),
e.triggerPresenceUsage_(e.master(), t),
e.setupFirstPlay(),
!e.mediaTypes_.AUDIO.activePlaylistLoader || e.mediaTypes_.AUDIO.activePlaylistLoader.media() ? e.trigger("selectedinitialmedia") : e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", function() {
e.trigger("selectedinitialmedia")
})
}),
this.masterPlaylistLoader_.on("loadedplaylist", function() {
var t = e.masterPlaylistLoader_.media();
if (!t) {
e.excludeUnsupportedVariants_();
var i;
e.enableLowInitialPlaylist && (i = e.selectInitialPlaylist()),
i || (i = e.selectPlaylist()),
e.initialMedia_ = i,
e.masterPlaylistLoader_.media(e.initialMedia_);
var n = "vhs-json" === e.sourceType_ && e.initialMedia_.segments;
if (!n)
return;
t = e.initialMedia_
}
e.handleUpdatedMediaPlaylist(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 * t.targetDuration * 1e3;
e.requestOptions_.timeout = tp(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? 0 : i,
e.mainSegmentLoader_.playlist(t, e.requestOptions_),
e.mainSegmentLoader_.load(),
e.tech_.trigger({
type: "mediachange",
bubbles: !0
})
}),
this.masterPlaylistLoader_.on("playlistunchanged", function() {
var t = e.masterPlaylistLoader_.media()
, i = e.stuckAtPlaylistEnd_(t);
i && (e.blacklistCurrentPlaylist({
message: "Playlist no longer updating."
}),
e.tech_.trigger("playliststuck"))
}),
this.masterPlaylistLoader_.on("renditiondisabled", function() {
e.tech_.trigger({
type: "usage",
name: "vhs-rendition-disabled"
}),
e.tech_.trigger({
type: "usage",
name: "hls-rendition-disabled"
})
}),
this.masterPlaylistLoader_.on("renditionenabled", function() {
e.tech_.trigger({
type: "usage",
name: "vhs-rendition-enabled"
}),
e.tech_.trigger({
type: "usage",
name: "hls-rendition-enabled"
})
})
}
,
i.handleUpdatedMediaPlaylist = function(e) {
this.useCueTags_ && this.updateAdCues_(e),
this.mainSegmentLoader_.playlist(e, this.requestOptions_),
this.updateDuration(!e.endList),
this.tech_.paused() || (this.mainSegmentLoader_.load(),
this.audioSegmentLoader_ && this.audioSegmentLoader_.load())
}
,
i.triggerPresenceUsage_ = 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: "vhs-demuxed"
}),
this.tech_.trigger({
type: "usage",
name: "hls-demuxed"
})),
Object.keys(i.SUBTITLES).length && (this.tech_.trigger({
type: "usage",
name: "vhs-webvtt"
}),
this.tech_.trigger({
type: "usage",
name: "hls-webvtt"
})),
Im.Playlist.isAes(t) && (this.tech_.trigger({
type: "usage",
name: "vhs-aes"
}),
this.tech_.trigger({
type: "usage",
name: "hls-aes"
})),
r.length && Object.keys(i.AUDIO[r[0]]).length > 1 && (this.tech_.trigger({
type: "usage",
name: "vhs-alternate-audio"
}),
this.tech_.trigger({
type: "usage",
name: "hls-alternate-audio"
})),
this.useCueTags_ && (this.tech_.trigger({
type: "usage",
name: "vhs-playlist-cue-tags"
}),
this.tech_.trigger({
type: "usage",
name: "hls-playlist-cue-tags"
}))
}
,
i.setupSegmentLoaderListeners_ = 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();
zg({
currentPlaylist: i,
nextPlaylist: t,
forwardBuffer: r,
bufferLowWaterLine: a,
duration: e.duration(),
log: e.logger_
}) && 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("appenderror", function() {
e.error = e.mainSegmentLoader_.error_,
e.trigger("error")
}),
this.mainSegmentLoader_.on("syncinfoupdate", function() {
e.onSyncInfoUpdate_()
}),
this.mainSegmentLoader_.on("timestampoffset", function() {
e.tech_.trigger({
type: "usage",
name: "vhs-timestamp-offset"
}),
e.tech_.trigger({
type: "usage",
name: "hls-timestamp-offset"
})
}),
this.audioSegmentLoader_.on("syncinfoupdate", function() {
e.onSyncInfoUpdate_()
}),
this.audioSegmentLoader_.on("appenderror", function() {
e.error = e.audioSegmentLoader_.error_,
e.trigger("error")
}),
this.mainSegmentLoader_.on("ended", function() {
e.logger_("main segment loader ended"),
e.onEndOfStream()
}),
this.mainSegmentLoader_.on("earlyabort", function() {
e.blacklistCurrentPlaylist({
message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
}, qg)
});
var t = function() {
if (!e.sourceUpdater_.ready())
return e.tryToCreateSourceBuffers_();
var t = e.getCodecsOrExclude_();
t && e.sourceUpdater_.addOrChangeSourceBuffers(t)
};
this.mainSegmentLoader_.on("trackinfo", t),
this.audioSegmentLoader_.on("trackinfo", t),
this.mainSegmentLoader_.on("fmp4", function() {
e.triggeredFmp4Usage || (e.tech_.trigger({
type: "usage",
name: "vhs-fmp4"
}),
e.tech_.trigger({
type: "usage",
name: "hls-fmp4"
}),
e.triggeredFmp4Usage = !0)
}),
this.audioSegmentLoader_.on("fmp4", function() {
e.triggeredFmp4Usage || (e.tech_.trigger({
type: "usage",
name: "vhs-fmp4"
}),
e.tech_.trigger({
type: "usage",
name: "hls-fmp4"
}),
e.triggeredFmp4Usage = !0)
}),
this.audioSegmentLoader_.on("ended", function() {
e.logger_("audioSegmentLoader ended"),
e.onEndOfStream()
})
}
,
i.mediaSecondsLoaded_ = function() {
return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded)
}
,
i.load = function() {
this.mainSegmentLoader_.load(),
this.mediaTypes_.AUDIO.activePlaylistLoader && this.audioSegmentLoader_.load(),
this.mediaTypes_.SUBTITLES.activePlaylistLoader && this.subtitleSegmentLoader_.load()
}
,
i.smoothQualityChange_ = function(e) {
void 0 === e && (e = this.selectPlaylist()),
e !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(e),
this.mainSegmentLoader_.resetLoader())
}
,
i.fastQualityChange_ = function(e) {
var t = this;
void 0 === e && (e = this.selectPlaylist()),
e !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(e),
this.mainSegmentLoader_.resetEverything(function() {
t.tech_.setCurrentTime(pn.browser.IE_VERSION || pn.browser.IS_EDGE ? t.tech_.currentTime() + .04 : t.tech_.currentTime())
}))
}
,
i.play = function() {
if (!this.setupFirstPlay()) {
this.tech_.ended() && this.tech_.setCurrentTime(0),
this.hasPlayed_ && this.load();
var e = this.tech_.seekable();
return 1 / 0 === this.tech_.duration() && this.tech_.currentTime() < e.start(0) ? this.tech_.setCurrentTime(e.end(e.length - 1)) : void 0
}
}
,
i.setupFirstPlay = function() {
var e = this
, t = this.masterPlaylistLoader_.media();
if (!t || this.tech_.paused() || this.hasPlayed_)
return !1;
if (!t.endList) {
var i = this.seekable();
if (!i.length)
return !1;
if (pn.browser.IE_VERSION && 0 === this.tech_.readyState())
return this.tech_.one("loadedmetadata", function() {
e.trigger("firstplay"),
e.tech_.setCurrentTime(i.end(0)),
e.hasPlayed_ = !0
}),
!1;
this.trigger("firstplay"),
this.tech_.setCurrentTime(i.end(0))
}
return this.hasPlayed_ = !0,
this.load(),
!0
}
,
i.handleSourceOpen_ = function() {
if (this.tryToCreateSourceBuffers_(),
this.tech_.autoplay()) {
var e = this.tech_.play();
"undefined" != typeof e && "function" == typeof e.then && e.then(null, function() {})
}
this.trigger("sourceopen")
}
,
i.handleSourceEnded_ = function() {
if (this.inbandTextTracks_.metadataTrack_) {
var e = this.inbandTextTracks_.metadataTrack_.cues;
if (e && e.length) {
var t = this.duration();
e[e.length - 1].endTime = isNaN(t) || 1 / 0 === Math.abs(t) ? Number.MAX_VALUE : t
}
}
}
,
i.handleDurationChange_ = function() {
this.tech_.trigger("durationchange")
}
,
i.onEndOfStream = function() {
var e = this.mainSegmentLoader_.ended_;
this.mediaTypes_.AUDIO.activePlaylistLoader && (e = !this.mainSegmentLoader_.currentMediaInfo_ || this.mainSegmentLoader_.currentMediaInfo_.hasVideo ? e && this.audioSegmentLoader_.ended_ : this.audioSegmentLoader_.ended_),
e && this.sourceUpdater_.endOfStream()
}
,
i.stuckAtPlaylistEnd_ = function(e) {
var t = this.seekable();
if (!t.length)
return !1;
var i = this.syncController_.getExpiredTime(e, this.duration());
if (null === i)
return !1;
var n = Im.Playlist.playlistEnd(e, i)
, r = this.tech_.currentTime()
, a = this.tech_.buffered();
if (!a.length)
return Af >= n - r;
var s = a.end(a.length - 1);
return Af >= s - r && Af >= n - s
}
,
i.blacklistCurrentPlaylist = function(e, t) {
void 0 === e && (e = {});
var i = e.playlist || this.masterPlaylistLoader_.media();
if (t = t || e.blacklistDuration || this.blacklistDuration,
!i)
return this.error = e,
this.tech_.el_.errorinfo = e,
void ("open" !== this.mediaSource.readyState ? this.trigger("error") : this.sourceUpdater_.endOfStream("network"));
var n = this.masterPlaylistLoader_.master.playlists
, r = n.filter($f)
, a = 1 === r.length && r[0] === i;
if (1 === n.length && 1 / 0 !== t)
return pn.log.warn("Problem encountered with playlist " + i.id + ". Trying again since it is the only playlist."),
this.tech_.trigger("retryplaylist"),
this.masterPlaylistLoader_.load(a);
if (a) {
var s = !1;
n.forEach(function(e) {
if (e !== i) {
var t = e.excludeUntil;
"undefined" != typeof t && 1 / 0 !== t && (s = !0,
delete e.excludeUntil)
}
}),
s && (pn.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),
this.tech_.trigger("retryplaylist"))
}
i.excludeUntil = Date.now() + 1e3 * t,
this.tech_.trigger("blacklistplaylist"),
this.tech_.trigger({
type: "usage",
name: "vhs-rendition-blacklisted"
}),
this.tech_.trigger({
type: "usage",
name: "hls-rendition-blacklisted"
});
var o = this.selectPlaylist();
if (!o)
return this.error = "Playback cannot continue. No available working or supported playlists.",
void this.trigger("error");
var u = e.internal ? this.logger_ : pn.log.warn
, l = e.message ? " " + e.message : "";
return u((e.internal ? "Internal problem" : "Problem") + " encountered with playlist " + i.id + "." + (l + " Switching to playlist " + o.id + ".")),
o.attributes.AUDIO !== i.attributes.AUDIO && this.delegateLoaders_("audio", ["abort", "pause"]),
o.attributes.SUBTITLES !== i.attributes.SUBTITLES && this.delegateLoaders_("subtitle", ["abort", "pause"]),
this.delegateLoaders_("main", ["abort", "pause"]),
this.masterPlaylistLoader_.media(o, a)
}
,
i.pauseLoading = function() {
this.delegateLoaders_("all", ["abort", "pause"])
}
,
i.delegateLoaders_ = function(e, t) {
var i = this
, n = []
, r = "all" === e;
(r || "main" === e) && n.push(this.masterPlaylistLoader_);
var a = [];
(r || "audio" === e) && a.push("AUDIO"),
(r || "subtitle" === e) && (a.push("CLOSED-CAPTIONS"),
a.push("SUBTITLES")),
a.forEach(function(e) {
var t = i.mediaTypes_[e] && i.mediaTypes_[e].activePlaylistLoader;
t && n.push(t)
}),
["main", "audio", "subtitle"].forEach(function(t) {
var r = i[t + "SegmentLoader_"];
!r || e !== t && "all" !== e || n.push(r)
}),
n.forEach(function(e) {
return t.forEach(function(t) {
"function" == typeof e[t] && e[t]()
})
})
}
,
i.setCurrentTime = function(e) {
var t = Pf(this.tech_.buffered(), e);
return this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media() && this.masterPlaylistLoader_.media().segments ? t && t.length ? e : (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
}
,
i.duration = function() {
if (!this.masterPlaylistLoader_)
return 0;
var e = this.masterPlaylistLoader_.media();
return e ? e.endList ? this.mediaSource ? this.mediaSource.duration : Im.Playlist.duration(e) : 1 / 0 : 0
}
,
i.seekable = function() {
return this.seekable_
}
,
i.onSyncInfoUpdate_ = function() {
var e;
if (this.masterPlaylistLoader_) {
var t = this.masterPlaylistLoader_.media();
if (t) {
var i = this.syncController_.getExpiredTime(t, this.duration());
if (null !== i) {
var n = this.masterPlaylistLoader_.master.suggestedPresentationDelay
, r = Im.Playlist.seekable(t, i, n);
if (0 !== r.length) {
if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
if (t = this.mediaTypes_.AUDIO.activePlaylistLoader.media(),
i = this.syncController_.getExpiredTime(t, this.duration()),
null === i)
return;
if (e = Im.Playlist.seekable(t, i, n),
0 === e.length)
return
}
var a, s;
this.seekable_ && this.seekable_.length && (a = this.seekable_.end(0),
s = this.seekable_.start(0)),
this.seekable_ = e ? e.start(0) > r.end(0) || r.start(0) > e.end(0) ? r : pn.createTimeRanges([[e.start(0) > r.start(0) ? e.start(0) : r.start(0), e.end(0) < r.end(0) ? e.end(0) : r.end(0)]]) : r,
this.seekable_ && this.seekable_.length && this.seekable_.end(0) === a && this.seekable_.start(0) === s || (this.logger_("seekable updated [" + Nf(this.seekable_) + "]"),
this.tech_.trigger("seekablechanged"))
}
}
}
}
}
,
i.updateDuration = function(e) {
if (this.updateDuration_ && (this.mediaSource.removeEventListener("sourceopen", this.updateDuration_),
this.updateDuration_ = null),
"open" !== this.mediaSource.readyState)
return this.updateDuration_ = this.updateDuration.bind(this, e),
void this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
if (e) {
var t = this.seekable();
if (!t.length)
return;
return void ((isNaN(this.mediaSource.duration) || this.mediaSource.duration < t.end(t.length - 1)) && this.sourceUpdater_.setDuration(t.end(t.length - 1)))
}
var i = this.tech_.buffered()
, n = Im.Playlist.duration(this.masterPlaylistLoader_.media());
i.length > 0 && (n = Math.max(n, i.end(i.length - 1))),
this.mediaSource.duration !== n && this.sourceUpdater_.setDuration(n)
}
,
i.dispose = function() {
var e = this;
this.trigger("dispose"),
this.decrypter_.terminate(),
this.masterPlaylistLoader_.dispose(),
this.mainSegmentLoader_.dispose(),
["AUDIO", "SUBTITLES"].forEach(function(t) {
var i = e.mediaTypes_[t].groups;
for (var n in i)
i[n].forEach(function(e) {
e.playlistLoader && e.playlistLoader.dispose()
})
}),
this.audioSegmentLoader_.dispose(),
this.subtitleSegmentLoader_.dispose(),
this.sourceUpdater_.dispose(),
this.timelineChangeController_.dispose(),
this.updateDuration_ && this.mediaSource.removeEventListener("sourceopen", this.updateDuration_),
this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_),
this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_),
this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_),
this.off()
}
,
i.master = function() {
return this.masterPlaylistLoader_.master
}
,
i.media = function() {
return this.masterPlaylistLoader_.media() || this.initialMedia_
}
,
i.areMediaTypesKnown_ = function() {
var e = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
return !this.mainSegmentLoader_.currentMediaInfo_ || e && !this.audioSegmentLoader_.currentMediaInfo_ ? !1 : !0
}
,
i.getCodecsOrExclude_ = function() {
var e = this
, t = {
main: this.mainSegmentLoader_.currentMediaInfo_ || {},
audio: this.audioSegmentLoader_.currentMediaInfo_ || {}
};
t.video = t.main;
var i = Dm(this.master(), this.media())
, n = {}
, r = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
if (t.main.hasVideo && (n.video = i.video || t.main.videoCodec || Du),
t.main.isMuxed && (n.video += "," + (i.audio || t.main.audioCodec || Lu)),
(t.main.hasAudio && !t.main.isMuxed || t.audio.hasAudio || r) && (n.audio = i.audio || t.main.audioCodec || t.audio.audioCodec || Lu,
t.audio.isFmp4 = t.main.hasAudio && !t.main.isMuxed ? t.main.isFmp4 : t.audio.isFmp4),
!n.audio && !n.video)
return void this.blacklistCurrentPlaylist({
playlist: this.media(),
message: "Could not determine codecs for playlist.",
blacklistDuration: 1 / 0
});
var a, s = function(e, t) {
return e ? Ou(t) : Fu(t)
}, o = {};
if (["video", "audio"].forEach(function(e) {
if (n.hasOwnProperty(e) && !s(t[e].isFmp4, n[e])) {
var i = t[e].isFmp4 ? "browser" : "muxer";
o[i] = o[i] || [],
o[i].push(n[e]),
"audio" === e && (a = i)
}
}),
r && a && this.media().attributes.AUDIO) {
var u = this.media().attributes.AUDIO;
this.master().playlists.forEach(function(t) {
var i = t.attributes && t.attributes.AUDIO;
i === u && t !== e.media() && (t.excludeUntil = 1 / 0)
}),
this.logger_("excluding audio group " + u + " as " + a + ' does not support codec(s): "' + n.audio + '"')
}
if (Object.keys(o).length) {
var l = Object.keys(o).reduce(function(e, t) {
return e && (e += ", "),
e += t + ' does not support codec(s): "' + o[t].join(",") + '"'
}, "") + ".";
return void this.blacklistCurrentPlaylist({
playlist: this.media(),
internal: !0,
message: l,
blacklistDuration: 1 / 0
})
}
if (this.sourceUpdater_.ready() && !this.sourceUpdater_.canChangeType()) {
var c = [];
if (["video", "audio"].forEach(function(t) {
var i = (Bu(e.sourceUpdater_.codecs[t] || "")[t] || {}).type
, r = (Bu(n[t] || "")[t] || {}).type;
i && r && i.toLowerCase() !== r.toLowerCase() && c.push('"' + e.sourceUpdater_.codecs[t] + '" -> "' + n[t] + '"')
}),
c.length)
return void this.blacklistCurrentPlaylist({
playlist: this.media(),
message: "Codec switching not supported: " + c.join(", ") + ".",
blacklistDuration: 1 / 0,
internal: !0
})
}
return n
}
,
i.tryToCreateSourceBuffers_ = function() {
if ("open" === this.mediaSource.readyState && !this.sourceUpdater_.ready() && this.areMediaTypesKnown_()) {
var e = this.getCodecsOrExclude_();
if (e) {
this.sourceUpdater_.createSourceBuffers(e);
var t = [e.video, e.audio].filter(Boolean).join(",");
this.excludeIncompatibleVariants_(t)
}
}
}
,
i.excludeUnsupportedVariants_ = function() {
var e = this;
this.master().playlists.forEach(function(t) {
var i = Dm(e.master, t);
!i.audio || Fu(i.audio) || Ou(i.audio) || (t.excludeUntil = 1 / 0),
!i.video || Fu(i.video) || Ou(i.video) || (t.excludeUntil = 1 / 0)
})
}
,
i.excludeIncompatibleVariants_ = function(e) {
var t = this
, i = Bu(e)
, n = Object.keys(i).length;
this.master().playlists.forEach(function(e) {
if (1 / 0 !== e.excludeUntil) {
var r = {}
, a = 2
, s = []
, o = Dm(t.masterPlaylistLoader_.master, e);
if (o.audio || o.video) {
var u = [o.video, o.audio].filter(Boolean).join(",");
r = Bu(u),
a = Object.keys(r).length
}
a !== n && (s.push('codec count "' + a + '" !== "' + n + '"'),
e.excludeUntil = 1 / 0),
t.sourceUpdater_.canChangeType() || (r.video && i.video && r.video.type.toLowerCase() !== i.video.type.toLowerCase() && (s.push('video codec "' + r.video.type + '" !== "' + i.video.type + '"'),
e.excludeUntil = 1 / 0),
r.audio && i.audio && r.audio.type.toLowerCase() !== i.audio.type.toLowerCase() && (e.excludeUntil = 1 / 0,
s.push('audio codec "' + r.audio.type + '" !== "' + i.audio.type + '"'))),
s.length && t.logger_("blacklisting " + e.id + ": " + s.join(" && "))
}
})
}
,
i.updateAdCues_ = function(e) {
var t = 0
, i = this.seekable();
i.length && (t = i.start(0)),
Eg(e, this.cueTagsTrack_, t)
}
,
i.goalBufferLength = function() {
var e = this.tech_.currentTime()
, t = jp.GOAL_BUFFER_LENGTH
, i = jp.GOAL_BUFFER_LENGTH_RATE
, n = Math.max(t, jp.MAX_GOAL_BUFFER_LENGTH);
return Math.min(t + e * i, n)
}
,
i.bufferLowWaterLine = function() {
var e = this.tech_.currentTime()
, t = jp.BUFFER_LOW_WATER_LINE
, i = jp.BUFFER_LOW_WATER_LINE_RATE
, n = Math.max(t, jp.MAX_BUFFER_LOW_WATER_LINE);
return Math.min(t + e * i, n)
}
,
t
}(pn.EventTarget), Xg = function(e, t, i) {
return function(n) {
var r = e.master.playlists[t]
, a = Yf(r)
, s = $f(r);
return "undefined" == typeof n ? s : (n ? delete r.disabled : r.disabled = !0,
n === s || a || (i(),
e.trigger(n ? "renditionenabled" : "renditiondisabled")),
n)
}
}, Kg = function(e, t, i) {
var n = e.masterPlaylistController_
, r = e.options_.smoothQualityChange
, a = r ? "smooth" : "fast"
, s = n[a + "QualityChange_"].bind(n);
if (t.attributes.RESOLUTION) {
var o = t.attributes.RESOLUTION;
this.width = o.width,
this.height = o.height
}
this.bandwidth = t.attributes.BANDWIDTH,
this.codecs = Dm(n.master(), t),
this.playlist = t,
this.id = i,
this.enabled = Xg(e.playlists, t.id, s)
}, Yg = function(e) {
var t = e.playlists;
e.representations = function() {
return t && t.master && t.master.playlists ? t.master.playlists.filter(function(e) {
return !Yf(e)
}).map(function(t) {
return new Kg(e,t,t.id)
}) : []
}
}, $g = ["seeking", "seeked", "pause", "playing", "error"], Qg = function(e) {
var t = e.buffered
, i = e.targetDuration
, n = e.currentTime;
return t.length ? t.end(0) - t.start(0) < 2 * i ? !1 : n > t.start(0) ? !1 : t.start(0) - n < i : !1
}, Jg = function() {
function e(e) {
var t = this;
this.masterPlaylistController_ = e.masterPlaylistController,
this.tech_ = e.tech,
this.seekable = e.seekable,
this.allowSeeksWithinUnsafeLiveWindow = e.allowSeeksWithinUnsafeLiveWindow,
this.media = e.media,
this.consecutiveUpdates = 0,
this.lastRecordedTime = null,
this.timer_ = null,
this.checkCurrentTimeTimeout_ = null,
this.logger_ = Om("PlaybackWatcher"),
this.logger_("initialize");
var i = function() {
return t.monitorCurrentTime_()
}
, n = function() {
return t.techWaiting_()
}
, r = function() {
return t.cancelTimer_()
}
, a = function() {
return t.fixesBadSeeks_()
}
, s = this.masterPlaylistController_
, o = ["main", "subtitle", "audio"]
, u = {};
o.forEach(function(e) {
u[e] = {
reset: function() {
return t.resetSegmentDownloads_(e)
},
updateend: function() {
return t.checkSegmentDownloads_(e)
}
},
s[e + "SegmentLoader_"].on("appendsdone", u[e].updateend),
s[e + "SegmentLoader_"].on("playlistupdate", u[e].reset),
t.tech_.on(["seeked", "seeking"], u[e].reset)
}),
this.tech_.on("seekablechanged", a),
this.tech_.on("waiting", n),
this.tech_.on($g, r),
this.tech_.on("canplay", i),
this.dispose = function() {
t.logger_("dispose"),
t.tech_.off("seekablechanged", a),
t.tech_.off("waiting", n),
t.tech_.off($g, r),
t.tech_.off("canplay", i),
o.forEach(function(e) {
s[e + "SegmentLoader_"].off("appendsdone", u[e].updateend),
s[e + "SegmentLoader_"].off("playlistupdate", u[e].reset),
t.tech_.off(["seeked", "seeking"], u[e].reset)
}),
t.checkCurrentTimeTimeout_ && dr["default"].clearTimeout(t.checkCurrentTimeTimeout_),
t.cancelTimer_()
}
}
var t = e.prototype;
return t.monitorCurrentTime_ = function() {
this.checkCurrentTime_(),
this.checkCurrentTimeTimeout_ && dr["default"].clearTimeout(this.checkCurrentTimeTimeout_),
this.checkCurrentTimeTimeout_ = dr["default"].setTimeout(this.monitorCurrentTime_.bind(this), 250)
}
,
t.resetSegmentDownloads_ = function(e) {
var t = this.masterPlaylistController_[e + "SegmentLoader_"];
this[e + "StalledDownloads_"] > 0 && this.logger_("resetting possible stalled download count for " + e + " loader"),
this[e + "StalledDownloads_"] = 0,
this[e + "Buffered_"] = t.buffered_()
}
,
t.checkSegmentDownloads_ = function(e) {
var t = this.masterPlaylistController_
, i = t[e + "SegmentLoader_"]
, n = i.buffered_()
, r = Uf(this[e + "Buffered_"], n);
return this[e + "Buffered_"] = n,
r ? void this.resetSegmentDownloads_(e) : (this[e + "StalledDownloads_"]++,
this.logger_("found #" + this[e + "StalledDownloads_"] + " " + e + " appends that did not increase buffer (possible stalled download)", {
playlistId: i.playlist_ && i.playlist_.id,
buffered: Rf(n)
}),
void (this[e + "StalledDownloads_"] < 10 || (this.logger_(e + " loader stalled download exclusion"),
this.resetSegmentDownloads_(e),
this.tech_.trigger({
type: "usage",
name: "vhs-" + e + "-download-exclusion"
}),
"subtitle" !== e && t.blacklistCurrentPlaylist({
message: "Excessive " + e + " segment downloading detected."
}, 1 / 0))))
}
,
t.checkCurrentTime_ = 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();
return this.lastRecordedTime === e && (!t.length || e + Af >= t.end(t.length - 1)) ? this.techWaiting_() : void (this.consecutiveUpdates >= 5 && e === this.lastRecordedTime ? (this.consecutiveUpdates++,
this.waiting_()) : e === this.lastRecordedTime ? this.consecutiveUpdates++ : (this.consecutiveUpdates = 0,
this.lastRecordedTime = e))
}
}
,
t.cancelTimer_ = function() {
this.consecutiveUpdates = 0,
this.timer_ && (this.logger_("cancelTimer_"),
clearTimeout(this.timer_)),
this.timer_ = null
}
,
t.fixesBadSeeks_ = function() {
var e = this.tech_.seeking();
if (!e)
return !1;
var t, i = this.seekable(), n = this.tech_.currentTime(), r = this.afterSeekableWindow_(i, n, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
if (r) {
var a = i.end(i.length - 1);
t = a
}
if (this.beforeSeekableWindow_(i, n)) {
var s = i.start(0);
t = s + (s === i.end(0) ? 0 : Af)
}
if ("undefined" != typeof t)
return this.logger_("Trying to seek outside of seekable at time " + n + " with " + ("seekable range " + Nf(i) + ". Seeking to ") + (t + ".")),
this.tech_.setCurrentTime(t),
!0;
var o = this.tech_.buffered();
return Qg({
buffered: o,
targetDuration: this.media().targetDuration,
currentTime: n
}) ? (t = o.start(0) + Af,
this.logger_("Buffered region starts (" + o.start(0) + ") " + (" just beyond seek point (" + n + "). Seeking to " + t + ".")),
this.tech_.setCurrentTime(t),
!0) : !1
}
,
t.waiting_ = function() {
if (!this.techWaiting_()) {
var e = this.tech_.currentTime()
, t = this.tech_.buffered()
, i = Pf(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."),
this.tech_.trigger({
type: "usage",
name: "vhs-unknown-waiting"
}),
void this.tech_.trigger({
type: "usage",
name: "hls-unknown-waiting"
})) : void 0
}
}
,
t.techWaiting_ = 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.beforeSeekableWindow_(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: "vhs-live-resync"
}),
this.tech_.trigger({
type: "usage",
name: "hls-live-resync"
}),
!0
}
var n = this.tech_.vhs.masterPlaylistController_.sourceUpdater_
, r = this.tech_.buffered()
, a = this.videoUnderflow_({
audioBuffered: n.audioBuffered(),
videoBuffered: n.videoBuffered(),
currentTime: t
});
if (a)
return this.cancelTimer_(),
this.tech_.setCurrentTime(t),
this.tech_.trigger({
type: "usage",
name: "vhs-video-underflow"
}),
this.tech_.trigger({
type: "usage",
name: "hls-video-underflow"
}),
!0;
var s = Lf(r, t);
if (s.length > 0) {
var o = s.start(0) - t;
return this.logger_("Stopped at " + t + ", setting timer for " + o + ", seeking to " + s.start(0)),
this.cancelTimer_(),
this.timer_ = setTimeout(this.skipTheGap_.bind(this), 1e3 * o, t),
!0
}
return !1
}
,
t.afterSeekableWindow_ = function(e, t, i, n) {
if (void 0 === n && (n = !1),
!e.length)
return !1;
var r = e.end(e.length - 1) + Af
, a = !i.endList;
return a && n && (r = e.end(e.length - 1) + 3 * i.targetDuration),
t > r ? !0 : !1
}
,
t.beforeSeekableWindow_ = function(e, t) {
return e.length && e.start(0) > 0 && t < e.start(0) - Af ? !0 : !1
}
,
t.videoUnderflow_ = function(e) {
var t = e.videoBuffered
, i = e.audioBuffered
, n = e.currentTime;
if (t) {
var r;
if (t.length && i.length) {
var a = Pf(t, n - 3)
, s = Pf(t, n)
, o = Pf(i, n);
o.length && !s.length && a.length && (r = {
start: a.end(0),
end: o.end(0)
})
} else {
var u = Lf(t, n);
u.length || (r = this.gapFromVideoUnderflow_(t, n))
}
return r ? (this.logger_("Encountered a gap in video from " + r.start + " to " + r.end + ". Seeking to current time " + n),
!0) : !1
}
}
,
t.skipTheGap_ = function(e) {
var t = this.tech_.buffered()
, i = this.tech_.currentTime()
, n = Lf(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) + If),
this.tech_.trigger({
type: "usage",
name: "vhs-gap-skip"
}),
this.tech_.trigger({
type: "usage",
name: "hls-gap-skip"
}))
}
,
t.gapFromVideoUnderflow_ = function(e, t) {
for (var i = Df(e), n = 0; n < i.length; n++) {
var r = i.start(n)
, a = i.end(n);
if (4 > t - r && t - r > 2)
return {
start: r,
end: a
}
}
return null
}
,
e
}(), Zg = {
errorInterval: 30,
getSource: function(e) {
var t = this.tech({
IWillNotUseThisInPlugins: !0
})
, i = t.currentSource_ || this.currentSource();
return e(i)
}
}, ev = function $y(e, t) {
var i = 0
, n = 0
, r = pn.mergeOptions(Zg, t);
e.ready(function() {
e.trigger({
type: "usage",
name: "vhs-error-reload-initialized"
}),
e.trigger({
type: "usage",
name: "hls-error-reload-initialized"
})
});
var a = function() {
n && e.currentTime(n)
}
, s = function(t) {
null !== t && void 0 !== t && (n = 1 / 0 !== e.duration() && e.currentTime() || 0,
e.one("loadedmetadata", a),
e.src(t),
e.trigger({
type: "usage",
name: "vhs-error-reload"
}),
e.trigger({
type: "usage",
name: "hls-error-reload"
}),
e.play())
}
, o = function() {
return Date.now() - i < 1e3 * r.errorInterval ? (e.trigger({
type: "usage",
name: "vhs-error-reload-canceled"
}),
void e.trigger({
type: "usage",
name: "hls-error-reload-canceled"
})) : r.getSource && "function" == typeof r.getSource ? (i = Date.now(),
r.getSource.call(e, s)) : void pn.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")
}
, u = function c() {
e.off("loadedmetadata", a),
e.off("error", o),
e.off("dispose", c)
}
, l = function(t) {
u(),
$y(e, t)
};
e.on("error", o),
e.on("dispose", u),
e.reloadSourceOnError = l
}, tv = function(e) {
ev(this, e)
}, iv = "2.2.4", nv = "5.6.7", rv = "0.14.0", av = "4.5.0", sv = "3.1.0", ov = {
PlaylistLoader: wf,
Playlist: ip,
utils: yp,
STANDARD_PLAYLIST_SELECTOR: Vm,
INITIAL_PLAYLIST_SELECTOR: Hm,
comparePlaylistBandwidth: Fm,
comparePlaylistResolution: Bm,
xhr: sp()
};
["GOAL_BUFFER_LENGTH", "MAX_GOAL_BUFFER_LENGTH", "BACK_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(ov, e, {
get: function() {
return pn.log.warn("using Vhs." + e + " is UNSAFE be sure you know what you are doing"),
jp[e]
},
set: function(t) {
return pn.log.warn("using Vhs." + e + " is UNSAFE be sure you know what you are doing"),
"number" != typeof t || 0 > t ? void pn.log.warn("value of Vhs." + e + " must be greater than or equal to 0") : void (jp[e] = t)
}
})
});
var uv = "videojs-vhs"
, lv = function(e, t) {
for (var i = t.media(), n = -1, r = 0; r < e.length; r++)
if (e[r].id === i.id) {
n = r;
break
}
e.selectedIndex_ = n,
e.trigger({
selectedIndex: n,
type: "change"
})
}
, cv = function(e, t) {
t.representations().forEach(function(t) {
e.addQualityLevel(t)
}),
lv(e, t.playlists)
};
ov.canPlaySource = function() {
return pn.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")
}
;
var dv = function(e, t, i) {
if (!e)
return e;
var n = {
video: t && t.attributes && t.attributes.CODECS,
audio: i && i.attributes && i.attributes.CODECS
};
!n.audio && n.video && n.video.split(",").length > 1 && n.video.split(",").forEach(function(e) {
e = e.trim(),
Ru(e) ? n.audio = e : Uu(e) && (n.video = e)
});
var r = n.video ? 'video/mp4;codecs="' + n.video + '"' : null
, a = n.audio ? 'audio/mp4;codecs="' + n.audio + '"' : null
, s = {};
for (var o in e)
s[o] = {
audioContentType: a,
videoContentType: r
},
t.contentProtection && t.contentProtection[o] && t.contentProtection[o].pssh && (s[o].pssh = t.contentProtection[o].pssh),
"string" == typeof e[o] && (s[o].url = e[o]);
return pn.mergeOptions(e, s)
}
, hv = function(e, t) {
return e.reduce(function(e, i) {
if (!i.contentProtection)
return e;
var n = t.reduce(function(e, t) {
var n = i.contentProtection[t];
return n && n.pssh && (e[t] = {
pssh: n.pssh
}),
e
}, {});
return Object.keys(n).length && e.push(n),
e
}, [])
}
, fv = function(e) {
var t = e.player
, i = e.sourceKeySystems
, n = e.media
, r = e.audioMedia
, a = e.mainPlaylists
, s = dv(i, n, r);
if (s) {
if (t.currentSource().keySystems = s,
s && !t.eme)
return void pn.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
if (11 !== pn.browser.IE_VERSION && t.eme.initializeMediaKeys) {
var o = r ? a.concat([r]) : a
, u = hv(o, Object.keys(i));
u.forEach(function(e) {
t.eme.initializeMediaKeys({
keySystems: e
})
})
}
}
}
, pv = function() {
if (!dr["default"].localStorage)
return null;
var e = dr["default"].localStorage.getItem(uv);
if (!e)
return null;
try {
return JSON.parse(e)
} catch (t) {
return null
}
}
, mv = function(e) {
if (!dr["default"].localStorage)
return !1;
var t = pv();
t = t ? pn.mergeOptions(t, e) : e;
try {
dr["default"].localStorage.setItem(uv, JSON.stringify(t))
} catch (i) {
return !1
}
return t
}
, gv = function(e) {
return 0 === e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") ? JSON.parse(e.substring(e.indexOf(",") + 1)) : e
};
ov.supportsNativeHls = function() {
if (!hr["default"] || !hr["default"].createElement)
return !1;
var e = hr["default"].createElement("video");
if (!pn.getTech("Html5").isSupported())
return !1;
var t = ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl", "application/x-mpegurl", "video/x-mpegurl", "video/mpegurl", "application/mpegurl"];
return t.some(function(t) {
return /maybe|probably/i.test(e.canPlayType(t))
})
}(),
ov.supportsNativeDash = function() {
return hr["default"] && hr["default"].createElement && pn.getTech("Html5").isSupported() ? /maybe|probably/i.test(hr["default"].createElement("video").canPlayType("application/dash+xml")) : !1
}(),
ov.supportsTypeNatively = function(e) {
return "hls" === e ? ov.supportsNativeHls : "dash" === e ? ov.supportsNativeDash : !1
}
,
ov.isSupported = function() {
return pn.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")
}
;
var vv = pn.getComponent("Component")
, yv = function(e) {
function t(t, i, n) {
var r;
if (r = e.call(this, i, pn.mergeOptions(n.hls, n.vhs)) || this,
n.hls && Object.keys(n.hls).length && pn.log.warn("Using hls options is deprecated. Use vhs instead."),
i.options_ && i.options_.playerId) {
var a = pn(i.options_.playerId);
a.hasOwnProperty("hls") || Object.defineProperty(a, "hls", {
get: function() {
return pn.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),
i.trigger({
type: "usage",
name: "hls-player-access"
}),
mr(r)
},
configurable: !0
}),
a.hasOwnProperty("vhs") || Object.defineProperty(a, "vhs", {
get: function() {
return pn.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),
i.trigger({
type: "usage",
name: "vhs-player-access"
}),
mr(r)
},
configurable: !0
}),
a.hasOwnProperty("dash") || Object.defineProperty(a, "dash", {
get: function() {
return pn.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),
mr(r)
},
configurable: !0
}),
r.player_ = a
}
if (r.tech_ = i,
r.source_ = t,
r.stats = {},
r.ignoreNextSeekingEvent_ = !1,
r.setOptions_(),
r.options_.overrideNative && i.overrideNativeAudioTracks && i.overrideNativeVideoTracks)
i.overrideNativeAudioTracks(!0),
i.overrideNativeVideoTracks(!0);
else if (r.options_.overrideNative && (i.featuresNativeVideoTracks || i.featuresNativeAudioTracks))
throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
return r.on(hr["default"], ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], function() {
var e = hr["default"].fullscreenElement || hr["default"].webkitFullscreenElement || hr["default"].mozFullScreenElement || hr["default"].msFullscreenElement;
e && e.contains(r.tech_.el()) && r.masterPlaylistController_.smoothQualityChange_()
}),
r.on(r.tech_, "seeking", function() {
return this.ignoreNextSeekingEvent_ ? void (this.ignoreNextSeekingEvent_ = !1) : void this.setCurrentTime(this.tech_.currentTime())
}),
r.on(r.tech_, "error", function() {
this.tech_.error() && this.masterPlaylistController_ && this.masterPlaylistController_.pauseLoading()
}),
r.on(r.tech_, "play", r.play),
r
}
gr(t, e);
var i = t.prototype;
return i.setOptions_ = function() {
var e = this;
if (this.options_.withCredentials = this.options_.withCredentials || !1,
this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === !1 ? !1 : !0,
this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === !1 ? !1 : !0,
this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || !1,
this.options_.smoothQualityChange = this.options_.smoothQualityChange || !1,
this.options_.useBandwidthFromLocalStorage = "undefined" != typeof this.source_.useBandwidthFromLocalStorage ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || !1,
this.options_.customTagParsers = this.options_.customTagParsers || [],
this.options_.customTagMappers = this.options_.customTagMappers || [],
this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || !1,
this.options_.handlePartialData = this.options_.handlePartialData || !1,
"number" != typeof this.options_.blacklistDuration && (this.options_.blacklistDuration = 300),
"number" != typeof this.options_.bandwidth && this.options_.useBandwidthFromLocalStorage) {
var t = pv();
t && t.bandwidth && (this.options_.bandwidth = t.bandwidth,
this.tech_.trigger({
type: "usage",
name: "vhs-bandwidth-from-local-storage"
}),
this.tech_.trigger({
type: "usage",
name: "hls-bandwidth-from-local-storage"
})),
t && t.throughput && (this.options_.throughput = t.throughput,
this.tech_.trigger({
type: "usage",
name: "vhs-throughput-from-local-storage"
}),
this.tech_.trigger({
type: "usage",
name: "hls-throughput-from-local-storage"
}))
}
"number" != typeof this.options_.bandwidth && (this.options_.bandwidth = jp.INITIAL_BANDWIDTH),
this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === jp.INITIAL_BANDWIDTH,
["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "smoothQualityChange", "customTagParsers", "customTagMappers", "handleManifestRedirects", "cacheEncryptionKeys", "handlePartialData"].forEach(function(t) {
"undefined" != typeof e.source_[t] && (e.options_[t] = e.source_[t])
}),
this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions,
this.useDevicePixelRatio = this.options_.useDevicePixelRatio
}
,
i.src = function(e, t) {
var i = this;
e && (this.setOptions_(),
this.options_.src = gv(this.source_.src),
this.options_.tech = this.tech_,
this.options_.externVhs = ov,
this.options_.sourceType = ua(t),
this.options_.seekTo = function(e) {
i.tech_.setCurrentTime(e)
}
,
this.masterPlaylistController_ = new Gg(this.options_),
this.playbackWatcher_ = new Jg(pn.mergeOptions(this.options_, {
seekable: function() {
return i.seekable()
},
media: function() {
return i.masterPlaylistController_.media()
},
masterPlaylistController: this.masterPlaylistController_
})),
this.masterPlaylistController_.on("error", function() {
var e = pn.players[i.tech_.options_.playerId]
, t = i.masterPlaylistController_.error;
"object" != typeof t || t.code ? "string" == typeof t && (t = {
message: t,
code: 3
}) : t.code = 3,
e.error(t)
}),
this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : ov.STANDARD_PLAYLIST_SELECTOR.bind(this),
this.masterPlaylistController_.selectInitialPlaylist = ov.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(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, t = 1 / (this.bandwidth || 1);
e = this.throughput > 0 ? 1 / this.throughput : 0;
var i = Math.floor(1 / (t + e));
return i
},
set: function() {
pn.log.error('The "systemBandwidth" property is read-only')
}
}
}),
this.options_.bandwidth && (this.bandwidth = this.options_.bandwidth),
this.options_.throughput && (this.throughput = this.options_.throughput),
Object.defineProperties(this.stats, {
bandwidth: {
get: function() {
return i.bandwidth || 0
},
enumerable: !0
},
mediaRequests: {
get: function() {
return i.masterPlaylistController_.mediaRequests_() || 0
},
enumerable: !0
},
mediaRequestsAborted: {
get: function() {
return i.masterPlaylistController_.mediaRequestsAborted_() || 0
},
enumerable: !0
},
mediaRequestsTimedout: {
get: function() {
return i.masterPlaylistController_.mediaRequestsTimedout_() || 0
},
enumerable: !0
},
mediaRequestsErrored: {
get: function() {
return i.masterPlaylistController_.mediaRequestsErrored_() || 0
},
enumerable: !0
},
mediaTransferDuration: {
get: function() {
return i.masterPlaylistController_.mediaTransferDuration_() || 0
},
enumerable: !0
},
mediaBytesTransferred: {
get: function() {
return i.masterPlaylistController_.mediaBytesTransferred_() || 0
},
enumerable: !0
},
mediaSecondsLoaded: {
get: function() {
return i.masterPlaylistController_.mediaSecondsLoaded_() || 0
},
enumerable: !0
},
buffered: {
get: function() {
return Rf(i.tech_.buffered())
},
enumerable: !0
},
currentTime: {
get: function() {
return i.tech_.currentTime()
},
enumerable: !0
},
currentSource: {
get: function() {
return i.tech_.currentSource_
},
enumerable: !0
},
currentTech: {
get: function() {
return i.tech_.name_
},
enumerable: !0
},
duration: {
get: function() {
return i.tech_.duration()
},
enumerable: !0
},
master: {
get: function() {
return i.playlists.master
},
enumerable: !0
},
playerDimensions: {
get: function() {
return i.tech_.currentDimensions()
},
enumerable: !0
},
seekable: {
get: function() {
return Rf(i.tech_.seekable())
},
enumerable: !0
},
timestamp: {
get: function() {
return Date.now()
},
enumerable: !0
},
videoPlaybackQuality: {
get: function() {
return i.tech_.getVideoPlaybackQuality()
},
enumerable: !0
}
}),
this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),
this.tech_.on("bandwidthupdate", function() {
i.options_.useBandwidthFromLocalStorage && mv({
bandwidth: i.bandwidth,
throughput: Math.round(i.throughput)
})
}),
this.masterPlaylistController_.on("selectedinitialmedia", function() {
Yg(i)
}),
this.masterPlaylistController_.sourceUpdater_.on("ready", function() {
var e = i.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
fv({
player: i.player_,
sourceKeySystems: i.source_.keySystems,
media: i.playlists.media(),
audioMedia: e && e.media(),
mainPlaylists: i.playlists.master.playlists
})
}),
this.on(this.masterPlaylistController_, "progress", function() {
this.tech_.trigger("progress")
}),
this.on(this.masterPlaylistController_, "firstplay", function() {
this.ignoreNextSeekingEvent_ = !0
}),
this.setupQualityLevels_(),
this.tech_.el() && (this.mediaSourceUrl_ = dr["default"].URL.createObjectURL(this.masterPlaylistController_.mediaSource),
this.tech_.src(this.mediaSourceUrl_)))
}
,
i.setupQualityLevels_ = function() {
var e = this
, t = pn.players[this.tech_.options_.playerId];
t && t.qualityLevels && !this.qualityLevels_ && (this.qualityLevels_ = t.qualityLevels(),
this.masterPlaylistController_.on("selectedinitialmedia", function() {
cv(e.qualityLevels_, e)
}),
this.playlists.on("mediachange", function() {
lv(e.qualityLevels_, e.playlists)
}))
}
,
t.version = function() {
return {
"@videojs/http-streaming": iv,
"mux.js": nv,
"mpd-parser": rv,
"m3u8-parser": av,
"aes-decrypter": sv
}
}
,
i.version = function() {
return this.constructor.version()
}
,
i.canChangeType = function() {
return _g.canChangeType()
}
,
i.play = function() {
this.masterPlaylistController_.play()
}
,
i.setCurrentTime = function(e) {
this.masterPlaylistController_.setCurrentTime(e)
}
,
i.duration = function() {
return this.masterPlaylistController_.duration()
}
,
i.seekable = function() {
return this.masterPlaylistController_.seekable()
}
,
i.dispose = function() {
this.playbackWatcher_ && this.playbackWatcher_.dispose(),
this.masterPlaylistController_ && this.masterPlaylistController_.dispose(),
this.qualityLevels_ && this.qualityLevels_.dispose(),
this.player_ && (delete this.player_.vhs,
delete this.player_.dash,
delete this.player_.hls),
this.tech_ && this.tech_.vhs && delete this.tech_.vhs,
this.tech_ && delete this.tech_.hls,
this.mediaSourceUrl_ && dr["default"].URL.revokeObjectURL && (dr["default"].URL.revokeObjectURL(this.mediaSourceUrl_),
this.mediaSourceUrl_ = null),
e.prototype.dispose.call(this)
}
,
i.convertToProgramTime = function(e, t) {
return wp({
playlist: this.masterPlaylistController_.media(),
time: e,
callback: t
})
}
,
i.seekToProgramTime = function(e, t, i, n) {
return void 0 === i && (i = !0),
void 0 === n && (n = 2),
Ip({
programTime: e,
playlist: this.masterPlaylistController_.media(),
retryCount: n,
pauseAfterSeek: i,
seekTo: this.options_.seekTo,
tech: this.options_.tech,
callback: t
})
}
,
t
}(vv)
, _v = {
name: "videojs-http-streaming",
VERSION: iv,
canHandleSource: function(e, t) {
void 0 === t && (t = {});
var i = pn.mergeOptions(pn.options, t);
return _v.canPlayType(e.type, i)
},
handleSource: function(e, t, i) {
void 0 === i && (i = {});
var n = pn.mergeOptions(pn.options, i);
return t.vhs = new yv(e,t,n),
pn.hasOwnProperty("hls") || Object.defineProperty(t, "hls", {
get: function() {
return pn.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),
t.vhs
},
configurable: !0
}),
t.vhs.xhr = sp(),
t.vhs.src(e.src, e.type),
t.vhs
},
canPlayType: function(e, t) {
void 0 === t && (t = {});
var i = pn.mergeOptions(pn.options, t)
, n = i.vhs.overrideNative
, r = void 0 === n ? !pn.browser.IS_ANY_SAFARI : n
, a = ua(e)
, s = a && (!ov.supportsTypeNatively(a) || r);
return s ? "maybe" : ""
}
}
, bv = function() {
return Ou("avc1.4d400d,mp4a.40.2")
};
bv() && pn.getTech("Html5").registerSourceHandler(_v, 0),
pn.VhsHandler = yv,
Object.defineProperty(pn, "HlsHandler", {
get: function() {
return pn.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),
yv
},
configurable: !0
}),
pn.VhsSourceHandler = _v,
Object.defineProperty(pn, "HlsSourceHandler", {
get: function() {
return pn.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),
_v
},
configurable: !0
}),
pn.Vhs = ov,
Object.defineProperty(pn, "Hls", {
get: function() {
return pn.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),
ov
},
configurable: !0
}),
pn.use || (pn.registerComponent("Hls", ov),
pn.registerComponent("Vhs", ov)),
pn.options.vhs = pn.options.vhs || {},
pn.options.hls = pn.options.hls || {},
pn.registerPlugin ? pn.registerPlugin("reloadSourceOnError", tv) : pn.plugin("reloadSourceOnError", tv);
var Tv = pn.getComponent("MenuItem")
, Sv = pn.dom
, Cv = function(e) {
function t(t, i) {
var n;
n = e.call(this, t, i) || this;
var r = i.menu;
return n.hideMenu = function() {
return r.hideMenu()
}
,
n.addMenuClass = function(e) {
return r.addClass(e)
}
,
n.removeMenuClass = function(e) {
return r.removeClass(e)
}
,
n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = e.prototype.createEl.call(this)
, i = this.options_.badge;
if (i) {
var n = Sv.createEl("span", {
className: "vjs-menu-item-badge",
style: "background-image: url('" + i + "');"
});
t.appendChild(n)
}
return t
}
,
t
}(Tv)
, Ev = function(e) {
return "string" == typeof e
}
, kv = function(e) {
return "[object Function]" === Object.prototype.toString.call(e)
}
, wv = function(e) {
return 0 === e.indexOf("#") ? e.slice(1) : e
}
, Iv = pn.getComponent("Menu")
, Av = pn.getComponent("MenuButton")
, xv = pn.dom
, Pv = function(e) {
function t(t, i) {
var n;
if (n = e.call(this, t, i) || this,
n.controlText(),
i.hooks && Object.keys(i.hooks).forEach(function(e) {
"beforeChange" !== e && n.on(e, i.hooks[e])
}),
i.className) {
var r = i.className;
Ev(r) && (r = r.split(/\s/)),
r.forEach(function(e) {
e && n.addClass(e)
})
}
return n
}
gr(t, e);
var i = t.prototype;
return i.createEl = function() {
var t = e.prototype.createEl.call(this)
, i = this.options_.text;
return this.labelEl_ = xv.createEl("div", {
className: "vjs-full-menu-text",
innerHTML: this.localize(i)
}),
this.createBadge(this.options_.badge),
t.appendChild(this.labelEl_),
t
}
,
i.dispose = function() {
this.labelEl_ = null,
e.prototype.dispose.call(this)
}
,
i.createBadge = function(e) {
if (e) {
var t = xv.createEl("span", {
className: "vjs-full-menu-badge",
style: "background-image: url('" + e + "');"
});
this.labelEl_.appendChild(t)
}
}
,
i.buildCSSClass = function() {
return "vjs-full-menu " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-full-menu " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.hideMenu = function() {
this.removeClass("vjs-hover")
}
,
i.createMenu = function() {
// isVIP? this.options_.subTitle="涛之雨修改":this.options_.title="涛之雨解锁";
var e = new Iv(this.player())
, t = this.options_.list
, i = this.options_
, n = i.title
, r = i.subTitle
, a = i.footnote
, s = e.el().firstChild;
if (t) {
this.createExtraEl(s, n, "vjs-menu-title"),
this.createExtraEl(s, r, "vjs-menu-sub-title");
for (var o = 0; o < t.length; o++)
e.addChild(new Cv(this.player(),fr({
menu: this
}, t[o])));
this.createExtraEl(s, a, "vjs-menu-footnote")
}
return e
}
,
i.createExtraEl = function(e, t, i) {
if (t) {
var n = t.text
, r = void 0 === n ? "" : n
, a = t.onClick
, s = t.icon;
if (r || s) {
var o = xv.createEl("li", {
className: i,
innerHTML: this.localize(r),
onclick: function() {
kv(a) && a()
}
});
if (s) {
var u = xv.createEl("span", {
className: "vjs-full-menu-icon",
style: "background-image: url('" + s + "');"
});
o.insertBefore(u, o.firstChild)
}
e.appendChild(o)
}
}
}
,
i.handleClick = function() {}
,
i.handleKeyDown = function() {}
,
i.controlText = function() {
this.menuButton_.controlText(this.options_.htmlTitle || this.options_.text)
}
,
t
}(Av)
, Lv = function(e) {
function t(t, i) {
var n, r = i.text, a = parseFloat(i.value, 10);
return i.label = r,
i.selected = i["default"] || i.defaultValue === a || 1 === a,
i.selectable = !0,
i.multiSelectable = !1,
n = e.call(this, t, i) || this,
n.label = r,
n.rate = a,
n.on(t, "ratechange", n.update),
i.selected && n.handleClickCore(),
n
}
gr(t, e);
var i = t.prototype;
return i.handleClick = function() {
var e = this;
kv(this.options_.beforeChange) ? this.options_.beforeChange(this, function() {
return e.handleClickCore()
}) : this.handleClickCore()
}
,
i.handleClickCore = function() {
e.prototype.handleClick.call(this),
this.hideMenu(),
this.player().playbackRate(this.rate)
}
,
i.update = function() {
this.selected(this.player().playbackRate() === this.rate)
}
,
t
}(Cv)
, Dv = pn.getComponent("Menu")
, Ov = pn.dom
, Nv = function(e) {
function t(t, i) {
var n;
return n = e.call(this, t, i) || this,
n.updateVisibility(),
n.updateLabel(),
n.on(t, "loadstart", n.updateVisibility),
n.on(t, "ratechange", n.updateLabel),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-playback-rate " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-playback-rate " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.createMenu = function() {
var e = new Dv(this.player())
, t = this.playbackRates()
, i = this.options_
, n = i.title//
, r = i.subTitle
, a = i.footnote
, s = e.el().firstChild
, o = fr({
menu: this,
defaultValue: this.options_.defaultValue,
beforeChange: this.options_.hooks && this.options_.hooks.beforeChange
});
if (t) {
this.createExtraEl(s, n, "vjs-menu-title"),
this.createExtraEl(s, r, "vjs-menu-sub-title");
for (var u = 0; u < t.length; u++)
e.addChild(new Lv(this.player(),fr({}, o, t[u])));
this.createExtraEl(s, a, "vjs-menu-footnote")
}
return e
}
,
i.updateARIAAttributes = function() {
this.el().setAttribute("aria-valuenow", this.player().playbackRate())
}
,
i.playbackRates = function() {
return isVIP?[{
text: "0.5倍",
value: .5
}, {
text: "0.75倍",
value: .75
}, {
text: "正常",
value: 1,
controlText: "倍速"
}, {
text: "1.25倍",
value: 1.25
}, {
text: "1.5倍",
value: 1.5
}, {
text: "2.0倍",
value: 2
}, {
text: "2.7倍",
value: 2.7
}, {
text: "4倍",
value: 4
}]:[{
text: "0.5倍",
value: .5
}, {
text: "0.75倍",
value: .75
}, {
text: "正常",
value: 1,
controlText: "倍速"
}, {
text: "1.25倍",
value: 1.25
}, {
text: "1.5倍",
value: 1.5
}, {
text: "2.0倍",
value: 2
}]
}
,
i.playbackRateSupported = function() {
return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0
}
,
i.updateVisibility = function() {
this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden")
}
,
i.updateLabel = function() {
// debugger
if (this.playbackRateSupported()) {
for (var e, t = this.options_.list, i = this.player().playbackRate(), n = t.length - 1; n >= 0; n--) {
var r = t[n];
if ((r.value || r.text) === i) {
e = r;
break
}
}
if(!e){
e={value:this.player().playbackRate(),text:this.player().playbackRate()+"倍"}
}
if(!alreadytoast)if(!isVIP)//非VIP提醒
require("system-core:system/uiService/tip/tip.js").show({mode: "loading", msg: `解锁是解锁了,但是服务器限速还是会很卡,本人这里超过3倍速就基本上不动了。推荐下载观看、缓存一段时间后观看或是氪金(推荐)`});
else
require("system-core:system/uiService/tip/tip.js").show({vipType:"svip",mode: "success", msg: `知道是氪金玩家,但是快捷键和画中画不香么,更大倍速不香么,去广告他不香么!`});
alreadytoast=true;
e && (Ov.textContent(this.labelEl_, this.localize(e.controlText || e.text)),
this.createBadge(e.controlBadge))
}
}
,
t
}(Pv)
, Mv = function(e) {
function t(t, i) {
var n, r = i.text, a = i.value || r;
return i.label = r,
i.selected = i["default"] || i.defaultValue === a,
i.selectable = !0,
i.multiSelectable = !1,
n = e.call(this, t, i) || this,
n.label = r,
n.value = a,
n.on(t, "resolutionchange", n.update),
i.selected && n.handleClickCore(),
n
}
gr(t, e);
var i = t.prototype;
return i.handleClick = function() {
var e = this;
kv(this.options_.beforeChange) ? this.options_.beforeChange(this, function() {
return e.handleClickCore()
}) : this.handleClickCore()
}
,
i.handleClickCore = function() {
e.prototype.handleClick.call(this),
this.hideMenu(),
this.player().resolution(this.value)
}
,
i.update = function() {
this.selected(this.player().resolution() === this.value)
}
,
t
}(Cv)
, Rv = pn.getComponent("Menu")
, Uv = pn.dom
, Fv = function(e) {
function t(t, i) {
var n, r = i.list = i.list || t.currentSources(), a = {};
return r.forEach(function(e) {
a[e.value || e.src] = e
}),
t.resolution = function(e) {
if (!e)
return t.src();
if (e !== t.src()) {
var n = a[e];
if (n) {
var r = t.currentTime()
, s = "loadeddata";
return "none" === t.preload() && (s = "timeupdate"),
t.src({
type: n.type,
src: n.value || n.src
}),
t.one(s, function() {
i.rememberPosition !== !1 && t.currentTime(r),
t.trigger("resolutionchange")
}),
t
}
}
}
,
n = e.call(this, t, i) || this,
n.updateLabel(),
n.on(t, "resolutionchange", n.updateLabel),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
return "vjs-playback-resolution " + e.prototype.buildCSSClass.call(this)
}
,
i.buildWrapperCSSClass = function() {
return "vjs-playback-resolution " + e.prototype.buildWrapperCSSClass.call(this)
}
,
i.createMenu = function() {
// isVIP? this.options_.subTitle="涛之雨修改":this.options_.title="涛之雨解锁";
var e = new Rv(this.player())
, t = this.options_.list
, i = this.options_
, n = i.title
, r = i.subTitle
, a = i.footnote
, s = e.el().firstChild
, o = fr({
menu: this,
defaultValue: this.options_.defaultValue,
beforeChange: this.options_.hooks && this.options_.hooks.beforeChange
});
if (t) {
this.createExtraEl(s, n, "vjs-menu-title"),
this.createExtraEl(s, r, "vjs-menu-sub-title");
for (var u = 0; u < t.length; u++)
e.addChild(new Mv(this.player(),fr({}, o, t[u])));
this.createExtraEl(s, a, "vjs-menu-footnote")
}
return e
}
,
i.updateLabel = function() {
for (var e, t = this.options_.list, i = this.player().resolution(), n = t.length - 1; n >= 0; n--) {
var r = t[n];
if ((r.value || r.text) === i) {
e = r;
break
}
}
e && (Uv.textContent(this.labelEl_, this.localize(e.controlText || e.text)),
this.createBadge(e.controlBadge))
}
,
t
}(Pv)
, Bv = pn.getComponent("VolumePanel")
, jv = function(e) {
function t(t, i) {
var n;
return void 0 === i && (i = {}),
n = e.call(this, t, i) || this,
n.el_.className = n.el_.className + " " + n.buildCSSClass(),
n
}
gr(t, e);
var i = t.prototype;
return i.buildCSSClass = function() {
var t = this.options_
, i = t.inline
, n = t.percent;
return !i && n ? "vjs-volume-panel-vertical-text " + e.prototype.buildCSSClass.call(this) : e.prototype.buildCSSClass.call(this)
}
,
t
}(Bv);
pn.registerComponent("Myplayback", Nv),
pn.registerComponent("PlaybackRateMenu", Nv),
pn.registerComponent("PlaybackRateMenuItem", Lv),
pn.registerComponent("ResolutionSwitcherMenu", Fv),
pn.registerComponent("ResolutionSwitcherMenuItem", Mv),
pn.registerComponent("VolumeControlPanel", jv);
var Vv = document
, qv = !!window.ActiveXObject
, Hv = ""
, Wv = "width height name id class style title type align tabindex usemap"
, zv = "expressInstall.swf?" + +new Date
, Gv = "ExpressInstall"
, Xv = !1
, Kv = ""
, Yv = "9,0,28,0"
, $v = function() {
var e, t, i = "ShockwaveFlash";
if (qv)
try {
e = new window.ActiveXObject(i + "." + i).GetVariable("$version"),
e && (e = e.split(" ")[1].split(",").join("."))
} catch (n) {}
else
t = navigator.plugins["Shockwave Flash"],
"object" == typeof t && (e = t.description.split(" ")[2]);
return parseFloat(e)
}();
_n.destroy = Cn,
_n.flashVersion = $v,
_n.base = function(e) {
if (!e) {
var t = Vv.getElementsByTagName("script")
, i = t[t.length - 1];
e = i.src
}
return e.split("/").slice(0, -1).join("/")
}(Hv),
_n.installCallback = function() {
if (Xv) {
var e = Vv.getElementById(Gv)
, t = e.parentNode;
Cn(e),
t.innerHTML = Kv,
Kv = "",
Xv = !1
}
}
;
var Qv = pn.dom
, Jv = pn.browser
, Zv = 0;
wn.isSupported = function() {
var e = this.getFlashVersion();
return e >= 11.4
}
,
wn.getFlashVersion = function() {
var e = window.ActiveXObject
, t = navigator.plugins
, i = t && t.length
, n = -1;
if (i)
for (var r = 0; i > r; r++) {
var a = t[r];
if (-1 !== a.name.indexOf("Shockwave Flash")) {
n = a.description.split("Shockwave Flash ")[1];
break
}
}
else if (e)
try {
var s = new e("ShockwaveFlash.ShockwaveFlash");
if (s) {
var o = s.GetVariable("$version")
, u = /WIN ([\d\.\,]+)/g
, l = u.exec(o);
l && (n = l[1])
}
} catch (c) {}
return parseFloat(n, 10)
}
;
var ey = function() {
var e = document.createElement("video");
try {
e.volume = .5
} catch (t) {
return !1
}
var i = ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl", "application/x-mpegurl", "video/x-mpegurl", "video/mpegurl", "application/mpegurl"];
return Array.prototype.some && i.some(function(t) {
return /maybe|probably/i.test(e.canPlayType && e.canPlayType(t))
})
}()
, ty = function() {
return !!window.MediaSource && !!window.MediaSource.isTypeSupported && window.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')
}()
, iy = ey || ty
, ny = {}
, ry = {
pan: ny,
test: {},
"default": {}
}
, ay = function(e, t) {
return function() {
for (var i = new Array(arguments.length), n = 0; n < i.length; n++)
i[n] = arguments[n];
return e.apply(t, i)
}
}
, sy = Object.prototype.toString
, oy = {
isArray: In,
isArrayBuffer: Pn,
isBuffer: xn,
isFormData: Ln,
isArrayBufferView: Dn,
isString: On,
isNumber: Nn,
isObject: Mn,
isPlainObject: Rn,
isUndefined: An,
isDate: Un,
isFile: Fn,
isBlob: Bn,
isFunction: jn,
isStream: Vn,
isURLSearchParams: qn,
isStandardBrowserEnv: Wn,
forEach: zn,
merge: Gn,
extend: Xn,
trim: Hn,
stripBOM: Kn
}
, uy = function(e, t, i) {
if (!t)
return e;
var n;
if (i)
n = i(t);
else if (oy.isURLSearchParams(t))
n = t.toString();
else {
var r = [];
oy.forEach(t, function(e, t) {
null !== e && "undefined" != typeof e && (oy.isArray(e) ? t += "[]" : e = [e],
oy.forEach(e, function(e) {
oy.isDate(e) ? e = e.toISOString() : oy.isObject(e) && (e = JSON.stringify(e)),
r.push(Yn(t) + "=" + Yn(e))
}))
}),
n = r.join("&")
}
if (n) {
var a = e.indexOf("#");
-1 !== a && (e = e.slice(0, a)),
e += (-1 === e.indexOf("?") ? "?" : "&") + n
}
return e
};
$n.prototype.use = function(e, t) {
return this.handlers.push({
fulfilled: e,
rejected: t
}),
this.handlers.length - 1
}
,
$n.prototype.eject = function(e) {
this.handlers[e] && (this.handlers[e] = null)
}
,
$n.prototype.forEach = function(e) {
oy.forEach(this.handlers, function(t) {
null !== t && e(t)
})
}
;
var ly = $n
, cy = function(e, t, i) {
return oy.forEach(i, function(i) {
e = i(e, t)
}),
e
}
, dy = function(e) {
return !(!e || !e.__CANCEL__)
}
, hy = function(e, t) {
oy.forEach(e, function(i, n) {
n !== t && n.toUpperCase() === t.toUpperCase() && (e[t] = i,
delete e[n])
})
}
, fy = function(e, t, i, n, r) {
return e.config = t,
i && (e.code = i),
e.request = n,
e.response = r,
e.isAxiosError = !0,
e.toJSON = function() {
return {
message: this.message,
name: this.name,
description: this.description,
number: this.number,
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
config: this.config,
code: this.code
}
}
,
e
}
, py = function(e, t, i, n, r) {
var a = new Error(e);
return fy(a, t, i, n, r)
}
, my = function(e, t, i) {
var n = i.config.validateStatus;
i.status && n && !n(i.status) ? t(py("Request failed with status code " + i.status, i.config, null, i.request, i)) : e(i)
}
, gy = oy.isStandardBrowserEnv() ? function() {
return {
write: function(e, t, i, n, r, a) {
var s = [];
s.push(e + "=" + encodeURIComponent(t)),
oy.isNumber(i) && s.push("expires=" + new Date(i).toGMTString()),
oy.isString(n) && s.push("path=" + n),
oy.isString(r) && s.push("domain=" + r),
a === !0 && s.push("secure"),
document.cookie = s.join("; ")
},
read: function(e) {
var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
return t ? decodeURIComponent(t[3]) : null
},
remove: function(e) {
this.write(e, "", Date.now() - 864e5)
}
}
}() : function() {
return {
write: function() {},
read: function() {
return null
},
remove: function() {}
}
}()
, vy = function(e) {
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)
}
, yy = function(e, t) {
return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e
}
, _y = function(e, t) {
return e && !vy(t) ? yy(e, t) : t
}
, by = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"]
, Ty = function(e) {
var t, i, n, r = {};
return e ? (oy.forEach(e.split("\n"), function(e) {
if (n = e.indexOf(":"),
t = oy.trim(e.substr(0, n)).toLowerCase(),
i = oy.trim(e.substr(n + 1)),
t) {
if (r[t] && by.indexOf(t) >= 0)
return;
r[t] = "set-cookie" === t ? (r[t] ? r[t] : []).concat([i]) : r[t] ? r[t] + ", " + i : i
}
}),
r) : r
}
, Sy = oy.isStandardBrowserEnv() ? function() {
function e(e) {
var t = e;
return i && (n.setAttribute("href", t),
t = n.href),
n.setAttribute("href", t),
{
href: n.href,
protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
host: n.host,
search: n.search ? n.search.replace(/^\?/, "") : "",
hash: n.hash ? n.hash.replace(/^#/, "") : "",
hostname: n.hostname,
port: n.port,
pathname: "/" === n.pathname.charAt(0) ? n.pathname : "/" + n.pathname
}
}
var t, i = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
return t = e(window.location.href),
function(i) {
var n = oy.isString(i) ? e(i) : i;
return n.protocol === t.protocol && n.host === t.host
}
}() : function() {
return function() {
return !0
}
}()
, Cy = function(e) {
return new Promise(function(t, i) {
var n = e.data
, r = e.headers;
oy.isFormData(n) && delete r["Content-Type"];
var a = new XMLHttpRequest;
if (e.auth) {
var s = e.auth.username || ""
, o = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
r.Authorization = "Basic " + btoa(s + ":" + o)
}
var u = _y(e.baseURL, e.url);
if (a.open(e.method.toUpperCase(), uy(u, e.params, e.paramsSerializer), !0),
a.timeout = e.timeout,
a.onreadystatechange = function() {
if (a && 4 === a.readyState && (0 !== a.status || a.responseURL && 0 === a.responseURL.indexOf("file:"))) {
var n = "getAllResponseHeaders"in a ? Ty(a.getAllResponseHeaders()) : null
, r = e.responseType && "text" !== e.responseType ? a.response : a.responseText
, s = {
data: r,
status: a.status,
statusText: a.statusText,
headers: n,
config: e,
request: a
};
my(t, i, s),
a = null
}
}
,
a.onabort = function() {
a && (i(py("Request aborted", e, "ECONNABORTED", a)),
a = null)
}
,
a.onerror = function() {
i(py("Network Error", e, null, a)),
a = null
}
,
a.ontimeout = function() {
var t = "timeout of " + e.timeout + "ms exceeded";
e.timeoutErrorMessage && (t = e.timeoutErrorMessage),
i(py(t, e, "ECONNABORTED", a)),
a = null
}
,
oy.isStandardBrowserEnv()) {
var l = (e.withCredentials || Sy(u)) && e.xsrfCookieName ? gy.read(e.xsrfCookieName) : void 0;
l && (r[e.xsrfHeaderName] = l)
}
if ("setRequestHeader"in a && oy.forEach(r, function(e, t) {
"undefined" == typeof n && "content-type" === t.toLowerCase() ? delete r[t] : a.setRequestHeader(t, e)
}),
oy.isUndefined(e.withCredentials) || (a.withCredentials = !!e.withCredentials),
e.responseType)
try {
a.responseType = e.responseType
} catch (c) {
if ("json" !== e.responseType)
throw c
}
"function" == typeof e.onDownloadProgress && a.addEventListener("progress", e.onDownloadProgress),
"function" == typeof e.onUploadProgress && a.upload && a.upload.addEventListener("progress", e.onUploadProgress),
e.cancelToken && e.cancelToken.promise.then(function(e) {
a && (a.abort(),
i(e),
a = null)
}),
n || (n = null),
a.send(n)
}
)
}
, Ey = {
"Content-Type": "application/x-www-form-urlencoded"
}
, ky = {
adapter: Jn(),
transformRequest: [function(e, t) {
return hy(t, "Accept"),
hy(t, "Content-Type"),
oy.isFormData(e) || oy.isArrayBuffer(e) || oy.isBuffer(e) || oy.isStream(e) || oy.isFile(e) || oy.isBlob(e) ? e : oy.isArrayBufferView(e) ? e.buffer : oy.isURLSearchParams(e) ? (Qn(t, "application/x-www-form-urlencoded;charset=utf-8"),
e.toString()) : oy.isObject(e) ? (Qn(t, "application/json;charset=utf-8"),
JSON.stringify(e)) : e
}
],
transformResponse: [function(e) {
if ("string" == typeof e)
try {
e = JSON.parse(e)
} catch (t) {}
return e
}
],
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: function(e) {
return e >= 200 && 300 > e
}
};
ky.headers = {
common: {
Accept: "application/json, text/plain, */*"
}
},
oy.forEach(["delete", "get", "head"], function(e) {
ky.headers[e] = {}
}),
oy.forEach(["post", "put", "patch"], function(e) {
ky.headers[e] = oy.merge(Ey)
});
var wy = ky
, Iy = function(e) {
Zn(e),
e.headers = e.headers || {},
e.data = cy(e.data, e.headers, e.transformRequest),
e.headers = oy.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers),
oy.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function(t) {
delete e.headers[t]
});
var t = e.adapter || wy.adapter;
return t(e).then(function(t) {
return Zn(e),
t.data = cy(t.data, t.headers, e.transformResponse),
t
}, function(t) {
return dy(t) || (Zn(e),
t && t.response && (t.response.data = cy(t.response.data, t.response.headers, e.transformResponse))),
Promise.reject(t)
})
}
, Ay = function(e, t) {
function i(e, t) {
return oy.isPlainObject(e) && oy.isPlainObject(t) ? oy.merge(e, t) : oy.isPlainObject(t) ? oy.merge({}, t) : oy.isArray(t) ? t.slice() : t
}
function n(n) {
oy.isUndefined(t[n]) ? oy.isUndefined(e[n]) || (r[n] = i(void 0, e[n])) : r[n] = i(e[n], t[n])
}
t = t || {};
var r = {}
, a = ["url", "method", "data"]
, s = ["headers", "auth", "proxy", "params"]
, o = ["baseURL", "transformRequest", "transformResponse", "paramsSerializer", "timeout", "timeoutMessage", "withCredentials", "adapter", "responseType", "xsrfCookieName", "xsrfHeaderName", "onUploadProgress", "onDownloadProgress", "decompress", "maxContentLength", "maxBodyLength", "maxRedirects", "transport", "httpAgent", "httpsAgent", "cancelToken", "socketPath", "responseEncoding"]
, u = ["validateStatus"];
oy.forEach(a, function(e) {
oy.isUndefined(t[e]) || (r[e] = i(void 0, t[e]))
}),
oy.forEach(s, n),
oy.forEach(o, function(n) {
oy.isUndefined(t[n]) ? oy.isUndefined(e[n]) || (r[n] = i(void 0, e[n])) : r[n] = i(void 0, t[n])
}),
oy.forEach(u, function(n) {
n in t ? r[n] = i(e[n], t[n]) : n in e && (r[n] = i(void 0, e[n]))
});
var l = a.concat(s).concat(o).concat(u)
, c = Object.keys(e).concat(Object.keys(t)).filter(function(e) {
return -1 === l.indexOf(e)
});
return oy.forEach(c, n),
r
};
er.prototype.request = function(e) {
"string" == typeof e ? (e = arguments[1] || {},
e.url = arguments[0]) : e = e || {},
e = Ay(this.defaults, e),
e.method = e.method ? e.method.toLowerCase() : this.defaults.method ? this.defaults.method.toLowerCase() : "get";
var t = [Iy, void 0]
, i = Promise.resolve(e);
for (this.interceptors.request.forEach(function(e) {
t.unshift(e.fulfilled, e.rejected)
}),
this.interceptors.response.forEach(function(e) {
t.push(e.fulfilled, e.rejected)
}); t.length; )
i = i.then(t.shift(), t.shift());
return i
}
,
er.prototype.getUri = function(e) {
return e = Ay(this.defaults, e),
uy(e.url, e.params, e.paramsSerializer).replace(/^\?/, "")
}
,
oy.forEach(["delete", "get", "head", "options"], function(e) {
er.prototype[e] = function(t, i) {
return this.request(Ay(i || {}, {
method: e,
url: t,
data: (i || {}).data
}))
}
}),
oy.forEach(["post", "put", "patch"], function(e) {
er.prototype[e] = function(t, i, n) {
return this.request(Ay(n || {}, {
method: e,
url: t,
data: i
}))
}
});
var xy = er;
tr.prototype.toString = function() {
return "Cancel" + (this.message ? ": " + this.message : "")
}
,
tr.prototype.__CANCEL__ = !0;
var Py = tr;
ir.prototype.throwIfRequested = function() {
if (this.reason)
throw this.reason
}
,
ir.source = function() {
var e, t = new ir(function(t) {
e = t
}
);
return {
token: t,
cancel: e
}
}
;
var Ly = ir
, Dy = function(e) {
return function(t) {
return e.apply(null, t)
}
}
, Oy = function(e) {
return "object" == typeof e && e.isAxiosError === !0
}
, Ny = nr(wy);
Ny.Axios = xy,
Ny.create = function(e) {
return nr(Ay(Ny.defaults, e))
}
,
Ny.Cancel = Py,
Ny.CancelToken = Ly,
Ny.isCancel = dy,
Ny.all = function(e) {
return Promise.all(e)
}
,
Ny.spread = Dy,
Ny.isAxiosError = Oy;
var My = Ny
, Ry = Ny;
My["default"] = Ry;
var Uy, Fy = My, By = "/api/getconfig?type=fetch&keys=" + JSON.stringify({
ad_videoplay: 0
}) + "&clienttype=0", jy = !0, Vy = [];
return pn
});
}
},10);
}
let isVIP=w.require("base:widget/vip/vip.js").getVipValue()>0;
let killedVIP=false;
w.require.async("file-widget-1:videoPlay/HTML5Player/HTML5Player.js",(a)=>{
a.prototype.antiSpam=()=>{};
})
var Myasync=setInterval(()=>{
w.require.async("file-widget-1:videoPlay/context.js", function (a) {
var tmpContext=a.getContext();
if(!tmpContext){return}
a.getContext().locals.set("is_svip",1);
a.getContext().locals.set("vip_level","∞");
if(tmpContext.useNewSDK!==undefined){
tmpContext.useNewSDK=!info.isOldSDK;
a.setContext(tmpContext);
clearInterval(Myasync);
}
});
},100);
const getmyvideo=a=>{
if(!myvideojs)return false;
if(!myvideojs.players){
if(!myvideojs.getPlayers()){
if(!!myvideojs.getPlayers()[a])return myvideojs.getPlayers()[a];else return false;
}else{
try{
if(!!myvideojs(a))return myvideojs(a);else return false;
}catch(e){return false;}
}
}else{
if(!!myvideojs.players[a])return myvideojs.players[a];else return false;
}
}
!isVIP&&require("system-core:system/uiService/tip/tip.js").show({mode: "loading", msg: `等待广告加载结束`});
let id=setInterval(()=>{
myvideojs=myvideojs||w.videoPlayer;
if(myvideojs&&!!getmyvideo("html5player")){
let vid=getmyvideo("html5player").tag||getmyvideo("html5player").tech_.el_;
clearInterval(id);
if(document.pictureInPictureEnabled){
GM_addStyle(`
.video-functions-tips{
margin-top: -69px;
}`);
vid.disablePictureInPicture=false;
let li=document.createElement("li");
li.id="ChangeSDK";
li.innerHTML=`<svg t="1620441372115" style="width: 26px;height: 24px;margin-top: -7px;" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1317" width="48" height="48"><path d="M641.28 884.736V784.64a10.624 10.624 0 0 1 11.008-10.624h231.552a11.008 11.008 0 0 0 11.008-11.008v-36.864a11.008 11.008 0 0 0-11.008-11.008H472.96a11.008 11.008 0 0 0-7.424 18.816l156.992 157.184a11.008 11.008 0 0 0 18.816-6.4z m59.264-464.64v99.84a10.624 10.624 0 0 1-11.008 11.008H461.504a11.008 11.008 0 0 0-11.008 11.008v36.48a11.008 11.008 0 0 0 11.008 11.008h408.128a10.624 10.624 0 0 0 7.872-18.432l-156.992-156.992a11.008 11.008 0 0 0-20.032 6.4z" p-id="1318" fill="#ffffff"></path><path d="M817.152 128H206.528a78.464 78.464 0 0 0-78.464 78.464v602.752a78.464 78.464 0 0 0 78.464 78.464h229.568v-53.76H237.248a54.912 54.912 0 0 1-54.912-54.912V235.904a54.912 54.912 0 0 1 54.912-54.912h546.304a55.36 55.36 0 0 1 54.912 54.912v156.672a9.024 9.024 0 0 0 9.024 9.024h39.232a9.024 9.024 0 0 0 9.024-9.024V206.144a78.464 78.464 0 0 0-78.912-78.464z" p-id="1319" fill="#ffffff"></path></svg><span style="margin-top: -4px;">切至${info.isOldSDK?"新":"旧"}版</span>`;
document.querySelector("ul.tips-ul.three-items").append(li)
document.querySelector("#ChangeSDK").onclick=()=>{
info.isOldSDK=!info.isOldSDK;
saveInfo(info);
setTimeout(()=>{location.reload()},1000)
}


li=document.createElement("li");
li.id="PInP_tao";
li.innerHTML='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1168" style="width: 26px;height: 24px;margin-top: -7px;"><path d="M782 273H242v478h179v0.31a40.338 40.338 0 0 1 4.339-0.305L426 751c22.091 0 40 17.909 40 40s-17.909 40-40 40c-1.693 0-3.362-0.105-5-0.31v0.31H222c-33.137 0-60-26.863-60-60V253c0-33.137 26.863-60 60-60h580c33.137 0 60 26.863 60 60v176c0 22.091-17.909 40-40 40s-40-17.909-40-40V273z m20 263c33.137 0 60 26.863 60 60v175c0 33.137-26.863 60-60 60H588c-33.137 0-60-26.863-60-60V596c0-33.137 26.863-60 60-60h214z m-20 80H608v135h174V616z" p-id="1169" fill="#ffffff"></path></svg><span style="margin-top: -4px;">画中画</span>';
document.querySelector("ul.tips-ul.three-items").append(li)
document.querySelector("#PInP_tao").onclick=()=>{
var Observer;
if (!document.pictureInPictureElement) {
Observer= new MutationObserver(function (mutations, instance) {
if (document.pictureInPictureElement) {
if(getmyvideo("html5player").el_.classList.value.indexOf("vjs-fullscreen")>=0){
// console.log("进入全屏,关闭画中画");
document.exitPictureInPicture().catch(e => console.warn("不会吧不会吧,开启没失败,取消反而失败了?",e));
Observer&&(Observer.disconnect(),Observer=undefined);
}
}else Observer&&(Observer.disconnect(),Observer=undefined);
});

Observer.observe(getmyvideo("html5player").el_, {
attributes: true,
attributeFilter: ["class"]
});
vid.requestPictureInPicture().catch(e=>console.warn("画中画开启失败:",e));
}else{
document.exitPictureInPicture()
.catch(e => console.warn("不会吧不会吧,开启没失败,取消反而失败了?",e));
Observer&&(Observer.disconnect(),Observer=undefined);
}
}
}else console.log("很遗憾,不支持画中画功能");

if(info.isOldSDK){
let ne = myvideojs.createEl,
Jn = myvideojs.getComponent("Menu"),
gr = myvideojs.getComponent("PlaybackRateMenuItem");

function a(a, b) {
a.prototype = Object.create(b.prototype);
a.prototype.constructor = a;
a.__proto__ = b;
};
var vr = function(n) {
function e(e, t) {
var i;
return (i = n.call(this, e, t) || this).updateVisibility(), i.updateLabel(), i.on(e, "loadstart", i.updateVisibility), i.on(e, "ratechange", i.updateLabel), i
}
a(e, n);
var t = e.prototype;
return t.createEl = function() {
var e = n.prototype.createEl.call(this);
return this.labelEl_ = ne("div", {
className: "vjs-playback-rate-value",
innerHTML: "X1"
}), e.appendChild(this.labelEl_), e
}, t.dispose = function() {
this.labelEl_ = null, n.prototype.dispose.call(this)
}, t.buildCSSClass = function() {
return "vjs-playback-rate " + n.prototype.buildCSSClass.call(this)
}, t.buildWrapperCSSClass = function() {
return "vjs-playback-rate " + n.prototype.buildWrapperCSSClass.call(this)
}, t.createMenu = function() {
var e = new Jn(this.player()),
t = this.playbackRates();
if (t)
for (var i = t.length - 1; 0 <= i; i--) e.addChild(new gr(this.player(), {
rate:t[i]
}));
return e
}, t.updateARIAAttributes = function() {
this.el().setAttribute("aria-valuenow", this.player().playbackRate())
}, t.handleClick = function(e) {
for (var t = this.player().playbackRate(), i = this.playbackRates(), n = i[0], r = 0; r < i.length; r++)
if (i[r] > t) {
n = i[r];
break
}
this.player().playbackRate(n)
}, t.playbackRates = function() {
return isVIP?[0.5,0.75, 1, 1.5, 2, 2.7, 4]:[0.5,0.75,1,1.5,2,3];
}, t.playbackRateSupported = function() {
return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && 0 < this.playbackRates().length
}, t.updateVisibility = function(e) {
this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden")
}, t.updateLabel = function(e) {
this.playbackRateSupported() && (this.labelEl_.innerHTML = "X"+this.player().playbackRate())
}, e
}(myvideojs.getComponent('MenuButton'));
vr.prototype.controlText_ = isVIP?"只是为了添加快捷键才替换的官方按钮":"播放速率,\n涛之雨独家解锁VIP\n非VIP服务器限速,因此最大速率为3倍,\n购买百度云会员解锁更高倍率(可以通过快捷键调整尝试改高)";
myvideojs.registerComponent('Myplayback', vr);
getmyvideo("html5player").controlBar.removeChild('playbackRateMenu');
if(!document.querySelector(".level-2,.level-1")){//会员不用等待广告
var aid=setInterval(()=>{
if(!getmyvideo("html5-werbung-player")||getmyvideo("html5-werbung-player").el_.classList.value.indexOf("vjs-paused")>=0){
clearInterval(aid);
getmyvideo("html5player").controlBar.addChild('Myplayback', {}, 6);
}
},500);
}else{
GM_addStyle(`
.video-js .vjs-playback-rate{
	line-height: 2em;
font-size: 1.4em;
}
.vjs-workinghover .vjs-menu-button-popup:hover .vjs-menu{
	margin-bottom: 0.67em!important;
}`);
getmyvideo("html5player").controlBar.addChild('Myplayback', {}, 6);
}
}
var SetKey=document.createElement("sapn");
SetKey.id="SetKey";
SetKey.innerHTML="快捷键已"+(info.SetKey===true?"打开【√】":"关闭【×】");
SetKey.title=` * 在播放界面,新增快捷键控制播放速度:
* (shift键无论是否按下,)按数字【0】即可恢复正常速度(原速快捷键)
* 按下数字【1-9】可以分别调整速度为【1.25,1.5,1.75,2,2.4,2.7,4,6,8】(倍速快捷键)
* 按下【shift】后再按下数字【1-9】可以分别调整速度为【0.1,0.15,0.2,0.25,0.3,0.5,0.6,0.8,0.9】(慢速快捷键)
* (shift键无论是否按下,)每次按下【-】,当前速率减小0.1
* (shift键无论是否按下,)每次按下【=】,当前速率增加0.1`;
document.querySelector('dd[node-type="header-link"]').append(SetKey);
document.querySelector("#SetKey").onclick=(a)=>{
info.SetKey=!info.SetKey;
a.target.innerHTML="快捷键已"+(info.SetKey===true?"打开【√】":"关闭【×】");
saveInfo(info);
}
var safeTime=false;
document.onkeydown=function(e){
if(safeTime||!info.SetKey)return;
safeTime=true;
var k=e.keyCode || e.which || e.charCode;
var p=getmyvideo("html5player").tech_.playbackRate();
if(k===48)p=1;
else if(k>=49&&k<=57)p=(!e.shiftKey?[1.25,1.5,1.75,2,2.4,2.7,4,6,8]:[0.1,0.15,0.2,0.25,0.3,0.5,0.6,0.8,0.9])[k-49];
else if(k===189)p-=0.1;
else if(k===187)p+=0.1;
getmyvideo("html5player").tech_.setPlaybackRate(parseFloat(p.toFixed(2)));
setTimeout(()=>{safeTime=false},50);
}
getmyvideo("html5player").el_.onmouseenter = a => {
let b=a.target;
b.classList.remove("vjs-user-inactive");
b.classList.add("vjs-user-active")
};
getmyvideo("html5player").el_.onmouseleave = a => {
let b=a.target;
b.classList.add("vjs-user-inactive");
b.classList.remove("vjs-user-active")
};
require("system-core:system/uiService/tip/tip.js").show({vipType:"svip",mode: "success", msg: `涛之雨插件加载成功!敬请享受快捷键、画中画${isVIP?"":"、解锁倍速和高画质的快感!"}`});
}
},500);
}else if(location.href.indexOf("share/init")>=0){
if(info.isFristAutoEnterKey){
info.isFristAutoEnterKey=false;
saveInfo(info);
var m=document.createElement("div");
m.style="position: fixed;left: 0px;top: 0px;z-index: 50;background: rgb(0, 0, 0);opacity: 0.7;font-size: 30px;width: 100%;line-height: 2;display: flex;height: 100%;align-items: center;justify-content: center;flex-direction: column;color: wheat;flex-wrap: wrap;";
m.id="taozhiyuMask";
m.innerHTML='<p>为了便于自动获取提取码</p><p>请在弹出框内点击允许</p><p>否则仅能手动输入/粘贴</p><br><p style="font-size: 14px;line-height: 1;">该信息仅在第一次打开时出现,点击屏幕消失</p>';
document.querySelector("body").append(m);
m.onclick=()=>{
m.remove();
};
}
navigator.permissions.query({name: "clipboard-read"}).then(result => {
if (result.state == "granted" || result.state == "prompt") {
autoInputCode( (c,a)=>{
if(c){
let b=a.match(/(?:密|提取|访问|訪問)[碼码]?\s*[::]?\s*([a-z\d]{4})/);
if(!!b){
console.log("匹配到密码:",b[1]);
document.querySelector("#accessCode").value=b[1];
document.querySelector("#submitBtn").click()
}else{
console.log("未匹配到常见密码")
}
}else{
console.log("不让我读取剪贴板你就自己粘贴去\n\n╭(╯^╰)╮哼\n\n如果是误操作请到“chrome://settings/content/clipboard”允许脚本读取剪贴板");
}
})
}else{
console.log("不让我读取剪贴板你就自己粘贴去\n\n╭(╯^╰)╮哼\n\n如果是误操作请到“chrome://settings/content/clipboard”允许脚本读取剪贴板");
}
})
}
})();