sopplayer
Version:
Sopplayer is a sleek and feature-rich HTML5 video player that enhances the visual experience of videos on web pages. It offers compatibility across devices and browsers, supporting various video formats. With intuitive controls and customizable options, S
1,267 lines (1,190 loc) • 816 kB
JavaScript
/**
* @license
* Video.js 7.10.2 <http://videojs.com/>
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/master/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
*/
document.querySelector("video").addEventListener("contextmenu", (event) => {
event.preventDefault();
});
! function (e, t) {
"object" == typeof exports && "undefined" != typeof module ? module.exports = t(require("global/window"), require("global/document")) : "function" == typeof define && define.amd ? define(["global/window", "global/document"], t) : (e = e || self).videojs = t(e.window, e.document)
}(this, function (T, d) {
"use strict";
T = T && Object.prototype.hasOwnProperty.call(T, "default") ? T.default : T, d = d && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
var h = "7.10.2",
l = [],
e = function (o, u) {
return function (e, t, i) {
var n = u.levels[t],
r = new RegExp("^(" + n + ")$");
if ("log" !== e && i.unshift(e.toUpperCase() + ":"), i.unshift(o + ":"), l) {
l.push([].concat(i));
var a = l.length - 1e3;
l.splice(0, 0 < a ? a : 0)
}
if (T.console) {
var s = T.console[e];
s || "debug" !== e || (s = T.console.info || T.console.log), s && n && r.test(e) && s[Array.isArray(i) ? "apply" : "call"](T.console, i)
}
}
};
var p = function t(i) {
function n() {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
r("log", a, t)
}
var r, a = "info";
return r = e(i, n), n.createLogger = function (e) {
return t(i + ": " + e)
}, n.levels = {
all: "debug|log|warn|error",
off: "",
debug: "debug|log|warn|error",
info: "log|warn|error",
warn: "warn|error",
error: "error",
DEFAULT: a
}, n.level = function (e) {
if ("string" == typeof e) {
if (!n.levels.hasOwnProperty(e)) throw new Error('"' + e + '" in not a valid log level');
a = e
}
return a
}, (n.history = function () {
return l ? [].concat(l) : []
}).filter = function (t) {
return (l || []).filter(function (e) {
return new RegExp(".*" + t + ".*").test(e[0])
})
}, n.history.clear = function () {
l && (l.length = 0)
}, n.history.disable = function () {
null !== l && (l.length = 0, l = null)
}, n.history.enable = function () {
null === l && (l = [])
}, n.error = function () {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
return r("error", a, t)
}, n.warn = function () {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
return r("warn", a, t)
}, n.debug = function () {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
return r("debug", a, t)
}, n
}("VIDEOJS"),
f = p.createLogger;
function t(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e
}
function i(e, t) {
return e(t = {
exports: {}
}, t.exports), t.exports
}
var m = i(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
}),
n = Object.prototype.toString,
a = function (e) {
return s(e) ? Object.keys(e) : []
};
function r(t, i) {
a(t).forEach(function (e) {
return i(t[e], e)
})
}
function g(i) {
for (var e = arguments.length, t = new Array(1 < e ? e - 1 : 0), n = 1; n < e; n++) t[n - 1] = arguments[n];
return Object.assign ? m.apply(void 0, [i].concat(t)) : (t.forEach(function (e) {
e && r(e, function (e, t) {
i[t] = e
})
}), i)
}
function s(e) {
return !!e && "object" == typeof e
}
function o(e) {
return s(e) && "[object Object]" === n.call(e) && e.constructor === Object
}
function u(e, t) {
if (!e || !t) return "";
if ("function" != typeof T.getComputedStyle) return "";
var i = T.getComputedStyle(e);
return i ? i.getPropertyValue(t) || i[t] : ""
}
function c(e) {
return "string" == typeof e && Boolean(e.trim())
}
function v(e) {
if (0 <= e.indexOf(" ")) throw new Error("class has illegal whitespace characters")
}
function y() {
return d === T.document
}
function _(e) {
return s(e) && 1 === e.nodeType
}
function b() {
try {
return T.parent !== T.self
} catch (e) {
return !0
}
}
function S(n) {
return function (e, t) {
if (!c(e)) return d[n](null);
c(t) && (t = d.querySelector(t));
var i = _(t) ? t : d;
return i[n] && i[n](e)
}
}
function k(e, i, t, n) {
void 0 === e && (e = "div"), void 0 === i && (i = {}), void 0 === t && (t = {});
var r = d.createElement(e);
return Object.getOwnPropertyNames(i).forEach(function (e) {
var t = i[e]; - 1 !== e.indexOf("aria-") || "role" === e || "type" === e ? (p.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set " + e + " to " + t + "."), r.setAttribute(e, t)) : "textContent" === e ? C(r, t) : r[e] !== t && (r[e] = t)
}), Object.getOwnPropertyNames(t).forEach(function (e) {
r.setAttribute(e, t[e])
}), n && H(r, n), r
}
function C(e, t) {
return "undefined" == typeof e.textContent ? e.innerText = t : e.textContent = t, e
}
function E(e, t) {
t.firstChild ? t.insertBefore(e, t.firstChild) : t.appendChild(e)
}
function w(e, t) {
return v(t), e.classList ? e.classList.contains(t) : function (e) {
return new RegExp("(^|\\s)" + e + "($|\\s)")
}(t).test(e.className)
}
function I(e, t) {
return e.classList ? e.classList.add(t) : w(e, t) || (e.className = (e.className + " " + t).trim()), e
}
function A(e, t) {
return e.classList ? e.classList.remove(t) : (v(t), e.className = e.className.split(/\s+/).filter(function (e) {
return e !== t
}).join(" ")), e
}
function x(e, t, i) {
var n = w(e, t);
if ("function" == typeof i && (i = i(e, t)), "boolean" != typeof i && (i = !n), i !== n) return i ? I(e, t) : A(e, t), e
}
function P(i, n) {
Object.getOwnPropertyNames(n).forEach(function (e) {
var t = n[e];
null === t || "undefined" == typeof t || !1 === t ? i.removeAttribute(e) : i.setAttribute(e, !0 === t ? "" : t)
})
}
function L(e) {
var t = {},
i = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
if (e && e.attributes && 0 < e.attributes.length)
for (var n = e.attributes, r = n.length - 1; 0 <= r; r--) {
var a = n[r].name,
s = n[r].value;
"boolean" != typeof e[a] && -1 === i.indexOf("," + a + ",") || (s = null !== s), t[a] = s
}
return t
}
function O(e, t) {
return e.getAttribute(t)
}
function D(e, t, i) {
e.setAttribute(t, i)
}
function M(e, t) {
e.removeAttribute(t)
}
function R() {
d.body.focus(), d.onselectstart = function () {
return !1
}
}
function N() {
d.onselectstart = function () {
return !0
}
}
function U(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(u(e, "height"))), i.width || (i.width = parseFloat(u(e, "width"))), i
}
}
function F(e) {
if (!e || e && !e.offsetParent) return {
left: 0,
top: 0,
width: 0,
height: 0
};
for (var t = e.offsetWidth, i = e.offsetHeight, n = 0, r = 0; n += e.offsetLeft, r += e.offsetTop, e = e.offsetParent;);
return {
left: n,
top: r,
width: t,
height: i
}
}
function B(e, t) {
var i = {},
n = F(t.target),
r = F(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 j(e) {
return s(e) && 3 === e.nodeType
}
function V(e) {
for (; e.firstChild;) e.removeChild(e.firstChild);
return e
}
function q(e) {
return "function" == typeof e && (e = e()), (Array.isArray(e) ? e : [e]).map(function (e) {
return "function" == typeof e && (e = e()), _(e) || j(e) ? e : "string" == typeof e && /\S/.test(e) ? d.createTextNode(e) : void 0
}).filter(function (e) {
return e
})
}
function H(t, e) {
return q(e).forEach(function (e) {
return t.appendChild(e)
}), t
}
function W(e, t) {
return H(V(e), t)
}
function z(e) {
return void 0 === e.button && void 0 === e.buttons || (0 === e.button && void 0 === e.buttons || ("mouseup" === e.type && 0 === e.button && 0 === e.buttons || 0 === e.button && 1 === e.buttons))
}
var G, X = S("querySelector"),
K = S("querySelectorAll"),
Y = Object.freeze({
__proto__: null,
isReal: y,
isEl: _,
isInFrame: b,
createEl: k,
textContent: C,
prependTo: E,
hasClass: w,
addClass: I,
removeClass: A,
toggleClass: x,
setAttributes: P,
getAttributes: L,
getAttribute: O,
setAttribute: D,
removeAttribute: M,
blockTextSelection: R,
unblockTextSelection: N,
getBoundingClientRect: U,
findPosition: F,
getPointerPosition: B,
isTextNode: j,
emptyEl: V,
normalizeContent: q,
appendContent: H,
insertContent: W,
isSingleLeftClick: z,
$: X,
$$: K
}),
$ = !1,
Q = function () {
if (y() && !1 !== G.options.autoSetup) {
var e = Array.prototype.slice.call(d.getElementsByTagName("video")),
t = Array.prototype.slice.call(d.getElementsByTagName("audio")),
i = Array.prototype.slice.call(d.getElementsByTagName("video-js")),
n = e.concat(t, i);
if (n && 0 < n.length)
for (var r = 0, a = n.length; r < a; r++) {
var s = n[r];
if (!s || !s.getAttribute) {
J(1);
break
}
void 0 === s.player && null !== s.getAttribute("data-setup") && G(s)
} else $ || J(1)
}
};
function J(e, t) {
t && (G = t), T.setTimeout(Q, e)
}
function Z() {
$ = !0, T.removeEventListener("load", Z)
}
y() && ("complete" === d.readyState ? Z() : T.addEventListener("load", Z));
function ee(e) {
var t = d.createElement("style");
return t.className = e, t
}
function te(e, t) {
e.styleSheet ? e.styleSheet.cssText = t : e.textContent = t
}
var ie, ne = 3;
function re() {
return ne++
}
T.WeakMap || (ie = function () {
function e() {
this.vdata = "vdata" + Math.floor(T.performance && T.performance.now() || Date.now()), this.data = {}
}
var t = e.prototype;
return t.set = function (e, t) {
var i = e[this.vdata] || re();
return e[this.vdata] || (e[this.vdata] = i), this.data[i] = t, this
}, t.get = function (e) {
var t = e[this.vdata];
if (t) return this.data[t];
p("We have no data for this element", e)
}, t.has = function (e) {
return e[this.vdata] in this.data
}, t.delete = function (e) {
var t = e[this.vdata];
t && (delete this.data[t], delete e[this.vdata])
}, e
}());
var ae, se = T.WeakMap ? new WeakMap : new ie;
function oe(e, t) {
if (se.has(e)) {
var i = se.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 && se.delete(e)
}
}
function ue(t, i, e, n) {
e.forEach(function (e) {
t(i, e, n)
})
}
function le(e) {
if (e.fixed_) return e;
function t() {
return !0
}
function i() {
return !1
}
if (!e || !e.isPropagationStopped) {
var n = e || T.event;
for (var r in e = {}, 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 || d), 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 = d.documentElement,
s = d.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
}
var ce = function () {
if ("boolean" != typeof ae) {
ae = !1;
try {
var e = Object.defineProperty({}, "passive", {
get: function () {
ae = !0
}
});
T.addEventListener("test", null, e), T.removeEventListener("test", null, e)
} catch (e) {}
}
return ae
},
de = ["touchstart", "touchmove"];
function he(s, e, t) {
if (Array.isArray(e)) return ue(he, s, e, t);
se.has(s) || se.set(s, {});
var o = se.get(s);
if (o.handlers || (o.handlers = {}), o.handlers[e] || (o.handlers[e] = []), t.guid || (t.guid = re()), o.handlers[e].push(t), o.dispatcher || (o.disabled = !1, o.dispatcher = function (e, t) {
if (!o.disabled) {
e = le(e);
var i = o.handlers[e.type];
if (i)
for (var n = i.slice(0), r = 0, a = n.length; r < a && !e.isImmediatePropagationStopped(); r++) try {
n[r].call(s, e, t)
} catch (e) {
p.error(e)
}
}
}), 1 === o.handlers[e].length)
if (s.addEventListener) {
var i = !1;
ce() && -1 < de.indexOf(e) && (i = {
passive: !0
}), s.addEventListener(e, o.dispatcher, i)
} else s.attachEvent && s.attachEvent("on" + e, o.dispatcher)
}
function pe(e, t, i) {
if (se.has(e)) {
var n = se.get(e);
if (n.handlers) {
if (Array.isArray(t)) return ue(pe, e, t, i);
var r = function (e, t) {
n.handlers[t] = [], oe(e, t)
};
if (void 0 !== t) {
var a = n.handlers[t];
if (a)
if (i) {
if (i.guid)
for (var s = 0; s < a.length; s++) a[s].guid === i.guid && a.splice(s--, 1);
oe(e, t)
} else r(e, t)
} else
for (var o in n.handlers) Object.prototype.hasOwnProperty.call(n.handlers || {}, o) && r(e, o)
}
}
}
function fe(e, t, i) {
var n = se.has(e) ? se.get(e) : {},
r = e.parentNode || e.ownerDocument;
if ("string" == typeof t ? t = {
type: t,
target: e
} : t.target || (t.target = e), t = le(t), n.dispatcher && n.dispatcher.call(e, t, i), r && !t.isPropagationStopped() && !0 === t.bubbles) fe.call(null, r, t, i);
else if (!r && !t.defaultPrevented && t.target && t.target[t.type]) {
se.has(t.target) || se.set(t.target, {});
var a = se.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 me(e, t, i) {
if (Array.isArray(t)) return ue(me, e, t, i);
function n() {
pe(e, t, n), i.apply(this, arguments)
}
n.guid = i.guid = i.guid || re(), he(e, t, n)
}
function ge(e, t, i) {
function n() {
pe(e, t, n), i.apply(this, arguments)
}
n.guid = i.guid = i.guid || re(), he(e, t, n)
}
function ve(e, t, i) {
t.guid || (t.guid = re());
var n = t.bind(e);
return n.guid = i ? i + "_" + t.guid : t.guid, n
}
function ye(t, i) {
var n = T.performance.now();
return function () {
var e = T.performance.now();
i <= e - n && (t.apply(void 0, arguments), n = e)
}
}
function _e() {}
var be, Te = Object.freeze({
__proto__: null,
fixEvent: le,
on: he,
off: pe,
trigger: fe,
one: me,
any: ge
});
_e.prototype.allowedEvents_ = {}, _e.prototype.addEventListener = _e.prototype.on = function (e, t) {
var i = this.addEventListener;
this.addEventListener = function () {}, he(this, e, t), this.addEventListener = i
}, _e.prototype.removeEventListener = _e.prototype.off = function (e, t) {
pe(this, e, t)
}, _e.prototype.one = function (e, t) {
var i = this.addEventListener;
this.addEventListener = function () {}, me(this, e, t), this.addEventListener = i
}, _e.prototype.any = function (e, t) {
var i = this.addEventListener;
this.addEventListener = function () {}, ge(this, e, t), this.addEventListener = i
}, _e.prototype.dispatchEvent = _e.prototype.trigger = function (e) {
var t = e.type || e;
"string" == typeof e && (e = {
type: t
}), e = le(e), this.allowedEvents_[t] && this["on" + t] && this["on" + t](e), fe(this, e)
}, _e.prototype.queueTrigger = function (e) {
var t = this;
be = be || new Map;
var i = e.type || e,
n = be.get(this);
n || (n = new Map, be.set(this, n));
var r = n.get(i);
n.delete(i), T.clearTimeout(r);
var a = T.setTimeout(function () {
0 === n.size && (n = null, be.delete(t)), t.trigger(e)
}, 0);
n.set(i, a)
};
function Se(e) {
return "string" == typeof e && /\S/.test(e) || Array.isArray(e) && !!e.length
}
function ke(e) {
if (!e.nodeName && !Ae(e)) throw new Error("Invalid target; must be a DOM node or evented object.")
}
function Ce(e) {
if (!Se(e)) throw new Error("Invalid event type; must be a non-empty string or array.")
}
function Ee(e) {
if ("function" != typeof e) throw new Error("Invalid listener; must be a function.")
}
function we(e, t) {
var i, n, r, a = t.length < 3 || t[0] === e || t[0] === e.eventBusEl_;
return r = a ? (i = e.eventBusEl_, 3 <= t.length && t.shift(), n = t[0], t[1]) : (i = t[0], n = t[1], t[2]), ke(i), Ce(n), Ee(r), {
isTargetingSelf: a,
target: i,
type: n,
listener: r = ve(e, r)
}
}
function Ie(e, t, i, n) {
ke(e), e.nodeName ? Te[t](e, i, n) : e[t](i, n)
}
var Ae = function (t) {
return t instanceof _e || !!t.eventBusEl_ && ["on", "one", "off", "trigger"].every(function (e) {
return "function" == typeof t[e]
})
},
xe = {
on: function () {
for (var e = this, t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
var r = we(this, i),
a = r.isTargetingSelf,
s = r.target,
o = r.type,
u = r.listener;
if (Ie(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, Ie(this, "on", "dispose", l), Ie(s, "on", "dispose", c)
}
},
one: function () {
for (var r = this, e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
var n = we(this, t),
a = n.isTargetingSelf,
s = n.target,
o = n.type,
u = n.listener;
if (a) Ie(s, "one", o, u);
else {
var l = function e() {
r.off(s, o, e);
for (var t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
u.apply(null, i)
};
l.guid = u.guid, Ie(s, "one", o, l)
}
},
any: function () {
for (var r = this, e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
var n = we(this, t),
a = n.isTargetingSelf,
s = n.target,
o = n.type,
u = n.listener;
if (a) Ie(s, "any", o, u);
else {
var l = function e() {
r.off(s, o, e);
for (var t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
u.apply(null, i)
};
l.guid = u.guid, Ie(s, "any", o, l)
}
},
off: function (e, t, i) {
if (!e || Se(e)) pe(this.eventBusEl_, e, t);
else {
var n = e,
r = t;
ke(n), Ce(r), Ee(i), i = ve(this, i), this.off("dispose", i), n.nodeName ? (pe(n, r, i), pe(n, "dispose", i)) : Ae(n) && (n.off(r, i), n.off("dispose", i))
}
},
trigger: function (e, t) {
return fe(this.eventBusEl_, e, t)
}
};
function Pe(e, t) {
void 0 === t && (t = {});
var i = t.eventBusKey;
if (i) {
if (!e[i].nodeName) throw new Error('The eventBusKey "' + i + '" does not refer to an element.');
e.eventBusEl_ = e[i]
} else e.eventBusEl_ = k("span", {
className: "vjs-event-bus"
});
return g(e, xe), e.eventedCallbacks && e.eventedCallbacks.forEach(function (e) {
e()
}), e.on("dispose", function () {
e.off(), T.setTimeout(function () {
e.eventBusEl_ = null
}, 0)
}), e
}
var Le = {
state: {},
setState: function (e) {
var i, n = this;
return "function" == typeof e && (e = e()), r(e, function (e, t) {
n.state[t] !== e && ((i = i || {})[t] = {
from: n.state[t],
to: e
}), n.state[t] = e
}), i && Ae(this) && this.trigger({
changes: i,
type: "statechanged"
}), i
}
};
function Oe(e, t) {
return g(e, Le), e.state = g({}, e.state, t), "function" == typeof e.handleStateChanged && Ae(e) && e.on("statechanged", e.handleStateChanged), e
}
function De(e) {
return "string" != typeof e ? e : e.replace(/./, function (e) {
return e.toLowerCase()
})
}
function Me(e) {
return "string" != typeof e ? e : e.replace(/./, function (e) {
return e.toUpperCase()
})
}
function Re() {
for (var i = {}, e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return t.forEach(function (e) {
e && r(e, function (e, t) {
o(e) ? (o(i[t]) || (i[t] = {}), i[t] = Re(i[t], e)) : i[t] = e
})
}), i
}
var Ne = 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
}(),
Ue = T.Map ? T.Map : Ne,
Fe = 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
}(),
Be = T.Set ? T.Set : Fe,
je = function () {
function l(e, t, i) {
if (!e && this.play ? this.player_ = e = this : this.player_ = e, this.isDisposed_ = !1, this.parentComponent_ = null, this.options_ = Re({}, this.options_), t = this.options_ = Re(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_" + re()
}
this.name_ = t.name || null, t.el ? this.el_ = t.el : !1 !== t.createEl && (this.el_ = this.createEl()), !1 !== t.evented && Pe(this, {
eventBusKey: this.el_ ? "el_" : null
}), Oe(this, this.constructor.defaultState), this.children_ = [], this.childIndex_ = {}, this.childNameIndex_ = {}, this.setTimeoutIds_ = new Be, this.setIntervalIds_ = new Be, this.rafIds_ = new Be, this.namedRafs_ = new Ue, (this.clearingTimersOnDispose_ = !1) !== t.initChildren && this.initChildren(), this.ready(i), !1 !== t.reportTouchActivity && this.enableTouchActivity()
}
var e = l.prototype;
return e.dispose = function () {
if (!this.isDisposed_) {
if (this.trigger({
type: "dispose",
bubbles: !1
}), this.isDisposed_ = !0, this.children_)
for (var e = this.children_.length - 1; 0 <= e; 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_), se.has(this.el_) && se.delete(this.el_), this.el_ = null), this.player_ = null
}
}, e.isDisposed = function () {
return Boolean(this.isDisposed_)
}, e.player = function () {
return this.player_
}, e.options = function (e) {
return e && (this.options_ = Re(this.options_, e)), this.options_
}, e.el = function () {
return this.el_
}, e.createEl = function (e, t, i) {
return k(e, t, i)
}, e.localize = function (e, r, t) {
void 0 === t && (t = e);
var i = this.player_.language && this.player_.language(),
n = this.player_.languages && this.player_.languages(),
a = n && n[i],
s = i && i.split("-")[0],
o = n && n[s],
u = t;
return a && a[e] ? u = a[e] : o && o[e] && (u = o[e]), r && (u = u.replace(/\{(\d+)\}/g, function (e, t) {
var i = r[t - 1],
n = i;
return "undefined" == typeof i && (n = e), n
})), u
}, e.contentEl = function () {
return this.contentEl_ || this.el_
}, e.id = function () {
return this.id_
}, e.name = function () {
return this.name_
}, e.children = function () {
return this.children_
}, e.getChildById = function (e) {
return this.childIndex_[e]
}, e.getChild = function (e) {
if (e) return this.childNameIndex_[e]
}, e.getDescendant = function () {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; 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.getChild) return;
return n
}, e.addChild = function (e, t, i) {
var n, r;
if (void 0 === t && (t = {}), void 0 === i && (i = this.children_.length), "string" == typeof e) {
r = Me(e);
var a = t.componentClass || r;
t.name = r;
var s = l.getComponent(a);
if (!s) throw new Error("Component " + a + " does not exist");
if ("function" != typeof s) return null;
n = new s(this.player_ || this, t)
} else n = e;
if (n.parentComponent_ && n.parentComponent_.removeChild(n), this.children_.splice(i, 0, n), n.parentComponent_ = this, "function" == typeof n.id && (this.childIndex_[n.id()] = n), (r = r || n.name && Me(n.name())) && (this.childNameIndex_[r] = n, this.childNameIndex_[De(r)] = n), "function" == typeof n.el && n.el()) {
var o = null;
this.children_[i + 1] && (this.children_[i + 1].el_ ? o = this.children_[i + 1].el_ : _(this.children_[i + 1]) && (o = this.children_[i + 1])), this.contentEl().insertBefore(n.el(), o)
}
return n
}, e.removeChild = function (e) {
if ("string" == typeof e && (e = this.getChild(e)), e && this.children_) {
for (var t = !1, i = this.children_.length - 1; 0 <= i; 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_[Me(e.name())] = null, this.childNameIndex_[De(e.name())] = null;
var n = e.el();
n && n.parentNode === this.contentEl() && this.contentEl().removeChild(e.el())
}
}
}, e.initChildren = function () {
var r = this,
n = this.options_.children;
if (n) {
var e, a = this.options_,
i = l.getComponent("Tech");
(e = Array.isArray(n) ? n : Object.keys(n)).concat(Object.keys(this.options_).filter(function (t) {
return !e.some(function (e) {
return "string" == typeof e ? t === e : t === e.name
})
})).map(function (e) {
var t, i;
return i = "string" == typeof e ? n[t = e] || r.options_[t] || {} : (t = e.name, e), {
name: t,
opts: i
}
}).filter(function (e) {
var t = l.getComponent(e.opts.componentClass || Me(e.name));
return t && !i.isTech(t)
}).forEach(function (e) {
var t = e.name,
i = e.opts;
if (void 0 !== a[t] && (i = a[t]), !1 !== i) {
!0 === i && (i = {}), i.playerOptions = r.options_.playerOptions;
var n = r.addChild(t, i);
n && (r[t] = n)
}
})
}
}, e.buildCSSClass = function () {
return ""
}, e.ready = function (e, t) {
if (void 0 === t && (t = !1), e) return this.isReady_ ? void(t ? e.call(this) : this.setTimeout(e, 1)) : (this.readyQueue_ = this.readyQueue_ || [], void this.readyQueue_.push(e))
}, e.triggerReady = function () {
this.isReady_ = !0, this.setTimeout(function () {
var e = this.readyQueue_;
this.readyQueue_ = [], e && 0 < e.length && e.forEach(function (e) {
e.call(this)
}, this), this.trigger("ready")
}, 1)
}, e.$ = function (e, t) {
return X(e, t || this.contentEl())
}, e.$$ = function (e, t) {
return K(e, t || this.contentEl())
}, e.hasClass = function (e) {
return w(this.el_, e)
}, e.addClass = function (e) {
I(this.el_, e)
}, e.removeClass = function (e) {
A(this.el_, e)
}, e.toggleClass = function (e, t) {
x(this.el_, e, t)
}, e.show = function () {
this.removeClass("vjs-hidden")
}, e.hide = function () {
this.addClass("vjs-hidden")
}, e.lockShowing = function () {
this.addClass("vjs-lock-showing")
}, e.unlockShowing = function () {
this.removeClass("vjs-lock-showing")
}, e.getAttribute = function (e) {
return O(this.el_, e)
}, e.setAttribute = function (e, t) {
D(this.el_, e, t)
}, e.removeAttribute = function (e) {
M(this.el_, e)
}, e.width = function (e, t) {
return this.dimension("width", e, t)
}, e.height = function (e, t) {
return this.dimension("height", e, t)
}, e.dimensions = function (e, t) {
this.width(e, !0), this.height(t)
}, e.dimension = function (e, t, i) {
if (void 0 !== t) return null !== t && t == t || (t = 0), -1 !== ("" + t).indexOf("%") || -1 !== ("" + t).indexOf("px") ? this.el_.style[e] = t : this.el_.style[e] = "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" + Me(e)], 10)
}, e.currentDimension = function (e) {
var t = 0;
if ("width" !== e && "height" !== e) throw new Error("currentDimension only accepts width or height value");
if (t = u(this.el_, e), 0 === (t = parseFloat(t)) || isNaN(t)) {
var i = "offset" + Me(e);
t = this.el_[i]
}
return t
}, e.currentDimensions = function () {
return {
width: this.currentDimension("width"),
height: this.currentDimension("height")
}
}, e.currentWidth = function () {
return this.currentDimension("width")
}, e.currentHeight = function () {
return this.currentDimension("height")
}, e.focus = function () {
this.el_.focus()
}, e.blur = function () {
this.el_.blur()
}, e.handleKeyDown = function (e) {
this.player_ && (e.stopPropagation(), this.player_.handleKeyDown(e))
}, e.handleKeyPress = function (e) {
this.handleKeyDown(e)
}, e.emitTapEvents = function () {
var n, t = 0,
r = null;
this.on("touchstart", function (e) {
1 === e.touches.length && (r = {
pageX: e.touches[0].pageX,
pageY: e.touches[0].pageY
}, t = T.performance.now(), n = !0)
}), this.on("touchmove", function (e) {
if (1 < e.touches.length) n = !1;
else if (r) {
var t = e.touches[0].pageX - r.pageX,
i = e.touches[0].pageY - r.pageY;
10 < Math.sqrt(t * t + i * i) && (n = !1)
}
});
function e() {
n = !1
}
this.on("touchleave", e), this.on("touchcancel", e), this.on("touchend", function (e) {
!(r = null) === n && T.performance.now() - t < 200 && (e.preventDefault(), this.trigger("tap"))
})
}, e.enableTouchActivity = function () {
if (this.player() && this.player().reportUserActivity) {
var t, i = ve(this.player(), this.player().reportUserActivity);
this.on("touchstart", function () {
i(), this.clearInterval(t), t = this.setInterval(i, 250)
});
var e = function (e) {
i(), this.clearInterval(t)
};
this.on("touchmove", i), this.on("touchend", e), this.on("touchcancel", e)
}
}, e.setTimeout = function (e, t) {
var i, n = this;
return e = ve(this, e), this.clearTimersOnDispose_(), i = T.setTimeout(function () {
n.setTimeoutIds_.has(i) && n.setTimeoutIds_.delete(i), e()
}, t), this.setTimeoutIds_.add(i), i
}, e.clearTimeout = function (e) {
return this.setTimeoutIds_.has(e) && (this.setTimeoutIds_.delete(e), T.clearTimeout(e)), e
}, e.setInterval = function (e, t) {
e = ve(this, e), this.clearTimersOnDispose_();
var i = T.setInterval(e, t);
return this.setIntervalIds_.add(i), i
}, e.clearInterval = function (e) {
return this.setIntervalIds_.has(e) && (this.setIntervalIds_.delete(e), T.clearInterval(e)), e
}, e.requestAnimationFrame = function (e) {
var t, i = this;
return this.supportsRaf_ ? (this.clearTimersOnDispose_(), e = ve(this, e), t = T.requestAnimationFrame(function () {
i.rafIds_.has(t) && i.rafIds_.delete(t), e()
}), this.rafIds_.add(t), t) : this.setTimeout(e, 1e3 / 60)
}, e.requestNamedAnimationFrame = function (e, t) {
var i = this;
if (!this.namedRafs_.has(e)) {
this.clearTimersOnDispose_(), t = ve(this, t);
var n = this.requestAnimationFrame(function () {
t(), i.namedRafs_.has(e) && i.namedRafs_.delete(e)
});
return this.namedRafs_.set(e, n), e
}
}, e.cancelNamedAnimationFrame = function (e) {
this.namedRafs_.has(e) && (this.cancelAnimationFrame(this.namedRafs_.get(e)), this.namedRafs_.delete(e))
}, e.cancelAnimationFrame = function (e) {
return this.supportsRaf_ ? (this.rafIds_.has(e) && (this.rafIds_.delete(e), T.cancelAnimationFrame(e)), e) : this.clearTimeout(e)
}, e.clearTimersOnDispose_ = function () {
var n = this;
this.clearingTimersOnDispose_ || (this.clearingTimersOnDispose_ = !0, this.one("dispose", function () {
[
["namedRafs_", "cancelNamedAnimationFrame"],
["rafIds_", "cancelAnimationFrame"],
["setTimeoutIds_", "clearTimeout"],
["setIntervalIds_", "clearInterval"]
].forEach(function (e) {
var t = e[0],
i = e[1];
n[t].forEach(function (e, t) {
return n[i](t)
})
}), n.clearingTimersOnDispose_ = !1
}))
}, l.registerComponent = function (e, t) {
if ("string" != typeof e || !e) throw new Error('Illegal component name, "' + e + '"; must be a non-empty string.');
var i, n = l.getComponent("Tech"),
r = n && n.isTech(t),
a = l === t || l.prototype.isPrototypeOf(t.prototype);
if (r || !a) throw i = r ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass", new Error('Illegal component, "' + e + '"; ' + i + ".");
e = Me(e), l.components_ || (l.components_ = {});
var s = l.getComponent("Player");
if ("Player" === e && s && s.players) {
var o = s.players,
u = Object.keys(o);
if (o && 0 < u.length && u.map(function (e) {
return o[e]
}).every(Boolean)) throw new Error("Can not register Player component after player has been created.")
}
return l.components_[e] = t, l.components_[De(e)] = t
}, l.getComponent = function (e) {
if (e && l.components_) return l.components_[e]
}, l
}();
je.prototype.supportsRaf_ = "function" == typeof T.requestAnimationFrame && "function" == typeof T.cancelAnimationFrame, je.registerComponent("Component", je);
var Ve = function (e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
};
i(function (t) {
function i(e) {
return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? t.exports = i = function (e) {
return typeof e
} : t.exports = i = function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
}, i(e)
}
t.exports = i
}), i(function (t) {
function i(e) {
return t.exports = i = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}, i(e)
}
t.exports = i
});
var qe, He, We, ze, Ge = function (e, t) {
e.prototype = Object.create(t.prototype), (e.prototype.constructor = e).__proto__ = t
},
Xe = T.navigator && T.navigator.userAgent || "",
Ke = /AppleWebKit\/([\d.]+)/i.exec(Xe),
Ye = Ke ? parseFloat(Ke.pop()) : null,
$e = /iPod/i.test(Xe),
Qe = (qe = Xe.match(/OS (\d+)_/i)) && qe[1] ? qe[1] : null,
Je = /Android/i.test(Xe),
Ze = function () {
var e = Xe.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 || null
}(),
et = Je && Ze < 5 && Ye < 537,
tt = /Firefox/i.test(Xe),
it = /Edg/i.test(Xe),
nt = !it && (/Chrome/i.test(Xe) || /CriOS/i.test(Xe)),
rt = (He = Xe.match(/(Chrome|CriOS)\/(\d+)/)) && He[2] ? parseFloat(He[2]) : null,
at = (We = /MSIE\s(\d+)\.\d/.exec(Xe), !(ze = We && parseFloat(We[1])) && /Trident\/7.0/i.test(Xe) && /rv:11.0/.test(Xe) && (ze = 11), ze),
st = /Safari/i.test(Xe) && !nt && !Je && !it,
ot = /Windows/i.test(Xe),
ut = y() && ("ontouchstart" in T || T.navigator.maxTouchPoints || T.DocumentTouch && T.document instanceof T.DocumentTouch),
lt = /iPad/i.test(Xe) || st && ut && !/iPhone/i.test(Xe),
ct = /iPhone/i.test(Xe) && !lt,
dt = ct || lt || $e,
ht = (st || dt) && !nt,
pt = Object.freeze({
__proto__: null,
IS_IPOD: $e,
IOS_VERSION: Qe,
IS_ANDROID: Je,
ANDROID_VERSION: Ze,
IS_NATIVE_ANDROID: et,
IS_FIREFOX: tt,
IS_EDGE: it,
IS_CHROME: nt,
CHROME_VERSION: rt,
IE_VERSION: at,
IS_SAFARI: st,
IS_WINDOWS: ot,
TOUCH_ENABLED: ut,
IS_IPAD: lt,
IS_IPHONE: ct,
IS_IOS: dt,
IS_ANY_SAFARI: ht
});
function ft(e, t, i, n) {
return function (e, t, i) {
if ("number" != typeof t || t < 0 || i < t) throw new Error("Failed to execute '" + e + "' on 'TimeRanges': The index provided (" + t + ") is non-numeric or out of bounds (0-" + i + ").")
}(e, n, i.length - 1), i[n][t]
}
function mt(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: ft.bind(null, "start", 0, e),
end: ft.bind(null, "end", 1, e)
}
}
function gt(e, t) {
return Array.isArray(e) ? mt(e) : void 0 === e || void 0 === t ? mt() : mt([
[e, t]
])
}
function vt(e, t) {
var i, n, r = 0;
if (!t) return 0;
e && e.length || (e = gt(0, 0));
for (var a = 0; a < e.length; a++) i = e.start(a), t < (n = e.end(a)) && (n = t), r += n - i;
return r / t
}
for (var yt, _t = {
prefixed: !0
}, bt = [
["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"]
], Tt = bt[0], St = 0; St < bt.length; St++)
if (bt[St][1] in d) {
yt = bt[St];
break
} if (yt) {
for (var kt = 0; kt < yt.length; kt++) _t[Tt[kt]] = yt[kt];
_t.prefixed = yt[0] !== Tt[0]
}
function Ct(e) {
if (e instanceof Ct) return e;
"number" == typeof e ? this.code = e : "string" == typeof e ? this.message = e : s(e) && ("number" == typeof e.code && (this.code = e.code), g(this, e)), this.message || (this.message = Ct.defaultMessages[this.code] || "")
}
Ct.prototype.code = 0, Ct.prototype.message = "", Ct.prototype.status = null, Ct.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"], Ct.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 Et = 0; Et < Ct.errorTypes.length; Et++) Ct[Ct.errorTypes[Et]] = Et, Ct.prototype[Ct.errorTypes[Et]] = Et;
var wt = function (e, t) {
var i, n = null;
try {
i = JSON.parse(e, t)
} catch (e) {
n = e
}
return [n, i]
};
function It(e) {
return null != e && "function" == typeof e.then
}
function At(e) {
It(e) && e.then(null, function (e) {})
}
function xt(n) {
return ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function (e, t, i) {
return n[t] && (e[t] = n[t]), e
}, {
cues: n.cues && Array.prototype.map.call(n.cues, function (e) {
return {
startTime: e.startTime,
endTime: e.endTime,
text: e.text,
id: e.id
}
})
})
}
var Pt = function (e) {
var t = e.$$("track"),
i = Array.prototype.map.call(t, function (e) {
return e.track
});
return Array.prototype.map.call(t, function (e) {
var t = xt(e.track);
return e.src && (t.src = e.src), t