@webitel/ui-sdk 25.12.22 → 25.12.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{install-BATb8us8.js → install-Dlm9F6VX.js} +32241 -31437
- package/dist/plyr-C2xH9S2_.js +4350 -0
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +1 -1
- package/dist/ui-sdk.umd.cjs +1454 -1359
- package/dist/{vidstack-Bq6c3Bam-B5h_x9kk.js → vidstack-Bq6c3Bam-LBg_N7NA.js} +29 -29
- package/dist/{vidstack-D2pY00kU-BI2LQ2NB.js → vidstack-D2pY00kU-B54jdjLZ.js} +18 -18
- package/dist/{vidstack-DDXt6fpN-KOmbhUFP.js → vidstack-DDXt6fpN-0R_qWhr7.js} +3 -3
- package/dist/{vidstack-D_-9AA6_-CKab151b.js → vidstack-D_-9AA6_-C20rEPA8.js} +1 -1
- package/dist/{vidstack-DqAw8m9J-CD09gN1L.js → vidstack-DqAw8m9J-BVoQCcQn.js} +7 -7
- package/dist/{vidstack-audio-CP_4Jlp4.js → vidstack-audio-CVUfqXtN.js} +2 -2
- package/dist/{vidstack-dash-Bi85pjuL.js → vidstack-dash-DH1tKEgp.js} +3 -3
- package/dist/{vidstack-google-cast-D6oB7NQl.js → vidstack-google-cast-Chb7A1N-.js} +33 -33
- package/dist/{vidstack-hls-Cz-PODGP.js → vidstack-hls-isJ6fzIa.js} +3 -3
- package/dist/{vidstack-video-CUY9WLHu.js → vidstack-video-Oj0vav_S.js} +12 -12
- package/dist/{vidstack-vimeo-DHTBZNH2.js → vidstack-vimeo-t7YlxjO1.js} +18 -18
- package/dist/{vidstack-youtube-MY6oQlln.js → vidstack-youtube-Dx4AYrj5.js} +22 -22
- package/package.json +4 -4
- package/src/install.ts +1 -1
- package/types/api/clients/media/media.d.ts +3 -3
- package/types/components/on-demand/wt-display-chip-items/wt-display-chip-items.vue.d.ts +2 -14
- package/types/components/on-demand/wt-selection-popup/wt-selection-popup.vue.d.ts +1 -0
- package/types/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue.d.ts +2 -55
- package/types/components/wt-action-bar/wt-action-bar.vue.d.ts +2 -0
- package/types/components/wt-badge/wt-badge.vue.d.ts +1 -1
- package/types/components/wt-button/wt-button.vue.d.ts +2 -48
- package/types/components/wt-checkbox/wt-checkbox.vue.d.ts +2 -27
- package/types/components/wt-chip/wt-chip.vue.d.ts +2 -7
- package/types/components/wt-confirm-dialog/wt-confirm-dialog.vue.d.ts +1 -0
- package/types/components/wt-context-menu/wt-context-menu.vue.d.ts +1 -0
- package/types/components/wt-datepicker/wt-datepicker.vue.d.ts +4 -4
- package/types/components/wt-dual-panel/wt-dual-panel.vue.d.ts +3 -0
- package/types/components/wt-empty/wt-empty.vue.d.ts +7 -0
- package/types/components/wt-expansion-panel/wt-expansion-panel.vue.d.ts +2 -0
- package/types/components/wt-image/wt-image.vue.d.ts +2 -17
- package/types/components/wt-input/wt-input.vue.d.ts +4 -52
- package/types/components/wt-label/wt-label.vue.d.ts +2 -4
- package/types/components/wt-page-header/wt-page-header.vue.d.ts +3 -0
- package/types/components/wt-pagination/wt-pagination.vue.d.ts +1 -1
- package/types/components/wt-popover/wt-popover.vue.d.ts +2 -32
- package/types/components/wt-radio/wt-radio.vue.d.ts +2 -22
- package/types/components/wt-search-bar/wt-search-bar.vue.d.ts +2 -97
- package/types/components/wt-select/wt-select.vue.d.ts +4 -1
- package/types/components/wt-slider/wt-slider.vue.d.ts +1 -1
- package/types/components/wt-stepper/wt-stepper.vue.d.ts +1 -0
- package/types/components/wt-switcher/wt-switcher.vue.d.ts +2 -20
- package/types/components/wt-table/wt-table.vue.d.ts +2 -88
- package/types/components/wt-tags-input/wt-tags-input.vue.d.ts +4 -1
- package/types/components/wt-textarea/wt-textarea.vue.d.ts +4 -48
- package/types/components/wt-tooltip/wt-tooltip.vue.d.ts +1 -0
- package/types/components/wt-tree-table/wt-tree-table.vue.d.ts +2 -34
- package/types/components/wt-tree-table-row/wt-tree-table-row.vue.d.ts +2 -30
- package/types/install.d.ts +1 -1
- package/types/modules/Userinfo/api/userinfo.d.ts +1 -1
- package/types/modules/Userinfo/v2/api/UserinfoAPI.d.ts +1 -1
- package/dist/plyr.min-BRLz1cd6.js +0 -2260
|
@@ -1,2260 +0,0 @@
|
|
|
1
|
-
function m(e, i, t) {
|
|
2
|
-
return (i = pt(i)) in e ? Object.defineProperty(e, i, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[i] = t, e;
|
|
3
|
-
}
|
|
4
|
-
function mt(e, i) {
|
|
5
|
-
if (typeof e != "object" || e === null) return e;
|
|
6
|
-
var t = e[Symbol.toPrimitive];
|
|
7
|
-
if (t !== void 0) {
|
|
8
|
-
var s = t.call(e, i);
|
|
9
|
-
if (typeof s != "object") return s;
|
|
10
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
-
}
|
|
12
|
-
return (i === "string" ? String : Number)(e);
|
|
13
|
-
}
|
|
14
|
-
function pt(e) {
|
|
15
|
-
var i = mt(e, "string");
|
|
16
|
-
return typeof i == "symbol" ? i : String(i);
|
|
17
|
-
}
|
|
18
|
-
function gt(e, i) {
|
|
19
|
-
if (!(e instanceof i)) throw new TypeError("Cannot call a class as a function");
|
|
20
|
-
}
|
|
21
|
-
function Ie(e, i) {
|
|
22
|
-
for (var t = 0; t < i.length; t++) {
|
|
23
|
-
var s = i[t];
|
|
24
|
-
s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, s.key, s);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function ft(e, i, t) {
|
|
28
|
-
return i && Ie(e.prototype, i), t && Ie(e, t), e;
|
|
29
|
-
}
|
|
30
|
-
function yt(e, i, t) {
|
|
31
|
-
return i in e ? Object.defineProperty(e, i, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[i] = t, e;
|
|
32
|
-
}
|
|
33
|
-
function $e(e, i) {
|
|
34
|
-
var t = Object.keys(e);
|
|
35
|
-
if (Object.getOwnPropertySymbols) {
|
|
36
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
37
|
-
i && (s = s.filter(function(n) {
|
|
38
|
-
return Object.getOwnPropertyDescriptor(e, n).enumerable;
|
|
39
|
-
})), t.push.apply(t, s);
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
42
|
-
}
|
|
43
|
-
function Oe(e) {
|
|
44
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
-
var t = arguments[i] != null ? arguments[i] : {};
|
|
46
|
-
i % 2 ? $e(Object(t), !0).forEach(function(s) {
|
|
47
|
-
yt(e, s, t[s]);
|
|
48
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : $e(Object(t)).forEach(function(s) {
|
|
49
|
-
Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(t, s));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return e;
|
|
53
|
-
}
|
|
54
|
-
var _e = { addCSS: !0, thumbWidth: 15, watch: !0 };
|
|
55
|
-
function bt(e, i) {
|
|
56
|
-
return (function() {
|
|
57
|
-
return Array.from(document.querySelectorAll(i)).includes(this);
|
|
58
|
-
}).call(e, i);
|
|
59
|
-
}
|
|
60
|
-
function vt(e, i) {
|
|
61
|
-
if (e && i) {
|
|
62
|
-
var t = new Event(i, { bubbles: !0 });
|
|
63
|
-
e.dispatchEvent(t);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
var te = function(e) {
|
|
67
|
-
return e != null ? e.constructor : null;
|
|
68
|
-
}, Se = function(e, i) {
|
|
69
|
-
return !!(e && i && e instanceof i);
|
|
70
|
-
}, Ve = function(e) {
|
|
71
|
-
return e == null;
|
|
72
|
-
}, Fe = function(e) {
|
|
73
|
-
return te(e) === Object;
|
|
74
|
-
}, wt = function(e) {
|
|
75
|
-
return te(e) === Number && !Number.isNaN(e);
|
|
76
|
-
}, Ue = function(e) {
|
|
77
|
-
return te(e) === String;
|
|
78
|
-
}, kt = function(e) {
|
|
79
|
-
return te(e) === Boolean;
|
|
80
|
-
}, Tt = function(e) {
|
|
81
|
-
return te(e) === Function;
|
|
82
|
-
}, Be = function(e) {
|
|
83
|
-
return Array.isArray(e);
|
|
84
|
-
}, We = function(e) {
|
|
85
|
-
return Se(e, NodeList);
|
|
86
|
-
}, Ct = function(e) {
|
|
87
|
-
return Se(e, Element);
|
|
88
|
-
}, At = function(e) {
|
|
89
|
-
return Se(e, Event);
|
|
90
|
-
}, Et = function(e) {
|
|
91
|
-
return Ve(e) || (Ue(e) || Be(e) || We(e)) && !e.length || Fe(e) && !Object.keys(e).length;
|
|
92
|
-
}, _ = { nullOrUndefined: Ve, object: Fe, number: wt, string: Ue, boolean: kt, function: Tt, array: Be, nodeList: We, element: Ct, event: At, empty: Et };
|
|
93
|
-
function St(e) {
|
|
94
|
-
var i = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
|
|
95
|
-
return i ? Math.max(0, (i[1] ? i[1].length : 0) - (i[2] ? +i[2] : 0)) : 0;
|
|
96
|
-
}
|
|
97
|
-
function Pt(e, i) {
|
|
98
|
-
if (1 > i) {
|
|
99
|
-
var t = St(i);
|
|
100
|
-
return parseFloat(e.toFixed(t));
|
|
101
|
-
}
|
|
102
|
-
return Math.round(e / i) * i;
|
|
103
|
-
}
|
|
104
|
-
var Mt = function() {
|
|
105
|
-
function e(i, t) {
|
|
106
|
-
gt(this, e), _.element(i) ? this.element = i : _.string(i) && (this.element = document.querySelector(i)), _.element(this.element) && _.empty(this.element.rangeTouch) && (this.config = Oe({}, _e, {}, t), this.init());
|
|
107
|
-
}
|
|
108
|
-
return ft(e, [{ key: "init", value: function() {
|
|
109
|
-
e.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
|
|
110
|
-
} }, { key: "destroy", value: function() {
|
|
111
|
-
e.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
|
|
112
|
-
} }, { key: "listeners", value: function(i) {
|
|
113
|
-
var t = this, s = i ? "addEventListener" : "removeEventListener";
|
|
114
|
-
["touchstart", "touchmove", "touchend"].forEach(function(n) {
|
|
115
|
-
t.element[s](n, function(a) {
|
|
116
|
-
return t.set(a);
|
|
117
|
-
}, !1);
|
|
118
|
-
});
|
|
119
|
-
} }, { key: "get", value: function(i) {
|
|
120
|
-
if (!e.enabled || !_.event(i)) return null;
|
|
121
|
-
var t, s = i.target, n = i.changedTouches[0], a = parseFloat(s.getAttribute("min")) || 0, l = parseFloat(s.getAttribute("max")) || 100, o = parseFloat(s.getAttribute("step")) || 1, c = s.getBoundingClientRect(), u = 100 / c.width * (this.config.thumbWidth / 2) / 100;
|
|
122
|
-
return 0 > (t = 100 / c.width * (n.clientX - c.left)) ? t = 0 : 100 < t && (t = 100), 50 > t ? t -= (100 - 2 * t) * u : 50 < t && (t += 2 * (t - 50) * u), a + Pt(t / 100 * (l - a), o);
|
|
123
|
-
} }, { key: "set", value: function(i) {
|
|
124
|
-
e.enabled && _.event(i) && !i.target.disabled && (i.preventDefault(), i.target.value = this.get(i), vt(i.target, i.type === "touchend" ? "change" : "input"));
|
|
125
|
-
} }], [{ key: "setup", value: function(i) {
|
|
126
|
-
var t = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : {}, s = null;
|
|
127
|
-
if (_.empty(i) || _.string(i) ? s = Array.from(document.querySelectorAll(_.string(i) ? i : 'input[type="range"]')) : _.element(i) ? s = [i] : _.nodeList(i) ? s = Array.from(i) : _.array(i) && (s = i.filter(_.element)), _.empty(s)) return null;
|
|
128
|
-
var n = Oe({}, _e, {}, t);
|
|
129
|
-
if (_.string(i) && n.watch) {
|
|
130
|
-
var a = new MutationObserver(function(l) {
|
|
131
|
-
Array.from(l).forEach(function(o) {
|
|
132
|
-
Array.from(o.addedNodes).forEach(function(c) {
|
|
133
|
-
_.element(c) && bt(c, i) && new e(c, n);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
a.observe(document.body, { childList: !0, subtree: !0 });
|
|
138
|
-
}
|
|
139
|
-
return s.map(function(l) {
|
|
140
|
-
return new e(l, t);
|
|
141
|
-
});
|
|
142
|
-
} }, { key: "enabled", get: function() {
|
|
143
|
-
return "ontouchstart" in document.documentElement;
|
|
144
|
-
} }]), e;
|
|
145
|
-
}();
|
|
146
|
-
const ie = (e) => e != null ? e.constructor : null, U = (e, i) => !!(e && i && e instanceof i), Pe = (e) => e == null, ze = (e) => ie(e) === Object, Nt = (e) => ie(e) === Number && !Number.isNaN(e), de = (e) => ie(e) === String, xt = (e) => ie(e) === Boolean, Ke = (e) => typeof e == "function", Ye = (e) => Array.isArray(e), Lt = (e) => U(e, WeakMap), Qe = (e) => U(e, NodeList), It = (e) => ie(e) === Text, $t = (e) => U(e, Event), Ot = (e) => U(e, KeyboardEvent), _t = (e) => U(e, window.TextTrackCue) || U(e, window.VTTCue), jt = (e) => U(e, TextTrack) || !Pe(e) && de(e.kind), Ht = (e) => U(e, Promise) && Ke(e.then), Rt = (e) => e !== null && typeof e == "object" && e.nodeType === 1 && typeof e.style == "object" && typeof e.ownerDocument == "object", Xe = (e) => Pe(e) || (de(e) || Ye(e) || Qe(e)) && !e.length || ze(e) && !Object.keys(e).length, Dt = (e) => {
|
|
147
|
-
if (U(e, window.URL)) return !0;
|
|
148
|
-
if (!de(e)) return !1;
|
|
149
|
-
let i = e;
|
|
150
|
-
e.startsWith("http://") && e.startsWith("https://") || (i = `http://${e}`);
|
|
151
|
-
try {
|
|
152
|
-
return !Xe(new URL(i).hostname);
|
|
153
|
-
} catch {
|
|
154
|
-
return !1;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
var r = { nullOrUndefined: Pe, object: ze, number: Nt, string: de, boolean: xt, function: Ke, array: Ye, weakMap: Lt, nodeList: Qe, element: Rt, textNode: It, event: $t, keyboardEvent: Ot, cue: _t, track: jt, promise: Ht, url: Dt, empty: Xe };
|
|
158
|
-
const ve = (() => {
|
|
159
|
-
const e = document.createElement("span"), i = { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend" }, t = Object.keys(i).find((s) => e.style[s] !== void 0);
|
|
160
|
-
return !!r.string(t) && i[t];
|
|
161
|
-
})();
|
|
162
|
-
function Je(e, i) {
|
|
163
|
-
setTimeout(() => {
|
|
164
|
-
try {
|
|
165
|
-
e.hidden = !0, e.offsetHeight, e.hidden = !1;
|
|
166
|
-
} catch {
|
|
167
|
-
}
|
|
168
|
-
}, i);
|
|
169
|
-
}
|
|
170
|
-
const qt = !!window.document.documentMode, Vt = /Edge/g.test(navigator.userAgent), Ft = "WebkitAppearance" in document.documentElement.style && !/Edge/g.test(navigator.userAgent), Ut = /iPhone|iPod/gi.test(navigator.userAgent) && navigator.maxTouchPoints > 1, Bt = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Wt = /iPad|iPhone|iPod/gi.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
|
|
171
|
-
var O = { isIE: qt, isEdge: Vt, isWebKit: Ft, isIPhone: Ut, isIPadOS: Bt, isIos: Wt };
|
|
172
|
-
function zt(e) {
|
|
173
|
-
return JSON.parse(JSON.stringify(e));
|
|
174
|
-
}
|
|
175
|
-
function Ge(e, i) {
|
|
176
|
-
return i.split(".").reduce((t, s) => t && t[s], e);
|
|
177
|
-
}
|
|
178
|
-
function N(e = {}, ...i) {
|
|
179
|
-
if (!i.length) return e;
|
|
180
|
-
const t = i.shift();
|
|
181
|
-
return r.object(t) ? (Object.keys(t).forEach((s) => {
|
|
182
|
-
r.object(t[s]) ? (Object.keys(e).includes(s) || Object.assign(e, { [s]: {} }), N(e[s], t[s])) : Object.assign(e, { [s]: t[s] });
|
|
183
|
-
}), N(e, ...i)) : e;
|
|
184
|
-
}
|
|
185
|
-
function Ze(e, i) {
|
|
186
|
-
const t = e.length ? e : [e];
|
|
187
|
-
Array.from(t).reverse().forEach((s, n) => {
|
|
188
|
-
const a = n > 0 ? i.cloneNode(!0) : i, l = s.parentNode, o = s.nextSibling;
|
|
189
|
-
a.appendChild(s), o ? l.insertBefore(a, o) : l.appendChild(a);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function we(e, i) {
|
|
193
|
-
r.element(e) && !r.empty(i) && Object.entries(i).filter(([, t]) => !r.nullOrUndefined(t)).forEach(([t, s]) => e.setAttribute(t, s));
|
|
194
|
-
}
|
|
195
|
-
function y(e, i, t) {
|
|
196
|
-
const s = document.createElement(e);
|
|
197
|
-
return r.object(i) && we(s, i), r.string(t) && (s.innerText = t), s;
|
|
198
|
-
}
|
|
199
|
-
function Kt(e, i) {
|
|
200
|
-
r.element(e) && r.element(i) && i.parentNode.insertBefore(e, i.nextSibling);
|
|
201
|
-
}
|
|
202
|
-
function je(e, i, t, s) {
|
|
203
|
-
r.element(i) && i.appendChild(y(e, t, s));
|
|
204
|
-
}
|
|
205
|
-
function F(e) {
|
|
206
|
-
r.nodeList(e) || r.array(e) ? Array.from(e).forEach(F) : r.element(e) && r.element(e.parentNode) && e.parentNode.removeChild(e);
|
|
207
|
-
}
|
|
208
|
-
function ae(e) {
|
|
209
|
-
if (!r.element(e)) return;
|
|
210
|
-
let { length: i } = e.childNodes;
|
|
211
|
-
for (; i > 0; ) e.removeChild(e.lastChild), i -= 1;
|
|
212
|
-
}
|
|
213
|
-
function oe(e, i) {
|
|
214
|
-
return r.element(i) && r.element(i.parentNode) && r.element(e) ? (i.parentNode.replaceChild(e, i), e) : null;
|
|
215
|
-
}
|
|
216
|
-
function q(e, i) {
|
|
217
|
-
if (!r.string(e) || r.empty(e)) return {};
|
|
218
|
-
const t = {}, s = N({}, i);
|
|
219
|
-
return e.split(",").forEach((n) => {
|
|
220
|
-
const a = n.trim(), l = a.replace(".", ""), o = a.replace(/[[\]]/g, "").split("="), [c] = o, u = o.length > 1 ? o[1].replace(/["']/g, "") : "";
|
|
221
|
-
switch (a.charAt(0)) {
|
|
222
|
-
case ".":
|
|
223
|
-
r.string(s.class) ? t.class = `${s.class} ${l}` : t.class = l;
|
|
224
|
-
break;
|
|
225
|
-
case "#":
|
|
226
|
-
t.id = a.replace("#", "");
|
|
227
|
-
break;
|
|
228
|
-
case "[":
|
|
229
|
-
t[c] = u;
|
|
230
|
-
}
|
|
231
|
-
}), N(s, t);
|
|
232
|
-
}
|
|
233
|
-
function z(e, i) {
|
|
234
|
-
if (!r.element(e)) return;
|
|
235
|
-
let t = i;
|
|
236
|
-
r.boolean(t) || (t = !e.hidden), e.hidden = t;
|
|
237
|
-
}
|
|
238
|
-
function S(e, i, t) {
|
|
239
|
-
if (r.nodeList(e)) return Array.from(e).map((s) => S(s, i, t));
|
|
240
|
-
if (r.element(e)) {
|
|
241
|
-
let s = "toggle";
|
|
242
|
-
return t !== void 0 && (s = t ? "add" : "remove"), e.classList[s](i), e.classList.contains(i);
|
|
243
|
-
}
|
|
244
|
-
return !1;
|
|
245
|
-
}
|
|
246
|
-
function ce(e, i) {
|
|
247
|
-
return r.element(e) && e.classList.contains(i);
|
|
248
|
-
}
|
|
249
|
-
function K(e, i) {
|
|
250
|
-
const { prototype: t } = Element;
|
|
251
|
-
return (t.matches || t.webkitMatchesSelector || t.mozMatchesSelector || t.msMatchesSelector || function() {
|
|
252
|
-
return Array.from(document.querySelectorAll(i)).includes(this);
|
|
253
|
-
}).call(e, i);
|
|
254
|
-
}
|
|
255
|
-
function Yt(e, i) {
|
|
256
|
-
const { prototype: t } = Element;
|
|
257
|
-
return (t.closest || function() {
|
|
258
|
-
let s = this;
|
|
259
|
-
do {
|
|
260
|
-
if (K.matches(s, i)) return s;
|
|
261
|
-
s = s.parentElement || s.parentNode;
|
|
262
|
-
} while (s !== null && s.nodeType === 1);
|
|
263
|
-
return null;
|
|
264
|
-
}).call(e, i);
|
|
265
|
-
}
|
|
266
|
-
function G(e) {
|
|
267
|
-
return this.elements.container.querySelectorAll(e);
|
|
268
|
-
}
|
|
269
|
-
function I(e) {
|
|
270
|
-
return this.elements.container.querySelector(e);
|
|
271
|
-
}
|
|
272
|
-
function ge(e = null, i = !1) {
|
|
273
|
-
r.element(e) && e.focus({ preventScroll: !0, focusVisible: i });
|
|
274
|
-
}
|
|
275
|
-
const He = { "audio/ogg": "vorbis", "audio/wav": "1", "video/webm": "vp8, vorbis", "video/mp4": "avc1.42E01E, mp4a.40.2", "video/ogg": "theora" }, x = { audio: "canPlayType" in document.createElement("audio"), video: "canPlayType" in document.createElement("video"), check(e, i) {
|
|
276
|
-
const t = x[e] || i !== "html5";
|
|
277
|
-
return { api: t, ui: t && x.rangeInput };
|
|
278
|
-
}, pip: !(O.isIPhone || !r.function(y("video").webkitSetPresentationMode) && (!document.pictureInPictureEnabled || y("video").disablePictureInPicture)), airplay: r.function(window.WebKitPlaybackTargetAvailabilityEvent), playsinline: "playsInline" in document.createElement("video"), mime(e) {
|
|
279
|
-
if (r.empty(e)) return !1;
|
|
280
|
-
const [i] = e.split("/");
|
|
281
|
-
let t = e;
|
|
282
|
-
if (!this.isHTML5 || i !== this.type) return !1;
|
|
283
|
-
Object.keys(He).includes(t) && (t += `; codecs="${He[e]}"`);
|
|
284
|
-
try {
|
|
285
|
-
return !!(t && this.media.canPlayType(t).replace(/no/, ""));
|
|
286
|
-
} catch {
|
|
287
|
-
return !1;
|
|
288
|
-
}
|
|
289
|
-
}, textTracks: "textTracks" in document.createElement("video"), rangeInput: (() => {
|
|
290
|
-
const e = document.createElement("input");
|
|
291
|
-
return e.type = "range", e.type === "range";
|
|
292
|
-
})(), touch: "ontouchstart" in document.documentElement, transitions: ve !== !1, reducedMotion: "matchMedia" in window && window.matchMedia("(prefers-reduced-motion)").matches }, Qt = (() => {
|
|
293
|
-
let e = !1;
|
|
294
|
-
try {
|
|
295
|
-
const i = Object.defineProperty({}, "passive", { get: () => (e = !0, null) });
|
|
296
|
-
window.addEventListener("test", null, i), window.removeEventListener("test", null, i);
|
|
297
|
-
} catch {
|
|
298
|
-
}
|
|
299
|
-
return e;
|
|
300
|
-
})();
|
|
301
|
-
function Z(e, i, t, s = !1, n = !0, a = !1) {
|
|
302
|
-
if (!e || !("addEventListener" in e) || r.empty(i) || !r.function(t)) return;
|
|
303
|
-
const l = i.split(" ");
|
|
304
|
-
let o = a;
|
|
305
|
-
Qt && (o = { passive: n, capture: a }), l.forEach((c) => {
|
|
306
|
-
this && this.eventListeners && s && this.eventListeners.push({ element: e, type: c, callback: t, options: o }), e[s ? "addEventListener" : "removeEventListener"](c, t, o);
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
function C(e, i = "", t, s = !0, n = !1) {
|
|
310
|
-
Z.call(this, e, i, t, !0, s, n);
|
|
311
|
-
}
|
|
312
|
-
function me(e, i = "", t, s = !0, n = !1) {
|
|
313
|
-
Z.call(this, e, i, t, !1, s, n);
|
|
314
|
-
}
|
|
315
|
-
function Me(e, i = "", t, s = !0, n = !1) {
|
|
316
|
-
const a = (...l) => {
|
|
317
|
-
me(e, i, a, s, n), t.apply(this, l);
|
|
318
|
-
};
|
|
319
|
-
Z.call(this, e, i, a, !0, s, n);
|
|
320
|
-
}
|
|
321
|
-
function b(e, i = "", t = !1, s = {}) {
|
|
322
|
-
if (!r.element(e) || r.empty(i)) return;
|
|
323
|
-
const n = new CustomEvent(i, { bubbles: t, detail: { ...s, plyr: this } });
|
|
324
|
-
e.dispatchEvent(n);
|
|
325
|
-
}
|
|
326
|
-
function Xt() {
|
|
327
|
-
this && this.eventListeners && (this.eventListeners.forEach((e) => {
|
|
328
|
-
const { element: i, type: t, callback: s, options: n } = e;
|
|
329
|
-
i.removeEventListener(t, s, n);
|
|
330
|
-
}), this.eventListeners = []);
|
|
331
|
-
}
|
|
332
|
-
function Jt() {
|
|
333
|
-
return new Promise((e) => this.ready ? setTimeout(e, 0) : C.call(this, this.elements.container, "ready", e)).then(() => {
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
function V(e) {
|
|
337
|
-
r.promise(e) && e.then(null, () => {
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
function ke(e) {
|
|
341
|
-
return r.array(e) ? e.filter((i, t) => e.indexOf(i) === t) : e;
|
|
342
|
-
}
|
|
343
|
-
function et(e, i) {
|
|
344
|
-
return r.array(e) && e.length ? e.reduce((t, s) => Math.abs(s - i) < Math.abs(t - i) ? s : t) : null;
|
|
345
|
-
}
|
|
346
|
-
function tt(e) {
|
|
347
|
-
return !(!window || !window.CSS) && window.CSS.supports(e);
|
|
348
|
-
}
|
|
349
|
-
const Re = [[1, 1], [4, 3], [3, 4], [5, 4], [4, 5], [3, 2], [2, 3], [16, 10], [10, 16], [16, 9], [9, 16], [21, 9], [9, 21], [32, 9], [9, 32]].reduce((e, [i, t]) => ({ ...e, [i / t]: [i, t] }), {});
|
|
350
|
-
function it(e) {
|
|
351
|
-
return r.array(e) || r.string(e) && e.includes(":") ? (r.array(e) ? e : e.split(":")).map(Number).every(r.number) : !1;
|
|
352
|
-
}
|
|
353
|
-
function ue(e) {
|
|
354
|
-
if (!r.array(e) || !e.every(r.number)) return null;
|
|
355
|
-
const [i, t] = e, s = (a, l) => l === 0 ? a : s(l, a % l), n = s(i, t);
|
|
356
|
-
return [i / n, t / n];
|
|
357
|
-
}
|
|
358
|
-
function Ne(e) {
|
|
359
|
-
const i = (s) => it(s) ? s.split(":").map(Number) : null;
|
|
360
|
-
let t = i(e);
|
|
361
|
-
if (t === null && (t = i(this.config.ratio)), t === null && !r.empty(this.embed) && r.array(this.embed.ratio) && ({ ratio: t } = this.embed), t === null && this.isHTML5) {
|
|
362
|
-
const { videoWidth: s, videoHeight: n } = this.media;
|
|
363
|
-
t = [s, n];
|
|
364
|
-
}
|
|
365
|
-
return ue(t);
|
|
366
|
-
}
|
|
367
|
-
function Y(e) {
|
|
368
|
-
if (!this.isVideo) return {};
|
|
369
|
-
const { wrapper: i } = this.elements, t = Ne.call(this, e);
|
|
370
|
-
if (!r.array(t)) return {};
|
|
371
|
-
const [s, n] = ue(t), a = 100 / s * n;
|
|
372
|
-
if (tt(`aspect-ratio: ${s}/${n}`) ? i.style.aspectRatio = `${s}/${n}` : i.style.paddingBottom = `${a}%`, this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
|
|
373
|
-
const l = 100 / this.media.offsetWidth * parseInt(window.getComputedStyle(this.media).paddingBottom, 10), o = (l - a) / (l / 50);
|
|
374
|
-
this.fullscreen.active ? i.style.paddingBottom = null : this.media.style.transform = `translateY(-${o}%)`;
|
|
375
|
-
} else this.isHTML5 && i.classList.add(this.config.classNames.videoFixedRatio);
|
|
376
|
-
return { padding: a, ratio: t };
|
|
377
|
-
}
|
|
378
|
-
function st(e, i, t = 0.05) {
|
|
379
|
-
const s = e / i, n = et(Object.keys(Re), s);
|
|
380
|
-
return Math.abs(n - s) <= t ? Re[n] : [e, i];
|
|
381
|
-
}
|
|
382
|
-
function Gt() {
|
|
383
|
-
return [Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0), Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)];
|
|
384
|
-
}
|
|
385
|
-
const W = { getSources() {
|
|
386
|
-
return this.isHTML5 ? Array.from(this.media.querySelectorAll("source")).filter((e) => {
|
|
387
|
-
const i = e.getAttribute("type");
|
|
388
|
-
return !!r.empty(i) || x.mime.call(this, i);
|
|
389
|
-
}) : [];
|
|
390
|
-
}, getQualityOptions() {
|
|
391
|
-
return this.config.quality.forced ? this.config.quality.options : W.getSources.call(this).map((e) => Number(e.getAttribute("size"))).filter(Boolean);
|
|
392
|
-
}, setup() {
|
|
393
|
-
if (!this.isHTML5) return;
|
|
394
|
-
const e = this;
|
|
395
|
-
e.options.speed = e.config.speed.options, r.empty(this.config.ratio) || Y.call(e), Object.defineProperty(e.media, "quality", { get() {
|
|
396
|
-
const i = W.getSources.call(e).find((t) => t.getAttribute("src") === e.source);
|
|
397
|
-
return i && Number(i.getAttribute("size"));
|
|
398
|
-
}, set(i) {
|
|
399
|
-
if (e.quality !== i) {
|
|
400
|
-
if (e.config.quality.forced && r.function(e.config.quality.onChange)) e.config.quality.onChange(i);
|
|
401
|
-
else {
|
|
402
|
-
const t = W.getSources.call(e).find((c) => Number(c.getAttribute("size")) === i);
|
|
403
|
-
if (!t) return;
|
|
404
|
-
const { currentTime: s, paused: n, preload: a, readyState: l, playbackRate: o } = e.media;
|
|
405
|
-
e.media.src = t.getAttribute("src"), (a !== "none" || l) && (e.once("loadedmetadata", () => {
|
|
406
|
-
e.speed = o, e.currentTime = s, n || V(e.play());
|
|
407
|
-
}), e.media.load());
|
|
408
|
-
}
|
|
409
|
-
b.call(e, e.media, "qualitychange", !1, { quality: i });
|
|
410
|
-
}
|
|
411
|
-
} });
|
|
412
|
-
}, cancelRequests() {
|
|
413
|
-
this.isHTML5 && (F(W.getSources.call(this)), this.media.setAttribute("src", this.config.blankVideo), this.media.load(), this.debug.log("Cancelled network requests"));
|
|
414
|
-
} };
|
|
415
|
-
function Zt(e) {
|
|
416
|
-
return `${e}-${Math.floor(1e4 * Math.random())}`;
|
|
417
|
-
}
|
|
418
|
-
function Te(e, ...i) {
|
|
419
|
-
return r.empty(e) ? e : e.toString().replace(/{(\d+)}/g, (t, s) => i[s].toString());
|
|
420
|
-
}
|
|
421
|
-
function ei(e, i) {
|
|
422
|
-
return e === 0 || i === 0 || Number.isNaN(e) || Number.isNaN(i) ? 0 : (e / i * 100).toFixed(2);
|
|
423
|
-
}
|
|
424
|
-
const J = (e = "", i = "", t = "") => e.replace(new RegExp(i.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1"), "g"), t.toString()), nt = (e = "") => e.toString().replace(/\w\S*/g, (i) => i.charAt(0).toUpperCase() + i.slice(1).toLowerCase());
|
|
425
|
-
function ti(e = "") {
|
|
426
|
-
let i = e.toString();
|
|
427
|
-
return i = J(i, "-", " "), i = J(i, "_", " "), i = nt(i), J(i, " ", "");
|
|
428
|
-
}
|
|
429
|
-
function ii(e = "") {
|
|
430
|
-
let i = e.toString();
|
|
431
|
-
return i = ti(i), i.charAt(0).toLowerCase() + i.slice(1);
|
|
432
|
-
}
|
|
433
|
-
function si(e) {
|
|
434
|
-
const i = document.createDocumentFragment(), t = document.createElement("div");
|
|
435
|
-
return i.appendChild(t), t.innerHTML = e, i.firstChild.innerText;
|
|
436
|
-
}
|
|
437
|
-
function ni(e) {
|
|
438
|
-
const i = document.createElement("div");
|
|
439
|
-
return i.appendChild(e), i.innerHTML;
|
|
440
|
-
}
|
|
441
|
-
const De = { pip: "PIP", airplay: "AirPlay", html5: "HTML5", vimeo: "Vimeo", youtube: "YouTube" }, $ = { get(e = "", i = {}) {
|
|
442
|
-
if (r.empty(e) || r.empty(i)) return "";
|
|
443
|
-
let t = Ge(i.i18n, e);
|
|
444
|
-
if (r.empty(t)) return Object.keys(De).includes(e) ? De[e] : "";
|
|
445
|
-
const s = { "{seektime}": i.seekTime, "{title}": i.title };
|
|
446
|
-
return Object.entries(s).forEach(([n, a]) => {
|
|
447
|
-
t = J(t, n, a);
|
|
448
|
-
}), t;
|
|
449
|
-
} };
|
|
450
|
-
class ee {
|
|
451
|
-
constructor(i) {
|
|
452
|
-
m(this, "get", (t) => {
|
|
453
|
-
if (!ee.supported || !this.enabled) return null;
|
|
454
|
-
const s = window.localStorage.getItem(this.key);
|
|
455
|
-
if (r.empty(s)) return null;
|
|
456
|
-
const n = JSON.parse(s);
|
|
457
|
-
return r.string(t) && t.length ? n[t] : n;
|
|
458
|
-
}), m(this, "set", (t) => {
|
|
459
|
-
if (!ee.supported || !this.enabled || !r.object(t)) return;
|
|
460
|
-
let s = this.get();
|
|
461
|
-
r.empty(s) && (s = {}), N(s, t);
|
|
462
|
-
try {
|
|
463
|
-
window.localStorage.setItem(this.key, JSON.stringify(s));
|
|
464
|
-
} catch {
|
|
465
|
-
}
|
|
466
|
-
}), this.enabled = i.config.storage.enabled, this.key = i.config.storage.key;
|
|
467
|
-
}
|
|
468
|
-
static get supported() {
|
|
469
|
-
try {
|
|
470
|
-
if (!("localStorage" in window)) return !1;
|
|
471
|
-
const i = "___test";
|
|
472
|
-
return window.localStorage.setItem(i, i), window.localStorage.removeItem(i), !0;
|
|
473
|
-
} catch {
|
|
474
|
-
return !1;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
function se(e, i = "text") {
|
|
479
|
-
return new Promise((t, s) => {
|
|
480
|
-
try {
|
|
481
|
-
const n = new XMLHttpRequest();
|
|
482
|
-
if (!("withCredentials" in n)) return;
|
|
483
|
-
n.addEventListener("load", () => {
|
|
484
|
-
if (i === "text") try {
|
|
485
|
-
t(JSON.parse(n.responseText));
|
|
486
|
-
} catch {
|
|
487
|
-
t(n.responseText);
|
|
488
|
-
}
|
|
489
|
-
else t(n.response);
|
|
490
|
-
}), n.addEventListener("error", () => {
|
|
491
|
-
throw new Error(n.status);
|
|
492
|
-
}), n.open("GET", e, !0), n.responseType = i, n.send();
|
|
493
|
-
} catch (n) {
|
|
494
|
-
s(n);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
function at(e, i) {
|
|
499
|
-
if (!r.string(e)) return;
|
|
500
|
-
const t = "cache", s = r.string(i);
|
|
501
|
-
let n = !1;
|
|
502
|
-
const a = () => document.getElementById(i) !== null, l = (o, c) => {
|
|
503
|
-
o.innerHTML = c, s && a() || document.body.insertAdjacentElement("afterbegin", o);
|
|
504
|
-
};
|
|
505
|
-
if (!s || !a()) {
|
|
506
|
-
const o = ee.supported, c = document.createElement("div");
|
|
507
|
-
if (c.setAttribute("hidden", ""), s && c.setAttribute("id", i), o) {
|
|
508
|
-
const u = window.localStorage.getItem(`${t}-${i}`);
|
|
509
|
-
if (n = u !== null, n) {
|
|
510
|
-
const g = JSON.parse(u);
|
|
511
|
-
l(c, g.content);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
se(e).then((u) => {
|
|
515
|
-
if (!r.empty(u)) {
|
|
516
|
-
if (o) try {
|
|
517
|
-
window.localStorage.setItem(`${t}-${i}`, JSON.stringify({ content: u }));
|
|
518
|
-
} catch {
|
|
519
|
-
}
|
|
520
|
-
l(c, u);
|
|
521
|
-
}
|
|
522
|
-
}).catch(() => {
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
const rt = (e) => Math.trunc(e / 60 / 60 % 60, 10), ai = (e) => Math.trunc(e / 60 % 60, 10), ri = (e) => Math.trunc(e % 60, 10);
|
|
527
|
-
function pe(e = 0, i = !1, t = !1) {
|
|
528
|
-
if (!r.number(e)) return pe(void 0, i, t);
|
|
529
|
-
const s = (o) => `0${o}`.slice(-2);
|
|
530
|
-
let n = rt(e);
|
|
531
|
-
const a = ai(e), l = ri(e);
|
|
532
|
-
return n = i || n > 0 ? `${n}:` : "", `${t && e > 0 ? "-" : ""}${n}${s(a)}:${s(l)}`;
|
|
533
|
-
}
|
|
534
|
-
const h = { getIconUrl() {
|
|
535
|
-
const e = new URL(this.config.iconUrl, window.location), i = window.location.host ? window.location.host : window.top.location.host, t = e.host !== i || O.isIE && !window.svg4everybody;
|
|
536
|
-
return { url: this.config.iconUrl, cors: t };
|
|
537
|
-
}, findElements() {
|
|
538
|
-
try {
|
|
539
|
-
return this.elements.controls = I.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = { play: G.call(this, this.config.selectors.buttons.play), pause: I.call(this, this.config.selectors.buttons.pause), restart: I.call(this, this.config.selectors.buttons.restart), rewind: I.call(this, this.config.selectors.buttons.rewind), fastForward: I.call(this, this.config.selectors.buttons.fastForward), mute: I.call(this, this.config.selectors.buttons.mute), pip: I.call(this, this.config.selectors.buttons.pip), airplay: I.call(this, this.config.selectors.buttons.airplay), settings: I.call(this, this.config.selectors.buttons.settings), captions: I.call(this, this.config.selectors.buttons.captions), fullscreen: I.call(this, this.config.selectors.buttons.fullscreen) }, this.elements.progress = I.call(this, this.config.selectors.progress), this.elements.inputs = { seek: I.call(this, this.config.selectors.inputs.seek), volume: I.call(this, this.config.selectors.inputs.volume) }, this.elements.display = { buffer: I.call(this, this.config.selectors.display.buffer), currentTime: I.call(this, this.config.selectors.display.currentTime), duration: I.call(this, this.config.selectors.display.duration) }, r.element(this.elements.progress) && (this.elements.display.seekTooltip = this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)), !0;
|
|
540
|
-
} catch (e) {
|
|
541
|
-
return this.debug.warn("It looks like there is a problem with your custom controls HTML", e), this.toggleNativeControls(!0), !1;
|
|
542
|
-
}
|
|
543
|
-
}, createIcon(e, i) {
|
|
544
|
-
const t = "http://www.w3.org/2000/svg", s = h.getIconUrl.call(this), n = `${s.cors ? "" : s.url}#${this.config.iconPrefix}`, a = document.createElementNS(t, "svg");
|
|
545
|
-
we(a, N(i, { "aria-hidden": "true", focusable: "false" }));
|
|
546
|
-
const l = document.createElementNS(t, "use"), o = `${n}-${e}`;
|
|
547
|
-
return "href" in l && l.setAttributeNS("http://www.w3.org/1999/xlink", "href", o), l.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", o), a.appendChild(l), a;
|
|
548
|
-
}, createLabel(e, i = {}) {
|
|
549
|
-
const t = $.get(e, this.config);
|
|
550
|
-
return y("span", { ...i, class: [i.class, this.config.classNames.hidden].filter(Boolean).join(" ") }, t);
|
|
551
|
-
}, createBadge(e) {
|
|
552
|
-
if (r.empty(e)) return null;
|
|
553
|
-
const i = y("span", { class: this.config.classNames.menu.value });
|
|
554
|
-
return i.appendChild(y("span", { class: this.config.classNames.menu.badge }, e)), i;
|
|
555
|
-
}, createButton(e, i) {
|
|
556
|
-
const t = N({}, i);
|
|
557
|
-
let s = ii(e);
|
|
558
|
-
const n = { element: "button", toggle: !1, label: null, icon: null, labelPressed: null, iconPressed: null };
|
|
559
|
-
switch (["element", "icon", "label"].forEach((l) => {
|
|
560
|
-
Object.keys(t).includes(l) && (n[l] = t[l], delete t[l]);
|
|
561
|
-
}), n.element !== "button" || Object.keys(t).includes("type") || (t.type = "button"), Object.keys(t).includes("class") ? t.class.split(" ").some((l) => l === this.config.classNames.control) || N(t, { class: `${t.class} ${this.config.classNames.control}` }) : t.class = this.config.classNames.control, e) {
|
|
562
|
-
case "play":
|
|
563
|
-
n.toggle = !0, n.label = "play", n.labelPressed = "pause", n.icon = "play", n.iconPressed = "pause";
|
|
564
|
-
break;
|
|
565
|
-
case "mute":
|
|
566
|
-
n.toggle = !0, n.label = "mute", n.labelPressed = "unmute", n.icon = "volume", n.iconPressed = "muted";
|
|
567
|
-
break;
|
|
568
|
-
case "captions":
|
|
569
|
-
n.toggle = !0, n.label = "enableCaptions", n.labelPressed = "disableCaptions", n.icon = "captions-off", n.iconPressed = "captions-on";
|
|
570
|
-
break;
|
|
571
|
-
case "fullscreen":
|
|
572
|
-
n.toggle = !0, n.label = "enterFullscreen", n.labelPressed = "exitFullscreen", n.icon = "enter-fullscreen", n.iconPressed = "exit-fullscreen";
|
|
573
|
-
break;
|
|
574
|
-
case "play-large":
|
|
575
|
-
t.class += ` ${this.config.classNames.control}--overlaid`, s = "play", n.label = "play", n.icon = "play";
|
|
576
|
-
break;
|
|
577
|
-
default:
|
|
578
|
-
r.empty(n.label) && (n.label = s), r.empty(n.icon) && (n.icon = e);
|
|
579
|
-
}
|
|
580
|
-
const a = y(n.element);
|
|
581
|
-
return n.toggle ? (a.appendChild(h.createIcon.call(this, n.iconPressed, { class: "icon--pressed" })), a.appendChild(h.createIcon.call(this, n.icon, { class: "icon--not-pressed" })), a.appendChild(h.createLabel.call(this, n.labelPressed, { class: "label--pressed" })), a.appendChild(h.createLabel.call(this, n.label, { class: "label--not-pressed" }))) : (a.appendChild(h.createIcon.call(this, n.icon)), a.appendChild(h.createLabel.call(this, n.label))), N(t, q(this.config.selectors.buttons[s], t)), we(a, t), s === "play" ? (r.array(this.elements.buttons[s]) || (this.elements.buttons[s] = []), this.elements.buttons[s].push(a)) : this.elements.buttons[s] = a, a;
|
|
582
|
-
}, createRange(e, i) {
|
|
583
|
-
const t = y("input", N(q(this.config.selectors.inputs[e]), { type: "range", min: 0, max: 100, step: 0.01, value: 0, autocomplete: "off", role: "slider", "aria-label": $.get(e, this.config), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": 0 }, i));
|
|
584
|
-
return this.elements.inputs[e] = t, h.updateRangeFill.call(this, t), Mt.setup(t), t;
|
|
585
|
-
}, createProgress(e, i) {
|
|
586
|
-
const t = y("progress", N(q(this.config.selectors.display[e]), { min: 0, max: 100, value: 0, role: "progressbar", "aria-hidden": !0 }, i));
|
|
587
|
-
if (e !== "volume") {
|
|
588
|
-
t.appendChild(y("span", null, "0"));
|
|
589
|
-
const s = { played: "played", buffer: "buffered" }[e], n = s ? $.get(s, this.config) : "";
|
|
590
|
-
t.innerText = `% ${n.toLowerCase()}`;
|
|
591
|
-
}
|
|
592
|
-
return this.elements.display[e] = t, t;
|
|
593
|
-
}, createTime(e, i) {
|
|
594
|
-
const t = q(this.config.selectors.display[e], i), s = y("div", N(t, { class: `${t.class ? t.class : ""} ${this.config.classNames.display.time} `.trim(), "aria-label": $.get(e, this.config), role: "timer" }), "00:00");
|
|
595
|
-
return this.elements.display[e] = s, s;
|
|
596
|
-
}, bindMenuItemShortcuts(e, i) {
|
|
597
|
-
C.call(this, e, "keydown keyup", (t) => {
|
|
598
|
-
if (![" ", "ArrowUp", "ArrowDown", "ArrowRight"].includes(t.key) || (t.preventDefault(), t.stopPropagation(), t.type === "keydown")) return;
|
|
599
|
-
const s = K(e, '[role="menuitemradio"]');
|
|
600
|
-
if (!s && [" ", "ArrowRight"].includes(t.key)) h.showMenuPanel.call(this, i, !0);
|
|
601
|
-
else {
|
|
602
|
-
let n;
|
|
603
|
-
t.key !== " " && (t.key === "ArrowDown" || s && t.key === "ArrowRight" ? (n = e.nextElementSibling, r.element(n) || (n = e.parentNode.firstElementChild)) : (n = e.previousElementSibling, r.element(n) || (n = e.parentNode.lastElementChild)), ge.call(this, n, !0));
|
|
604
|
-
}
|
|
605
|
-
}, !1), C.call(this, e, "keyup", (t) => {
|
|
606
|
-
t.key === "Return" && h.focusFirstMenuItem.call(this, null, !0);
|
|
607
|
-
});
|
|
608
|
-
}, createMenuItem({ value: e, list: i, type: t, title: s, badge: n = null, checked: a = !1 }) {
|
|
609
|
-
const l = q(this.config.selectors.inputs[t]), o = y("button", N(l, { type: "button", role: "menuitemradio", class: `${this.config.classNames.control} ${l.class ? l.class : ""}`.trim(), "aria-checked": a, value: e })), c = y("span");
|
|
610
|
-
c.innerHTML = s, r.element(n) && c.appendChild(n), o.appendChild(c), Object.defineProperty(o, "checked", { enumerable: !0, get: () => o.getAttribute("aria-checked") === "true", set(u) {
|
|
611
|
-
u && Array.from(o.parentNode.children).filter((g) => K(g, '[role="menuitemradio"]')).forEach((g) => g.setAttribute("aria-checked", "false")), o.setAttribute("aria-checked", u ? "true" : "false");
|
|
612
|
-
} }), this.listeners.bind(o, "click keyup", (u) => {
|
|
613
|
-
if (!r.keyboardEvent(u) || u.key === " ") {
|
|
614
|
-
switch (u.preventDefault(), u.stopPropagation(), o.checked = !0, t) {
|
|
615
|
-
case "language":
|
|
616
|
-
this.currentTrack = Number(e);
|
|
617
|
-
break;
|
|
618
|
-
case "quality":
|
|
619
|
-
this.quality = e;
|
|
620
|
-
break;
|
|
621
|
-
case "speed":
|
|
622
|
-
this.speed = parseFloat(e);
|
|
623
|
-
}
|
|
624
|
-
h.showMenuPanel.call(this, "home", r.keyboardEvent(u));
|
|
625
|
-
}
|
|
626
|
-
}, t, !1), h.bindMenuItemShortcuts.call(this, o, t), i.appendChild(o);
|
|
627
|
-
}, formatTime(e = 0, i = !1) {
|
|
628
|
-
return r.number(e) ? pe(e, rt(this.duration) > 0, i) : e;
|
|
629
|
-
}, updateTimeDisplay(e = null, i = 0, t = !1) {
|
|
630
|
-
r.element(e) && r.number(i) && (e.innerText = h.formatTime(i, t));
|
|
631
|
-
}, updateVolume() {
|
|
632
|
-
this.supported.ui && (r.element(this.elements.inputs.volume) && h.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume), r.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || this.volume === 0));
|
|
633
|
-
}, setRange(e, i = 0) {
|
|
634
|
-
r.element(e) && (e.value = i, h.updateRangeFill.call(this, e));
|
|
635
|
-
}, updateProgress(e) {
|
|
636
|
-
if (!this.supported.ui || !r.event(e)) return;
|
|
637
|
-
let i = 0;
|
|
638
|
-
const t = (s, n) => {
|
|
639
|
-
const a = r.number(n) ? n : 0, l = r.element(s) ? s : this.elements.display.buffer;
|
|
640
|
-
if (r.element(l)) {
|
|
641
|
-
l.value = a;
|
|
642
|
-
const o = l.getElementsByTagName("span")[0];
|
|
643
|
-
r.element(o) && (o.childNodes[0].nodeValue = a);
|
|
644
|
-
}
|
|
645
|
-
};
|
|
646
|
-
if (e) switch (e.type) {
|
|
647
|
-
case "timeupdate":
|
|
648
|
-
case "seeking":
|
|
649
|
-
case "seeked":
|
|
650
|
-
i = ei(this.currentTime, this.duration), e.type === "timeupdate" && h.setRange.call(this, this.elements.inputs.seek, i);
|
|
651
|
-
break;
|
|
652
|
-
case "playing":
|
|
653
|
-
case "progress":
|
|
654
|
-
t(this.elements.display.buffer, 100 * this.buffered);
|
|
655
|
-
}
|
|
656
|
-
}, updateRangeFill(e) {
|
|
657
|
-
const i = r.event(e) ? e.target : e;
|
|
658
|
-
if (r.element(i) && i.getAttribute("type") === "range") {
|
|
659
|
-
if (K(i, this.config.selectors.inputs.seek)) {
|
|
660
|
-
i.setAttribute("aria-valuenow", this.currentTime);
|
|
661
|
-
const t = h.formatTime(this.currentTime), s = h.formatTime(this.duration), n = $.get("seekLabel", this.config);
|
|
662
|
-
i.setAttribute("aria-valuetext", n.replace("{currentTime}", t).replace("{duration}", s));
|
|
663
|
-
} else if (K(i, this.config.selectors.inputs.volume)) {
|
|
664
|
-
const t = 100 * i.value;
|
|
665
|
-
i.setAttribute("aria-valuenow", t), i.setAttribute("aria-valuetext", `${t.toFixed(1)}%`);
|
|
666
|
-
} else i.setAttribute("aria-valuenow", i.value);
|
|
667
|
-
(O.isWebKit || O.isIPadOS) && i.style.setProperty("--value", i.value / i.max * 100 + "%");
|
|
668
|
-
}
|
|
669
|
-
}, updateSeekTooltip(e) {
|
|
670
|
-
var i, t;
|
|
671
|
-
if (!this.config.tooltips.seek || !r.element(this.elements.inputs.seek) || !r.element(this.elements.display.seekTooltip) || this.duration === 0) return;
|
|
672
|
-
const s = this.elements.display.seekTooltip, n = `${this.config.classNames.tooltip}--visible`, a = (g) => S(s, n, g);
|
|
673
|
-
if (this.touch) return void a(!1);
|
|
674
|
-
let l = 0;
|
|
675
|
-
const o = this.elements.progress.getBoundingClientRect();
|
|
676
|
-
if (r.event(e)) l = 100 / o.width * (e.pageX - o.left);
|
|
677
|
-
else {
|
|
678
|
-
if (!ce(s, n)) return;
|
|
679
|
-
l = parseFloat(s.style.left, 10);
|
|
680
|
-
}
|
|
681
|
-
l < 0 ? l = 0 : l > 100 && (l = 100);
|
|
682
|
-
const c = this.duration / 100 * l;
|
|
683
|
-
s.innerText = h.formatTime(c);
|
|
684
|
-
const u = (i = this.config.markers) === null || i === void 0 || (t = i.points) === null || t === void 0 ? void 0 : t.find(({ time: g }) => g === Math.round(c));
|
|
685
|
-
u && s.insertAdjacentHTML("afterbegin", `${u.label}<br>`), s.style.left = `${l}%`, r.event(e) && ["mouseenter", "mouseleave"].includes(e.type) && a(e.type === "mouseenter");
|
|
686
|
-
}, timeUpdate(e) {
|
|
687
|
-
const i = !r.element(this.elements.display.duration) && this.config.invertTime;
|
|
688
|
-
h.updateTimeDisplay.call(this, this.elements.display.currentTime, i ? this.duration - this.currentTime : this.currentTime, i), e && e.type === "timeupdate" && this.media.seeking || h.updateProgress.call(this, e);
|
|
689
|
-
}, durationUpdate() {
|
|
690
|
-
if (!this.supported.ui || !this.config.invertTime && this.currentTime) return;
|
|
691
|
-
if (this.duration >= 2 ** 32) return z(this.elements.display.currentTime, !0), void z(this.elements.progress, !0);
|
|
692
|
-
r.element(this.elements.inputs.seek) && this.elements.inputs.seek.setAttribute("aria-valuemax", this.duration);
|
|
693
|
-
const e = r.element(this.elements.display.duration);
|
|
694
|
-
!e && this.config.displayDuration && this.paused && h.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration), e && h.updateTimeDisplay.call(this, this.elements.display.duration, this.duration), this.config.markers.enabled && h.setMarkers.call(this), h.updateSeekTooltip.call(this);
|
|
695
|
-
}, toggleMenuButton(e, i) {
|
|
696
|
-
z(this.elements.settings.buttons[e], !i);
|
|
697
|
-
}, updateSetting(e, i, t) {
|
|
698
|
-
const s = this.elements.settings.panels[e];
|
|
699
|
-
let n = null, a = i;
|
|
700
|
-
if (e === "captions") n = this.currentTrack;
|
|
701
|
-
else {
|
|
702
|
-
if (n = r.empty(t) ? this[e] : t, r.empty(n) && (n = this.config[e].default), !r.empty(this.options[e]) && !this.options[e].includes(n)) return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);
|
|
703
|
-
if (!this.config[e].options.includes(n)) return void this.debug.warn(`Disabled value of '${n}' for ${e}`);
|
|
704
|
-
}
|
|
705
|
-
if (r.element(a) || (a = s && s.querySelector('[role="menu"]')), !r.element(a)) return;
|
|
706
|
-
this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML = h.getLabel.call(this, e, n);
|
|
707
|
-
const l = a && a.querySelector(`[value="${n}"]`);
|
|
708
|
-
r.element(l) && (l.checked = !0);
|
|
709
|
-
}, getLabel(e, i) {
|
|
710
|
-
switch (e) {
|
|
711
|
-
case "speed":
|
|
712
|
-
return i === 1 ? $.get("normal", this.config) : `${i}×`;
|
|
713
|
-
case "quality":
|
|
714
|
-
if (r.number(i)) {
|
|
715
|
-
const t = $.get(`qualityLabel.${i}`, this.config);
|
|
716
|
-
return t.length ? t : `${i}p`;
|
|
717
|
-
}
|
|
718
|
-
return nt(i);
|
|
719
|
-
case "captions":
|
|
720
|
-
return E.getLabel.call(this);
|
|
721
|
-
default:
|
|
722
|
-
return null;
|
|
723
|
-
}
|
|
724
|
-
}, setQualityMenu(e) {
|
|
725
|
-
if (!r.element(this.elements.settings.panels.quality)) return;
|
|
726
|
-
const i = "quality", t = this.elements.settings.panels.quality.querySelector('[role="menu"]');
|
|
727
|
-
r.array(e) && (this.options.quality = ke(e).filter((a) => this.config.quality.options.includes(a)));
|
|
728
|
-
const s = !r.empty(this.options.quality) && this.options.quality.length > 1;
|
|
729
|
-
if (h.toggleMenuButton.call(this, i, s), ae(t), h.checkMenu.call(this), !s) return;
|
|
730
|
-
const n = (a) => {
|
|
731
|
-
const l = $.get(`qualityBadge.${a}`, this.config);
|
|
732
|
-
return l.length ? h.createBadge.call(this, l) : null;
|
|
733
|
-
};
|
|
734
|
-
this.options.quality.sort((a, l) => {
|
|
735
|
-
const o = this.config.quality.options;
|
|
736
|
-
return o.indexOf(a) > o.indexOf(l) ? 1 : -1;
|
|
737
|
-
}).forEach((a) => {
|
|
738
|
-
h.createMenuItem.call(this, { value: a, list: t, type: i, title: h.getLabel.call(this, "quality", a), badge: n(a) });
|
|
739
|
-
}), h.updateSetting.call(this, i, t);
|
|
740
|
-
}, setCaptionsMenu() {
|
|
741
|
-
if (!r.element(this.elements.settings.panels.captions)) return;
|
|
742
|
-
const e = "captions", i = this.elements.settings.panels.captions.querySelector('[role="menu"]'), t = E.getTracks.call(this), s = !!t.length;
|
|
743
|
-
if (h.toggleMenuButton.call(this, e, s), ae(i), h.checkMenu.call(this), !s) return;
|
|
744
|
-
const n = t.map((a, l) => ({ value: l, checked: this.captions.toggled && this.currentTrack === l, title: E.getLabel.call(this, a), badge: a.language && h.createBadge.call(this, a.language.toUpperCase()), list: i, type: "language" }));
|
|
745
|
-
n.unshift({ value: -1, checked: !this.captions.toggled, title: $.get("disabled", this.config), list: i, type: "language" }), n.forEach(h.createMenuItem.bind(this)), h.updateSetting.call(this, e, i);
|
|
746
|
-
}, setSpeedMenu() {
|
|
747
|
-
if (!r.element(this.elements.settings.panels.speed)) return;
|
|
748
|
-
const e = "speed", i = this.elements.settings.panels.speed.querySelector('[role="menu"]');
|
|
749
|
-
this.options.speed = this.options.speed.filter((s) => s >= this.minimumSpeed && s <= this.maximumSpeed);
|
|
750
|
-
const t = !r.empty(this.options.speed) && this.options.speed.length > 1;
|
|
751
|
-
h.toggleMenuButton.call(this, e, t), ae(i), h.checkMenu.call(this), t && (this.options.speed.forEach((s) => {
|
|
752
|
-
h.createMenuItem.call(this, { value: s, list: i, type: e, title: h.getLabel.call(this, "speed", s) });
|
|
753
|
-
}), h.updateSetting.call(this, e, i));
|
|
754
|
-
}, checkMenu() {
|
|
755
|
-
const { buttons: e } = this.elements.settings, i = !r.empty(e) && Object.values(e).some((t) => !t.hidden);
|
|
756
|
-
z(this.elements.settings.menu, !i);
|
|
757
|
-
}, focusFirstMenuItem(e, i = !1) {
|
|
758
|
-
if (this.elements.settings.popup.hidden) return;
|
|
759
|
-
let t = e;
|
|
760
|
-
r.element(t) || (t = Object.values(this.elements.settings.panels).find((n) => !n.hidden));
|
|
761
|
-
const s = t.querySelector('[role^="menuitem"]');
|
|
762
|
-
ge.call(this, s, i);
|
|
763
|
-
}, toggleMenu(e) {
|
|
764
|
-
const { popup: i } = this.elements.settings, t = this.elements.buttons.settings;
|
|
765
|
-
if (!r.element(i) || !r.element(t)) return;
|
|
766
|
-
const { hidden: s } = i;
|
|
767
|
-
let n = s;
|
|
768
|
-
if (r.boolean(e)) n = e;
|
|
769
|
-
else if (r.keyboardEvent(e) && e.key === "Escape") n = !1;
|
|
770
|
-
else if (r.event(e)) {
|
|
771
|
-
const a = r.function(e.composedPath) ? e.composedPath()[0] : e.target, l = i.contains(a);
|
|
772
|
-
if (l || !l && e.target !== t && n) return;
|
|
773
|
-
}
|
|
774
|
-
t.setAttribute("aria-expanded", n), z(i, !n), S(this.elements.container, this.config.classNames.menu.open, n), n && r.keyboardEvent(e) ? h.focusFirstMenuItem.call(this, null, !0) : n || s || ge.call(this, t, r.keyboardEvent(e));
|
|
775
|
-
}, getMenuSize(e) {
|
|
776
|
-
const i = e.cloneNode(!0);
|
|
777
|
-
i.style.position = "absolute", i.style.opacity = 0, i.removeAttribute("hidden"), e.parentNode.appendChild(i);
|
|
778
|
-
const t = i.scrollWidth, s = i.scrollHeight;
|
|
779
|
-
return F(i), { width: t, height: s };
|
|
780
|
-
}, showMenuPanel(e = "", i = !1) {
|
|
781
|
-
const t = this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);
|
|
782
|
-
if (!r.element(t)) return;
|
|
783
|
-
const s = t.parentNode, n = Array.from(s.children).find((a) => !a.hidden);
|
|
784
|
-
if (x.transitions && !x.reducedMotion) {
|
|
785
|
-
s.style.width = `${n.scrollWidth}px`, s.style.height = `${n.scrollHeight}px`;
|
|
786
|
-
const a = h.getMenuSize.call(this, t), l = (o) => {
|
|
787
|
-
o.target === s && ["width", "height"].includes(o.propertyName) && (s.style.width = "", s.style.height = "", me.call(this, s, ve, l));
|
|
788
|
-
};
|
|
789
|
-
C.call(this, s, ve, l), s.style.width = `${a.width}px`, s.style.height = `${a.height}px`;
|
|
790
|
-
}
|
|
791
|
-
z(n, !0), z(t, !1), h.focusFirstMenuItem.call(this, t, i);
|
|
792
|
-
}, setDownloadUrl() {
|
|
793
|
-
const e = this.elements.buttons.download;
|
|
794
|
-
r.element(e) && e.setAttribute("href", this.download);
|
|
795
|
-
}, create(e) {
|
|
796
|
-
const { bindMenuItemShortcuts: i, createButton: t, createProgress: s, createRange: n, createTime: a, setQualityMenu: l, setSpeedMenu: o, showMenuPanel: c } = h;
|
|
797
|
-
this.elements.controls = null, r.array(this.config.controls) && this.config.controls.includes("play-large") && this.elements.container.appendChild(t.call(this, "play-large"));
|
|
798
|
-
const u = y("div", q(this.config.selectors.controls.wrapper));
|
|
799
|
-
this.elements.controls = u;
|
|
800
|
-
const g = { class: "plyr__controls__item" };
|
|
801
|
-
return ke(r.array(this.config.controls) ? this.config.controls : []).forEach((f) => {
|
|
802
|
-
if (f === "restart" && u.appendChild(t.call(this, "restart", g)), f === "rewind" && u.appendChild(t.call(this, "rewind", g)), f === "play" && u.appendChild(t.call(this, "play", g)), f === "fast-forward" && u.appendChild(t.call(this, "fast-forward", g)), f === "progress") {
|
|
803
|
-
const d = y("div", { class: `${g.class} plyr__progress__container` }), v = y("div", q(this.config.selectors.progress));
|
|
804
|
-
if (v.appendChild(n.call(this, "seek", { id: `plyr-seek-${e.id}` })), v.appendChild(s.call(this, "buffer")), this.config.tooltips.seek) {
|
|
805
|
-
const k = y("span", { class: this.config.classNames.tooltip }, "00:00");
|
|
806
|
-
v.appendChild(k), this.elements.display.seekTooltip = k;
|
|
807
|
-
}
|
|
808
|
-
this.elements.progress = v, d.appendChild(this.elements.progress), u.appendChild(d);
|
|
809
|
-
}
|
|
810
|
-
if (f === "current-time" && u.appendChild(a.call(this, "currentTime", g)), f === "duration" && u.appendChild(a.call(this, "duration", g)), f === "mute" || f === "volume") {
|
|
811
|
-
let { volume: d } = this.elements;
|
|
812
|
-
if (r.element(d) && u.contains(d) || (d = y("div", N({}, g, { class: `${g.class} plyr__volume`.trim() })), this.elements.volume = d, u.appendChild(d)), f === "mute" && d.appendChild(t.call(this, "mute")), f === "volume" && !O.isIos && !O.isIPadOS) {
|
|
813
|
-
const v = { max: 1, step: 0.05, value: this.config.volume };
|
|
814
|
-
d.appendChild(n.call(this, "volume", N(v, { id: `plyr-volume-${e.id}` })));
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
if (f === "captions" && u.appendChild(t.call(this, "captions", g)), f === "settings" && !r.empty(this.config.settings)) {
|
|
818
|
-
const d = y("div", N({}, g, { class: `${g.class} plyr__menu`.trim(), hidden: "" }));
|
|
819
|
-
d.appendChild(t.call(this, "settings", { "aria-haspopup": !0, "aria-controls": `plyr-settings-${e.id}`, "aria-expanded": !1 }));
|
|
820
|
-
const v = y("div", { class: "plyr__menu__container", id: `plyr-settings-${e.id}`, hidden: "" }), k = y("div"), T = y("div", { id: `plyr-settings-${e.id}-home` }), M = y("div", { role: "menu" });
|
|
821
|
-
T.appendChild(M), k.appendChild(T), this.elements.settings.panels.home = T, this.config.settings.forEach((w) => {
|
|
822
|
-
const p = y("button", N(q(this.config.selectors.buttons.settings), { type: "button", class: `${this.config.classNames.control} ${this.config.classNames.control}--forward`, role: "menuitem", "aria-haspopup": !0, hidden: "" }));
|
|
823
|
-
i.call(this, p, w), C.call(this, p, "click", () => {
|
|
824
|
-
c.call(this, w, !1);
|
|
825
|
-
});
|
|
826
|
-
const A = y("span", null, $.get(w, this.config)), L = y("span", { class: this.config.classNames.menu.value });
|
|
827
|
-
L.innerHTML = e[w], A.appendChild(L), p.appendChild(A), M.appendChild(p);
|
|
828
|
-
const j = y("div", { id: `plyr-settings-${e.id}-${w}`, hidden: "" }), H = y("button", { type: "button", class: `${this.config.classNames.control} ${this.config.classNames.control}--back` });
|
|
829
|
-
H.appendChild(y("span", { "aria-hidden": !0 }, $.get(w, this.config))), H.appendChild(y("span", { class: this.config.classNames.hidden }, $.get("menuBack", this.config))), C.call(this, j, "keydown", (D) => {
|
|
830
|
-
D.key === "ArrowLeft" && (D.preventDefault(), D.stopPropagation(), c.call(this, "home", !0));
|
|
831
|
-
}, !1), C.call(this, H, "click", () => {
|
|
832
|
-
c.call(this, "home", !1);
|
|
833
|
-
}), j.appendChild(H), j.appendChild(y("div", { role: "menu" })), k.appendChild(j), this.elements.settings.buttons[w] = p, this.elements.settings.panels[w] = j;
|
|
834
|
-
}), v.appendChild(k), d.appendChild(v), u.appendChild(d), this.elements.settings.popup = v, this.elements.settings.menu = d;
|
|
835
|
-
}
|
|
836
|
-
if (f === "pip" && x.pip && u.appendChild(t.call(this, "pip", g)), f === "airplay" && x.airplay && u.appendChild(t.call(this, "airplay", g)), f === "download") {
|
|
837
|
-
const d = N({}, g, { element: "a", href: this.download, target: "_blank" });
|
|
838
|
-
this.isHTML5 && (d.download = "");
|
|
839
|
-
const { download: v } = this.config.urls;
|
|
840
|
-
!r.url(v) && this.isEmbed && N(d, { icon: `logo-${this.provider}`, label: this.provider }), u.appendChild(t.call(this, "download", d));
|
|
841
|
-
}
|
|
842
|
-
f === "fullscreen" && u.appendChild(t.call(this, "fullscreen", g));
|
|
843
|
-
}), this.isHTML5 && l.call(this, W.getQualityOptions.call(this)), o.call(this), u;
|
|
844
|
-
}, inject() {
|
|
845
|
-
if (this.config.loadSprite) {
|
|
846
|
-
const n = h.getIconUrl.call(this);
|
|
847
|
-
n.cors && at(n.url, "sprite-plyr");
|
|
848
|
-
}
|
|
849
|
-
this.id = Math.floor(1e4 * Math.random());
|
|
850
|
-
let e = null;
|
|
851
|
-
this.elements.controls = null;
|
|
852
|
-
const i = { id: this.id, seektime: this.config.seekTime, title: this.config.title };
|
|
853
|
-
let t = !0;
|
|
854
|
-
r.function(this.config.controls) && (this.config.controls = this.config.controls.call(this, i)), this.config.controls || (this.config.controls = []), r.element(this.config.controls) || r.string(this.config.controls) ? e = this.config.controls : (e = h.create.call(this, { id: this.id, seektime: this.config.seekTime, speed: this.speed, quality: this.quality, captions: E.getLabel.call(this) }), t = !1);
|
|
855
|
-
let s;
|
|
856
|
-
if (t && r.string(this.config.controls) && (e = ((n) => {
|
|
857
|
-
let a = n;
|
|
858
|
-
return Object.entries(i).forEach(([l, o]) => {
|
|
859
|
-
a = J(a, `{${l}}`, o);
|
|
860
|
-
}), a;
|
|
861
|
-
})(e)), r.string(this.config.selectors.controls.container) && (s = document.querySelector(this.config.selectors.controls.container)), r.element(s) || (s = this.elements.container), s[r.element(e) ? "insertAdjacentElement" : "insertAdjacentHTML"]("afterbegin", e), r.element(this.elements.controls) || h.findElements.call(this), !r.empty(this.elements.buttons)) {
|
|
862
|
-
const n = (a) => {
|
|
863
|
-
const l = this.config.classNames.controlPressed;
|
|
864
|
-
a.setAttribute("aria-pressed", "false"), Object.defineProperty(a, "pressed", { configurable: !0, enumerable: !0, get: () => ce(a, l), set(o = !1) {
|
|
865
|
-
S(a, l, o), a.setAttribute("aria-pressed", o ? "true" : "false");
|
|
866
|
-
} });
|
|
867
|
-
};
|
|
868
|
-
Object.values(this.elements.buttons).filter(Boolean).forEach((a) => {
|
|
869
|
-
r.array(a) || r.nodeList(a) ? Array.from(a).filter(Boolean).forEach(n) : n(a);
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
if (O.isEdge && Je(s), this.config.tooltips.controls) {
|
|
873
|
-
const { classNames: n, selectors: a } = this.config, l = `${a.controls.wrapper} ${a.labels} .${n.hidden}`, o = G.call(this, l);
|
|
874
|
-
Array.from(o).forEach((c) => {
|
|
875
|
-
S(c, this.config.classNames.hidden, !1), S(c, this.config.classNames.tooltip, !0);
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
}, setMediaMetadata() {
|
|
879
|
-
try {
|
|
880
|
-
"mediaSession" in navigator && (navigator.mediaSession.metadata = new window.MediaMetadata({ title: this.config.mediaMetadata.title, artist: this.config.mediaMetadata.artist, album: this.config.mediaMetadata.album, artwork: this.config.mediaMetadata.artwork }));
|
|
881
|
-
} catch {
|
|
882
|
-
}
|
|
883
|
-
}, setMarkers() {
|
|
884
|
-
var e, i;
|
|
885
|
-
if (!this.duration || this.elements.markers) return;
|
|
886
|
-
const t = (e = this.config.markers) === null || e === void 0 || (i = e.points) === null || i === void 0 ? void 0 : i.filter(({ time: c }) => c > 0 && c < this.duration);
|
|
887
|
-
if (t == null || !t.length) return;
|
|
888
|
-
const s = document.createDocumentFragment(), n = document.createDocumentFragment();
|
|
889
|
-
let a = null;
|
|
890
|
-
const l = `${this.config.classNames.tooltip}--visible`, o = (c) => S(a, l, c);
|
|
891
|
-
t.forEach((c) => {
|
|
892
|
-
const u = y("span", { class: this.config.classNames.marker }, ""), g = c.time / this.duration * 100 + "%";
|
|
893
|
-
a && (u.addEventListener("mouseenter", () => {
|
|
894
|
-
c.label || (a.style.left = g, a.innerHTML = c.label, o(!0));
|
|
895
|
-
}), u.addEventListener("mouseleave", () => {
|
|
896
|
-
o(!1);
|
|
897
|
-
})), u.addEventListener("click", () => {
|
|
898
|
-
this.currentTime = c.time;
|
|
899
|
-
}), u.style.left = g, n.appendChild(u);
|
|
900
|
-
}), s.appendChild(n), this.config.tooltips.seek || (a = y("span", { class: this.config.classNames.tooltip }, ""), s.appendChild(a)), this.elements.markers = { points: n, tip: a }, this.elements.progress.appendChild(s);
|
|
901
|
-
} };
|
|
902
|
-
function lt(e, i = !0) {
|
|
903
|
-
let t = e;
|
|
904
|
-
if (i) {
|
|
905
|
-
const s = document.createElement("a");
|
|
906
|
-
s.href = t, t = s.href;
|
|
907
|
-
}
|
|
908
|
-
try {
|
|
909
|
-
return new URL(t);
|
|
910
|
-
} catch {
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
function ot(e) {
|
|
915
|
-
const i = new URLSearchParams();
|
|
916
|
-
return r.object(e) && Object.entries(e).forEach(([t, s]) => {
|
|
917
|
-
i.set(t, s);
|
|
918
|
-
}), i;
|
|
919
|
-
}
|
|
920
|
-
const E = { setup() {
|
|
921
|
-
if (!this.supported.ui) return;
|
|
922
|
-
if (!this.isVideo || this.isYouTube || this.isHTML5 && !x.textTracks) return void (r.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && h.setCaptionsMenu.call(this));
|
|
923
|
-
if (r.element(this.elements.captions) || (this.elements.captions = y("div", q(this.config.selectors.captions)), this.elements.captions.setAttribute("dir", "auto"), Kt(this.elements.captions, this.elements.wrapper)), O.isIE && window.URL) {
|
|
924
|
-
const s = this.media.querySelectorAll("track");
|
|
925
|
-
Array.from(s).forEach((n) => {
|
|
926
|
-
const a = n.getAttribute("src"), l = lt(a);
|
|
927
|
-
l !== null && l.hostname !== window.location.href.hostname && ["http:", "https:"].includes(l.protocol) && se(a, "blob").then((o) => {
|
|
928
|
-
n.setAttribute("src", window.URL.createObjectURL(o));
|
|
929
|
-
}).catch(() => {
|
|
930
|
-
F(n);
|
|
931
|
-
});
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
const e = ke((navigator.languages || [navigator.language || navigator.userLanguage || "en"]).map((s) => s.split("-")[0]));
|
|
935
|
-
let i = (this.storage.get("language") || this.config.captions.language || "auto").toLowerCase();
|
|
936
|
-
i === "auto" && ([i] = e);
|
|
937
|
-
let t = this.storage.get("captions");
|
|
938
|
-
if (r.boolean(t) || ({ active: t } = this.config.captions), Object.assign(this.captions, { toggled: !1, active: t, language: i, languages: e }), this.isHTML5) {
|
|
939
|
-
const s = this.config.captions.update ? "addtrack removetrack" : "removetrack";
|
|
940
|
-
C.call(this, this.media.textTracks, s, E.update.bind(this));
|
|
941
|
-
}
|
|
942
|
-
setTimeout(E.update.bind(this), 0);
|
|
943
|
-
}, update() {
|
|
944
|
-
const e = E.getTracks.call(this, !0), { active: i, language: t, meta: s, currentTrackNode: n } = this.captions, a = !!e.find((l) => l.language === t);
|
|
945
|
-
this.isHTML5 && this.isVideo && e.filter((l) => !s.get(l)).forEach((l) => {
|
|
946
|
-
this.debug.log("Track added", l), s.set(l, { default: l.mode === "showing" }), l.mode === "showing" && (l.mode = "hidden"), C.call(this, l, "cuechange", () => E.updateCues.call(this));
|
|
947
|
-
}), (a && this.language !== t || !e.includes(n)) && (E.setLanguage.call(this, t), E.toggle.call(this, i && a)), this.elements && S(this.elements.container, this.config.classNames.captions.enabled, !r.empty(e)), r.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && h.setCaptionsMenu.call(this);
|
|
948
|
-
}, toggle(e, i = !0) {
|
|
949
|
-
if (!this.supported.ui) return;
|
|
950
|
-
const { toggled: t } = this.captions, s = this.config.classNames.captions.active, n = r.nullOrUndefined(e) ? !t : e;
|
|
951
|
-
if (n !== t) {
|
|
952
|
-
if (i || (this.captions.active = n, this.storage.set({ captions: n })), !this.language && n && !i) {
|
|
953
|
-
const a = E.getTracks.call(this), l = E.findTrack.call(this, [this.captions.language, ...this.captions.languages], !0);
|
|
954
|
-
return this.captions.language = l.language, void E.set.call(this, a.indexOf(l));
|
|
955
|
-
}
|
|
956
|
-
this.elements.buttons.captions && (this.elements.buttons.captions.pressed = n), S(this.elements.container, s, n), this.captions.toggled = n, h.updateSetting.call(this, "captions"), b.call(this, this.media, n ? "captionsenabled" : "captionsdisabled");
|
|
957
|
-
}
|
|
958
|
-
setTimeout(() => {
|
|
959
|
-
n && this.captions.toggled && (this.captions.currentTrackNode.mode = "hidden");
|
|
960
|
-
});
|
|
961
|
-
}, set(e, i = !0) {
|
|
962
|
-
const t = E.getTracks.call(this);
|
|
963
|
-
if (e !== -1) if (r.number(e)) if (e in t) {
|
|
964
|
-
if (this.captions.currentTrack !== e) {
|
|
965
|
-
this.captions.currentTrack = e;
|
|
966
|
-
const s = t[e], { language: n } = s || {};
|
|
967
|
-
this.captions.currentTrackNode = s, h.updateSetting.call(this, "captions"), i || (this.captions.language = n, this.storage.set({ language: n })), this.isVimeo && this.embed.enableTextTrack(n), b.call(this, this.media, "languagechange");
|
|
968
|
-
}
|
|
969
|
-
E.toggle.call(this, !0, i), this.isHTML5 && this.isVideo && E.updateCues.call(this);
|
|
970
|
-
} else this.debug.warn("Track not found", e);
|
|
971
|
-
else this.debug.warn("Invalid caption argument", e);
|
|
972
|
-
else E.toggle.call(this, !1, i);
|
|
973
|
-
}, setLanguage(e, i = !0) {
|
|
974
|
-
if (!r.string(e)) return void this.debug.warn("Invalid language argument", e);
|
|
975
|
-
const t = e.toLowerCase();
|
|
976
|
-
this.captions.language = t;
|
|
977
|
-
const s = E.getTracks.call(this), n = E.findTrack.call(this, [t]);
|
|
978
|
-
E.set.call(this, s.indexOf(n), i);
|
|
979
|
-
}, getTracks(e = !1) {
|
|
980
|
-
return Array.from((this.media || {}).textTracks || []).filter((i) => !this.isHTML5 || e || this.captions.meta.has(i)).filter((i) => ["captions", "subtitles"].includes(i.kind));
|
|
981
|
-
}, findTrack(e, i = !1) {
|
|
982
|
-
const t = E.getTracks.call(this), s = (l) => Number((this.captions.meta.get(l) || {}).default), n = Array.from(t).sort((l, o) => s(o) - s(l));
|
|
983
|
-
let a;
|
|
984
|
-
return e.every((l) => (a = n.find((o) => o.language === l), !a)), a || (i ? n[0] : void 0);
|
|
985
|
-
}, getCurrentTrack() {
|
|
986
|
-
return E.getTracks.call(this)[this.currentTrack];
|
|
987
|
-
}, getLabel(e) {
|
|
988
|
-
let i = e;
|
|
989
|
-
return !r.track(i) && x.textTracks && this.captions.toggled && (i = E.getCurrentTrack.call(this)), r.track(i) ? r.empty(i.label) ? r.empty(i.language) ? $.get("enabled", this.config) : e.language.toUpperCase() : i.label : $.get("disabled", this.config);
|
|
990
|
-
}, updateCues(e) {
|
|
991
|
-
if (!this.supported.ui) return;
|
|
992
|
-
if (!r.element(this.elements.captions)) return void this.debug.warn("No captions element to render to");
|
|
993
|
-
if (!r.nullOrUndefined(e) && !Array.isArray(e)) return void this.debug.warn("updateCues: Invalid input", e);
|
|
994
|
-
let i = e;
|
|
995
|
-
if (!i) {
|
|
996
|
-
const s = E.getCurrentTrack.call(this);
|
|
997
|
-
i = Array.from((s || {}).activeCues || []).map((n) => n.getCueAsHTML()).map(ni);
|
|
998
|
-
}
|
|
999
|
-
const t = i.map((s) => s.trim()).join(`
|
|
1000
|
-
`);
|
|
1001
|
-
if (t !== this.elements.captions.innerHTML) {
|
|
1002
|
-
ae(this.elements.captions);
|
|
1003
|
-
const s = y("span", q(this.config.selectors.caption));
|
|
1004
|
-
s.innerHTML = t, this.elements.captions.appendChild(s), b.call(this, this.media, "cuechange");
|
|
1005
|
-
}
|
|
1006
|
-
} }, ct = { enabled: !0, title: "", debug: !1, autoplay: !1, autopause: !0, playsinline: !0, seekTime: 10, volume: 1, muted: !1, duration: null, displayDuration: !0, invertTime: !0, toggleInvert: !0, ratio: null, clickToPlay: !0, hideControls: !0, resetOnEnd: !1, disableContextMenu: !0, loadSprite: !0, iconPrefix: "plyr", iconUrl: "https://cdn.plyr.io/3.7.8/plyr.svg", blankVideo: "https://cdn.plyr.io/static/blank.mp4", quality: { default: 576, options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240], forced: !1, onChange: null }, loop: { active: !1 }, speed: { selected: 1, options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4] }, keyboard: { focused: !0, global: !1 }, tooltips: { controls: !1, seek: !0 }, captions: { active: !1, language: "auto", update: !1 }, fullscreen: { enabled: !0, fallback: !0, iosNative: !1 }, storage: { enabled: !0, key: "plyr" }, controls: ["play-large", "play", "progress", "current-time", "mute", "volume", "captions", "settings", "pip", "airplay", "fullscreen"], settings: ["captions", "quality", "speed"], i18n: { restart: "Restart", rewind: "Rewind {seektime}s", play: "Play", pause: "Pause", fastForward: "Forward {seektime}s", seek: "Seek", seekLabel: "{currentTime} of {duration}", played: "Played", buffered: "Buffered", currentTime: "Current time", duration: "Duration", volume: "Volume", mute: "Mute", unmute: "Unmute", enableCaptions: "Enable captions", disableCaptions: "Disable captions", download: "Download", enterFullscreen: "Enter fullscreen", exitFullscreen: "Exit fullscreen", frameTitle: "Player for {title}", captions: "Captions", settings: "Settings", pip: "PIP", menuBack: "Go back to previous menu", speed: "Speed", normal: "Normal", quality: "Quality", loop: "Loop", start: "Start", end: "End", all: "All", reset: "Reset", disabled: "Disabled", enabled: "Enabled", advertisement: "Ad", qualityBadge: { 2160: "4K", 1440: "HD", 1080: "HD", 720: "HD", 576: "SD", 480: "SD" } }, urls: { download: null, vimeo: { sdk: "https://player.vimeo.com/api/player.js", iframe: "https://player.vimeo.com/video/{0}?{1}", api: "https://vimeo.com/api/oembed.json?url={0}" }, youtube: { sdk: "https://www.youtube.com/iframe_api", api: "https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}" }, googleIMA: { sdk: "https://imasdk.googleapis.com/js/sdkloader/ima3.js" } }, listeners: { seek: null, play: null, pause: null, restart: null, rewind: null, fastForward: null, mute: null, volume: null, captions: null, download: null, fullscreen: null, pip: null, airplay: null, speed: null, quality: null, loop: null, language: null }, events: ["ended", "progress", "stalled", "playing", "waiting", "canplay", "canplaythrough", "loadstart", "loadeddata", "loadedmetadata", "timeupdate", "volumechange", "play", "pause", "error", "seeking", "seeked", "emptied", "ratechange", "cuechange", "download", "enterfullscreen", "exitfullscreen", "captionsenabled", "captionsdisabled", "languagechange", "controlshidden", "controlsshown", "ready", "statechange", "qualitychange", "adsloaded", "adscontentpause", "adscontentresume", "adstarted", "adsmidpoint", "adscomplete", "adsallcomplete", "adsimpression", "adsclick"], selectors: { editable: "input, textarea, select, [contenteditable]", container: ".plyr", controls: { container: null, wrapper: ".plyr__controls" }, labels: "[data-plyr]", buttons: { play: '[data-plyr="play"]', pause: '[data-plyr="pause"]', restart: '[data-plyr="restart"]', rewind: '[data-plyr="rewind"]', fastForward: '[data-plyr="fast-forward"]', mute: '[data-plyr="mute"]', captions: '[data-plyr="captions"]', download: '[data-plyr="download"]', fullscreen: '[data-plyr="fullscreen"]', pip: '[data-plyr="pip"]', airplay: '[data-plyr="airplay"]', settings: '[data-plyr="settings"]', loop: '[data-plyr="loop"]' }, inputs: { seek: '[data-plyr="seek"]', volume: '[data-plyr="volume"]', speed: '[data-plyr="speed"]', language: '[data-plyr="language"]', quality: '[data-plyr="quality"]' }, display: { currentTime: ".plyr__time--current", duration: ".plyr__time--duration", buffer: ".plyr__progress__buffer", loop: ".plyr__progress__loop", volume: ".plyr__volume--display" }, progress: ".plyr__progress", captions: ".plyr__captions", caption: ".plyr__caption" }, classNames: { type: "plyr--{0}", provider: "plyr--{0}", video: "plyr__video-wrapper", embed: "plyr__video-embed", videoFixedRatio: "plyr__video-wrapper--fixed-ratio", embedContainer: "plyr__video-embed__container", poster: "plyr__poster", posterEnabled: "plyr__poster-enabled", ads: "plyr__ads", control: "plyr__control", controlPressed: "plyr__control--pressed", playing: "plyr--playing", paused: "plyr--paused", stopped: "plyr--stopped", loading: "plyr--loading", hover: "plyr--hover", tooltip: "plyr__tooltip", cues: "plyr__cues", marker: "plyr__progress__marker", hidden: "plyr__sr-only", hideControls: "plyr--hide-controls", isTouch: "plyr--is-touch", uiSupported: "plyr--full-ui", noTransition: "plyr--no-transition", display: { time: "plyr__time" }, menu: { value: "plyr__menu__value", badge: "plyr__badge", open: "plyr--menu-open" }, captions: { enabled: "plyr--captions-enabled", active: "plyr--captions-active" }, fullscreen: { enabled: "plyr--fullscreen-enabled", fallback: "plyr--fullscreen-fallback" }, pip: { supported: "plyr--pip-supported", active: "plyr--pip-active" }, airplay: { supported: "plyr--airplay-supported", active: "plyr--airplay-active" }, previewThumbnails: { thumbContainer: "plyr__preview-thumb", thumbContainerShown: "plyr__preview-thumb--is-shown", imageContainer: "plyr__preview-thumb__image-container", timeContainer: "plyr__preview-thumb__time-container", scrubbingContainer: "plyr__preview-scrubbing", scrubbingContainerShown: "plyr__preview-scrubbing--is-shown" } }, attributes: { embed: { provider: "data-plyr-provider", id: "data-plyr-embed-id", hash: "data-plyr-embed-hash" } }, ads: { enabled: !1, publisherId: "", tagUrl: "" }, previewThumbnails: { enabled: !1, src: "" }, vimeo: { byline: !1, portrait: !1, title: !1, speed: !0, transparent: !1, customControls: !0, referrerPolicy: null, premium: !1 }, youtube: { rel: 0, showinfo: 0, iv_load_policy: 3, modestbranding: 1, customControls: !0, noCookie: !1 }, mediaMetadata: { title: "", artist: "", album: "", artwork: [] }, markers: { enabled: !1, points: [] } }, fe = { active: "picture-in-picture", inactive: "inline" }, B = { html5: "html5", youtube: "youtube", vimeo: "vimeo" }, ye = { audio: "audio", video: "video" };
|
|
1007
|
-
function li(e) {
|
|
1008
|
-
return /^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e) ? B.youtube : /^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e) ? B.vimeo : null;
|
|
1009
|
-
}
|
|
1010
|
-
const be = () => {
|
|
1011
|
-
};
|
|
1012
|
-
class oi {
|
|
1013
|
-
constructor(i = !1) {
|
|
1014
|
-
this.enabled = window.console && i, this.enabled && this.log("Debugging enabled");
|
|
1015
|
-
}
|
|
1016
|
-
get log() {
|
|
1017
|
-
return this.enabled ? Function.prototype.bind.call(console.log, console) : be;
|
|
1018
|
-
}
|
|
1019
|
-
get warn() {
|
|
1020
|
-
return this.enabled ? Function.prototype.bind.call(console.warn, console) : be;
|
|
1021
|
-
}
|
|
1022
|
-
get error() {
|
|
1023
|
-
return this.enabled ? Function.prototype.bind.call(console.error, console) : be;
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
class R {
|
|
1027
|
-
constructor(i) {
|
|
1028
|
-
m(this, "onChange", () => {
|
|
1029
|
-
if (!this.supported) return;
|
|
1030
|
-
const t = this.player.elements.buttons.fullscreen;
|
|
1031
|
-
r.element(t) && (t.pressed = this.active);
|
|
1032
|
-
const s = this.target === this.player.media ? this.target : this.player.elements.container;
|
|
1033
|
-
b.call(this.player, s, this.active ? "enterfullscreen" : "exitfullscreen", !0);
|
|
1034
|
-
}), m(this, "toggleFallback", (t = !1) => {
|
|
1035
|
-
if (t ? this.scrollPosition = { x: window.scrollX ?? 0, y: window.scrollY ?? 0 } : window.scrollTo(this.scrollPosition.x, this.scrollPosition.y), document.body.style.overflow = t ? "hidden" : "", S(this.target, this.player.config.classNames.fullscreen.fallback, t), O.isIos) {
|
|
1036
|
-
let s = document.head.querySelector('meta[name="viewport"]');
|
|
1037
|
-
const n = "viewport-fit=cover";
|
|
1038
|
-
s || (s = document.createElement("meta"), s.setAttribute("name", "viewport"));
|
|
1039
|
-
const a = r.string(s.content) && s.content.includes(n);
|
|
1040
|
-
t ? (this.cleanupViewport = !a, a || (s.content += `,${n}`)) : this.cleanupViewport && (s.content = s.content.split(",").filter((l) => l.trim() !== n).join(","));
|
|
1041
|
-
}
|
|
1042
|
-
this.onChange();
|
|
1043
|
-
}), m(this, "trapFocus", (t) => {
|
|
1044
|
-
if (O.isIos || O.isIPadOS || !this.active || t.key !== "Tab") return;
|
|
1045
|
-
const s = document.activeElement, n = G.call(this.player, "a[href], button:not(:disabled), input:not(:disabled), [tabindex]"), [a] = n, l = n[n.length - 1];
|
|
1046
|
-
s !== l || t.shiftKey ? s === a && t.shiftKey && (l.focus(), t.preventDefault()) : (a.focus(), t.preventDefault());
|
|
1047
|
-
}), m(this, "update", () => {
|
|
1048
|
-
if (this.supported) {
|
|
1049
|
-
let t;
|
|
1050
|
-
t = this.forceFallback ? "Fallback (forced)" : R.nativeSupported ? "Native" : "Fallback", this.player.debug.log(`${t} fullscreen enabled`);
|
|
1051
|
-
} else this.player.debug.log("Fullscreen not supported and fallback disabled");
|
|
1052
|
-
S(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.supported);
|
|
1053
|
-
}), m(this, "enter", () => {
|
|
1054
|
-
this.supported && (O.isIos && this.player.config.fullscreen.iosNative ? this.player.isVimeo ? this.player.embed.requestFullscreen() : this.target.webkitEnterFullscreen() : !R.nativeSupported || this.forceFallback ? this.toggleFallback(!0) : this.prefix ? r.empty(this.prefix) || this.target[`${this.prefix}Request${this.property}`]() : this.target.requestFullscreen({ navigationUI: "hide" }));
|
|
1055
|
-
}), m(this, "exit", () => {
|
|
1056
|
-
if (this.supported) if (O.isIos && this.player.config.fullscreen.iosNative) this.player.isVimeo ? this.player.embed.exitFullscreen() : this.target.webkitEnterFullscreen(), V(this.player.play());
|
|
1057
|
-
else if (!R.nativeSupported || this.forceFallback) this.toggleFallback(!1);
|
|
1058
|
-
else if (this.prefix) {
|
|
1059
|
-
if (!r.empty(this.prefix)) {
|
|
1060
|
-
const t = this.prefix === "moz" ? "Cancel" : "Exit";
|
|
1061
|
-
document[`${this.prefix}${t}${this.property}`]();
|
|
1062
|
-
}
|
|
1063
|
-
} else (document.cancelFullScreen || document.exitFullscreen).call(document);
|
|
1064
|
-
}), m(this, "toggle", () => {
|
|
1065
|
-
this.active ? this.exit() : this.enter();
|
|
1066
|
-
}), this.player = i, this.prefix = R.prefix, this.property = R.property, this.scrollPosition = { x: 0, y: 0 }, this.forceFallback = i.config.fullscreen.fallback === "force", this.player.elements.fullscreen = i.config.fullscreen.container && Yt(this.player.elements.container, i.config.fullscreen.container), C.call(this.player, document, this.prefix === "ms" ? "MSFullscreenChange" : `${this.prefix}fullscreenchange`, () => {
|
|
1067
|
-
this.onChange();
|
|
1068
|
-
}), C.call(this.player, this.player.elements.container, "dblclick", (t) => {
|
|
1069
|
-
r.element(this.player.elements.controls) && this.player.elements.controls.contains(t.target) || this.player.listeners.proxy(t, this.toggle, "fullscreen");
|
|
1070
|
-
}), C.call(this, this.player.elements.container, "keydown", (t) => this.trapFocus(t)), this.update();
|
|
1071
|
-
}
|
|
1072
|
-
static get nativeSupported() {
|
|
1073
|
-
return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
|
|
1074
|
-
}
|
|
1075
|
-
get useNative() {
|
|
1076
|
-
return R.nativeSupported && !this.forceFallback;
|
|
1077
|
-
}
|
|
1078
|
-
static get prefix() {
|
|
1079
|
-
if (r.function(document.exitFullscreen)) return "";
|
|
1080
|
-
let i = "";
|
|
1081
|
-
return ["webkit", "moz", "ms"].some((t) => !(!r.function(document[`${t}ExitFullscreen`]) && !r.function(document[`${t}CancelFullScreen`])) && (i = t, !0)), i;
|
|
1082
|
-
}
|
|
1083
|
-
static get property() {
|
|
1084
|
-
return this.prefix === "moz" ? "FullScreen" : "Fullscreen";
|
|
1085
|
-
}
|
|
1086
|
-
get supported() {
|
|
1087
|
-
return [this.player.config.fullscreen.enabled, this.player.isVideo, R.nativeSupported || this.player.config.fullscreen.fallback, !this.player.isYouTube || R.nativeSupported || !O.isIos || this.player.config.playsinline && !this.player.config.fullscreen.iosNative].every(Boolean);
|
|
1088
|
-
}
|
|
1089
|
-
get active() {
|
|
1090
|
-
if (!this.supported) return !1;
|
|
1091
|
-
if (!R.nativeSupported || this.forceFallback) return ce(this.target, this.player.config.classNames.fullscreen.fallback);
|
|
1092
|
-
const i = this.prefix ? this.target.getRootNode()[`${this.prefix}${this.property}Element`] : this.target.getRootNode().fullscreenElement;
|
|
1093
|
-
return i && i.shadowRoot ? i === this.target.getRootNode().host : i === this.target;
|
|
1094
|
-
}
|
|
1095
|
-
get target() {
|
|
1096
|
-
return O.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen ?? this.player.elements.container;
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
function re(e, i = 1) {
|
|
1100
|
-
return new Promise((t, s) => {
|
|
1101
|
-
const n = new Image(), a = () => {
|
|
1102
|
-
delete n.onload, delete n.onerror, (n.naturalWidth >= i ? t : s)(n);
|
|
1103
|
-
};
|
|
1104
|
-
Object.assign(n, { onload: a, onerror: a, src: e });
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
const P = { addStyleHook() {
|
|
1108
|
-
S(this.elements.container, this.config.selectors.container.replace(".", ""), !0), S(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
|
|
1109
|
-
}, toggleNativeControls(e = !1) {
|
|
1110
|
-
e && this.isHTML5 ? this.media.setAttribute("controls", "") : this.media.removeAttribute("controls");
|
|
1111
|
-
}, build() {
|
|
1112
|
-
if (this.listeners.media(), !this.supported.ui) return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`), void P.toggleNativeControls.call(this, !0);
|
|
1113
|
-
r.element(this.elements.controls) || (h.inject.call(this), this.listeners.controls()), P.toggleNativeControls.call(this), this.isHTML5 && E.setup.call(this), this.volume = null, this.muted = null, this.loop = null, this.quality = null, this.speed = null, h.updateVolume.call(this), h.timeUpdate.call(this), h.durationUpdate.call(this), P.checkPlaying.call(this), S(this.elements.container, this.config.classNames.pip.supported, x.pip && this.isHTML5 && this.isVideo), S(this.elements.container, this.config.classNames.airplay.supported, x.airplay && this.isHTML5), S(this.elements.container, this.config.classNames.isTouch, this.touch), this.ready = !0, setTimeout(() => {
|
|
1114
|
-
b.call(this, this.media, "ready");
|
|
1115
|
-
}, 0), P.setTitle.call(this), this.poster && P.setPoster.call(this, this.poster, !1).catch(() => {
|
|
1116
|
-
}), this.config.duration && h.durationUpdate.call(this), this.config.mediaMetadata && h.setMediaMetadata.call(this);
|
|
1117
|
-
}, setTitle() {
|
|
1118
|
-
let e = $.get("play", this.config);
|
|
1119
|
-
if (r.string(this.config.title) && !r.empty(this.config.title) && (e += `, ${this.config.title}`), Array.from(this.elements.buttons.play || []).forEach((i) => {
|
|
1120
|
-
i.setAttribute("aria-label", e);
|
|
1121
|
-
}), this.isEmbed) {
|
|
1122
|
-
const i = I.call(this, "iframe");
|
|
1123
|
-
if (!r.element(i)) return;
|
|
1124
|
-
const t = r.empty(this.config.title) ? "video" : this.config.title, s = $.get("frameTitle", this.config);
|
|
1125
|
-
i.setAttribute("title", s.replace("{title}", t));
|
|
1126
|
-
}
|
|
1127
|
-
}, togglePoster(e) {
|
|
1128
|
-
S(this.elements.container, this.config.classNames.posterEnabled, e);
|
|
1129
|
-
}, setPoster(e, i = !0) {
|
|
1130
|
-
return i && this.poster ? Promise.reject(new Error("Poster already set")) : (this.media.setAttribute("data-poster", e), this.elements.poster.removeAttribute("hidden"), Jt.call(this).then(() => re(e)).catch((t) => {
|
|
1131
|
-
throw e === this.poster && P.togglePoster.call(this, !1), t;
|
|
1132
|
-
}).then(() => {
|
|
1133
|
-
if (e !== this.poster) throw new Error("setPoster cancelled by later call to setPoster");
|
|
1134
|
-
}).then(() => (Object.assign(this.elements.poster.style, { backgroundImage: `url('${e}')`, backgroundSize: "" }), P.togglePoster.call(this, !0), e)));
|
|
1135
|
-
}, checkPlaying(e) {
|
|
1136
|
-
S(this.elements.container, this.config.classNames.playing, this.playing), S(this.elements.container, this.config.classNames.paused, this.paused), S(this.elements.container, this.config.classNames.stopped, this.stopped), Array.from(this.elements.buttons.play || []).forEach((i) => {
|
|
1137
|
-
Object.assign(i, { pressed: this.playing }), i.setAttribute("aria-label", $.get(this.playing ? "pause" : "play", this.config));
|
|
1138
|
-
}), r.event(e) && e.type === "timeupdate" || P.toggleControls.call(this);
|
|
1139
|
-
}, checkLoading(e) {
|
|
1140
|
-
this.loading = ["stalled", "waiting"].includes(e.type), clearTimeout(this.timers.loading), this.timers.loading = setTimeout(() => {
|
|
1141
|
-
S(this.elements.container, this.config.classNames.loading, this.loading), P.toggleControls.call(this);
|
|
1142
|
-
}, this.loading ? 250 : 0);
|
|
1143
|
-
}, toggleControls(e) {
|
|
1144
|
-
const { controls: i } = this.elements;
|
|
1145
|
-
if (i && this.config.hideControls) {
|
|
1146
|
-
const t = this.touch && this.lastSeekTime + 2e3 > Date.now();
|
|
1147
|
-
this.toggleControls(!!(e || this.loading || this.paused || i.pressed || i.hover || t));
|
|
1148
|
-
}
|
|
1149
|
-
}, migrateStyles() {
|
|
1150
|
-
Object.values({ ...this.media.style }).filter((e) => !r.empty(e) && r.string(e) && e.startsWith("--plyr")).forEach((e) => {
|
|
1151
|
-
this.elements.container.style.setProperty(e, this.media.style.getPropertyValue(e)), this.media.style.removeProperty(e);
|
|
1152
|
-
}), r.empty(this.media.style) && this.media.removeAttribute("style");
|
|
1153
|
-
} };
|
|
1154
|
-
class ci {
|
|
1155
|
-
constructor(i) {
|
|
1156
|
-
m(this, "firstTouch", () => {
|
|
1157
|
-
const { player: t } = this, { elements: s } = t;
|
|
1158
|
-
t.touch = !0, S(s.container, t.config.classNames.isTouch, !0);
|
|
1159
|
-
}), m(this, "global", (t = !0) => {
|
|
1160
|
-
const { player: s } = this;
|
|
1161
|
-
s.config.keyboard.global && Z.call(s, window, "keydown keyup", this.handleKey, t, !1), Z.call(s, document.body, "click", this.toggleMenu, t), Me.call(s, document.body, "touchstart", this.firstTouch);
|
|
1162
|
-
}), m(this, "container", () => {
|
|
1163
|
-
const { player: t } = this, { config: s, elements: n, timers: a } = t;
|
|
1164
|
-
!s.keyboard.global && s.keyboard.focused && C.call(t, n.container, "keydown keyup", this.handleKey, !1), C.call(t, n.container, "mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen", (c) => {
|
|
1165
|
-
const { controls: u } = n;
|
|
1166
|
-
u && c.type === "enterfullscreen" && (u.pressed = !1, u.hover = !1);
|
|
1167
|
-
let g = 0;
|
|
1168
|
-
["touchstart", "touchmove", "mousemove"].includes(c.type) && (P.toggleControls.call(t, !0), g = t.touch ? 3e3 : 2e3), clearTimeout(a.controls), a.controls = setTimeout(() => P.toggleControls.call(t, !1), g);
|
|
1169
|
-
});
|
|
1170
|
-
const l = () => {
|
|
1171
|
-
if (!t.isVimeo || t.config.vimeo.premium) return;
|
|
1172
|
-
const c = n.wrapper, { active: u } = t.fullscreen, [g, f] = Ne.call(t), d = tt(`aspect-ratio: ${g} / ${f}`);
|
|
1173
|
-
if (!u) return void (d ? (c.style.width = null, c.style.height = null) : (c.style.maxWidth = null, c.style.margin = null));
|
|
1174
|
-
const [v, k] = Gt(), T = v / k > g / f;
|
|
1175
|
-
d ? (c.style.width = T ? "auto" : "100%", c.style.height = T ? "100%" : "auto") : (c.style.maxWidth = T ? k / f * g + "px" : null, c.style.margin = T ? "0 auto" : null);
|
|
1176
|
-
}, o = () => {
|
|
1177
|
-
clearTimeout(a.resized), a.resized = setTimeout(l, 50);
|
|
1178
|
-
};
|
|
1179
|
-
C.call(t, n.container, "enterfullscreen exitfullscreen", (c) => {
|
|
1180
|
-
const { target: u } = t.fullscreen;
|
|
1181
|
-
u === n.container && (!t.isEmbed && r.empty(t.config.ratio) || (l(), (c.type === "enterfullscreen" ? C : me).call(t, window, "resize", o)));
|
|
1182
|
-
});
|
|
1183
|
-
}), m(this, "media", () => {
|
|
1184
|
-
const { player: t } = this, { elements: s } = t;
|
|
1185
|
-
if (C.call(t, t.media, "timeupdate seeking seeked", (a) => h.timeUpdate.call(t, a)), C.call(t, t.media, "durationchange loadeddata loadedmetadata", (a) => h.durationUpdate.call(t, a)), C.call(t, t.media, "ended", () => {
|
|
1186
|
-
t.isHTML5 && t.isVideo && t.config.resetOnEnd && (t.restart(), t.pause());
|
|
1187
|
-
}), C.call(t, t.media, "progress playing seeking seeked", (a) => h.updateProgress.call(t, a)), C.call(t, t.media, "volumechange", (a) => h.updateVolume.call(t, a)), C.call(t, t.media, "playing play pause ended emptied timeupdate", (a) => P.checkPlaying.call(t, a)), C.call(t, t.media, "waiting canplay seeked playing", (a) => P.checkLoading.call(t, a)), t.supported.ui && t.config.clickToPlay && !t.isAudio) {
|
|
1188
|
-
const a = I.call(t, `.${t.config.classNames.video}`);
|
|
1189
|
-
if (!r.element(a)) return;
|
|
1190
|
-
C.call(t, s.container, "click", (l) => {
|
|
1191
|
-
([s.container, a].includes(l.target) || a.contains(l.target)) && (t.touch && t.config.hideControls || (t.ended ? (this.proxy(l, t.restart, "restart"), this.proxy(l, () => {
|
|
1192
|
-
V(t.play());
|
|
1193
|
-
}, "play")) : this.proxy(l, () => {
|
|
1194
|
-
V(t.togglePlay());
|
|
1195
|
-
}, "play")));
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
t.supported.ui && t.config.disableContextMenu && C.call(t, s.wrapper, "contextmenu", (a) => {
|
|
1199
|
-
a.preventDefault();
|
|
1200
|
-
}, !1), C.call(t, t.media, "volumechange", () => {
|
|
1201
|
-
t.storage.set({ volume: t.volume, muted: t.muted });
|
|
1202
|
-
}), C.call(t, t.media, "ratechange", () => {
|
|
1203
|
-
h.updateSetting.call(t, "speed"), t.storage.set({ speed: t.speed });
|
|
1204
|
-
}), C.call(t, t.media, "qualitychange", (a) => {
|
|
1205
|
-
h.updateSetting.call(t, "quality", null, a.detail.quality);
|
|
1206
|
-
}), C.call(t, t.media, "ready qualitychange", () => {
|
|
1207
|
-
h.setDownloadUrl.call(t);
|
|
1208
|
-
});
|
|
1209
|
-
const n = t.config.events.concat(["keyup", "keydown"]).join(" ");
|
|
1210
|
-
C.call(t, t.media, n, (a) => {
|
|
1211
|
-
let { detail: l = {} } = a;
|
|
1212
|
-
a.type === "error" && (l = t.media.error), b.call(t, s.container, a.type, !0, l);
|
|
1213
|
-
});
|
|
1214
|
-
}), m(this, "proxy", (t, s, n) => {
|
|
1215
|
-
const { player: a } = this, l = a.config.listeners[n];
|
|
1216
|
-
let o = !0;
|
|
1217
|
-
r.function(l) && (o = l.call(a, t)), o !== !1 && r.function(s) && s.call(a, t);
|
|
1218
|
-
}), m(this, "bind", (t, s, n, a, l = !0) => {
|
|
1219
|
-
const { player: o } = this, c = o.config.listeners[a], u = r.function(c);
|
|
1220
|
-
C.call(o, t, s, (g) => this.proxy(g, n, a), l && !u);
|
|
1221
|
-
}), m(this, "controls", () => {
|
|
1222
|
-
const { player: t } = this, { elements: s } = t, n = O.isIE ? "change" : "input";
|
|
1223
|
-
if (s.buttons.play && Array.from(s.buttons.play).forEach((a) => {
|
|
1224
|
-
this.bind(a, "click", () => {
|
|
1225
|
-
V(t.togglePlay());
|
|
1226
|
-
}, "play");
|
|
1227
|
-
}), this.bind(s.buttons.restart, "click", t.restart, "restart"), this.bind(s.buttons.rewind, "click", () => {
|
|
1228
|
-
t.lastSeekTime = Date.now(), t.rewind();
|
|
1229
|
-
}, "rewind"), this.bind(s.buttons.fastForward, "click", () => {
|
|
1230
|
-
t.lastSeekTime = Date.now(), t.forward();
|
|
1231
|
-
}, "fastForward"), this.bind(s.buttons.mute, "click", () => {
|
|
1232
|
-
t.muted = !t.muted;
|
|
1233
|
-
}, "mute"), this.bind(s.buttons.captions, "click", () => t.toggleCaptions()), this.bind(s.buttons.download, "click", () => {
|
|
1234
|
-
b.call(t, t.media, "download");
|
|
1235
|
-
}, "download"), this.bind(s.buttons.fullscreen, "click", () => {
|
|
1236
|
-
t.fullscreen.toggle();
|
|
1237
|
-
}, "fullscreen"), this.bind(s.buttons.pip, "click", () => {
|
|
1238
|
-
t.pip = "toggle";
|
|
1239
|
-
}, "pip"), this.bind(s.buttons.airplay, "click", t.airplay, "airplay"), this.bind(s.buttons.settings, "click", (a) => {
|
|
1240
|
-
a.stopPropagation(), a.preventDefault(), h.toggleMenu.call(t, a);
|
|
1241
|
-
}, null, !1), this.bind(s.buttons.settings, "keyup", (a) => {
|
|
1242
|
-
[" ", "Enter"].includes(a.key) && (a.key !== "Enter" ? (a.preventDefault(), a.stopPropagation(), h.toggleMenu.call(t, a)) : h.focusFirstMenuItem.call(t, null, !0));
|
|
1243
|
-
}, null, !1), this.bind(s.settings.menu, "keydown", (a) => {
|
|
1244
|
-
a.key === "Escape" && h.toggleMenu.call(t, a);
|
|
1245
|
-
}), this.bind(s.inputs.seek, "mousedown mousemove", (a) => {
|
|
1246
|
-
const l = s.progress.getBoundingClientRect(), o = 100 / l.width * (a.pageX - l.left);
|
|
1247
|
-
a.currentTarget.setAttribute("seek-value", o);
|
|
1248
|
-
}), this.bind(s.inputs.seek, "mousedown mouseup keydown keyup touchstart touchend", (a) => {
|
|
1249
|
-
const l = a.currentTarget, o = "play-on-seeked";
|
|
1250
|
-
if (r.keyboardEvent(a) && !["ArrowLeft", "ArrowRight"].includes(a.key)) return;
|
|
1251
|
-
t.lastSeekTime = Date.now();
|
|
1252
|
-
const c = l.hasAttribute(o), u = ["mouseup", "touchend", "keyup"].includes(a.type);
|
|
1253
|
-
c && u ? (l.removeAttribute(o), V(t.play())) : !u && t.playing && (l.setAttribute(o, ""), t.pause());
|
|
1254
|
-
}), O.isIos) {
|
|
1255
|
-
const a = G.call(t, 'input[type="range"]');
|
|
1256
|
-
Array.from(a).forEach((l) => this.bind(l, n, (o) => Je(o.target)));
|
|
1257
|
-
}
|
|
1258
|
-
this.bind(s.inputs.seek, n, (a) => {
|
|
1259
|
-
const l = a.currentTarget;
|
|
1260
|
-
let o = l.getAttribute("seek-value");
|
|
1261
|
-
r.empty(o) && (o = l.value), l.removeAttribute("seek-value"), t.currentTime = o / l.max * t.duration;
|
|
1262
|
-
}, "seek"), this.bind(s.progress, "mouseenter mouseleave mousemove", (a) => h.updateSeekTooltip.call(t, a)), this.bind(s.progress, "mousemove touchmove", (a) => {
|
|
1263
|
-
const { previewThumbnails: l } = t;
|
|
1264
|
-
l && l.loaded && l.startMove(a);
|
|
1265
|
-
}), this.bind(s.progress, "mouseleave touchend click", () => {
|
|
1266
|
-
const { previewThumbnails: a } = t;
|
|
1267
|
-
a && a.loaded && a.endMove(!1, !0);
|
|
1268
|
-
}), this.bind(s.progress, "mousedown touchstart", (a) => {
|
|
1269
|
-
const { previewThumbnails: l } = t;
|
|
1270
|
-
l && l.loaded && l.startScrubbing(a);
|
|
1271
|
-
}), this.bind(s.progress, "mouseup touchend", (a) => {
|
|
1272
|
-
const { previewThumbnails: l } = t;
|
|
1273
|
-
l && l.loaded && l.endScrubbing(a);
|
|
1274
|
-
}), O.isWebKit && Array.from(G.call(t, 'input[type="range"]')).forEach((a) => {
|
|
1275
|
-
this.bind(a, "input", (l) => h.updateRangeFill.call(t, l.target));
|
|
1276
|
-
}), t.config.toggleInvert && !r.element(s.display.duration) && this.bind(s.display.currentTime, "click", () => {
|
|
1277
|
-
t.currentTime !== 0 && (t.config.invertTime = !t.config.invertTime, h.timeUpdate.call(t));
|
|
1278
|
-
}), this.bind(s.inputs.volume, n, (a) => {
|
|
1279
|
-
t.volume = a.target.value;
|
|
1280
|
-
}, "volume"), this.bind(s.controls, "mouseenter mouseleave", (a) => {
|
|
1281
|
-
s.controls.hover = !t.touch && a.type === "mouseenter";
|
|
1282
|
-
}), s.fullscreen && Array.from(s.fullscreen.children).filter((a) => !a.contains(s.container)).forEach((a) => {
|
|
1283
|
-
this.bind(a, "mouseenter mouseleave", (l) => {
|
|
1284
|
-
s.controls && (s.controls.hover = !t.touch && l.type === "mouseenter");
|
|
1285
|
-
});
|
|
1286
|
-
}), this.bind(s.controls, "mousedown mouseup touchstart touchend touchcancel", (a) => {
|
|
1287
|
-
s.controls.pressed = ["mousedown", "touchstart"].includes(a.type);
|
|
1288
|
-
}), this.bind(s.controls, "focusin", () => {
|
|
1289
|
-
const { config: a, timers: l } = t;
|
|
1290
|
-
S(s.controls, a.classNames.noTransition, !0), P.toggleControls.call(t, !0), setTimeout(() => {
|
|
1291
|
-
S(s.controls, a.classNames.noTransition, !1);
|
|
1292
|
-
}, 0);
|
|
1293
|
-
const o = this.touch ? 3e3 : 4e3;
|
|
1294
|
-
clearTimeout(l.controls), l.controls = setTimeout(() => P.toggleControls.call(t, !1), o);
|
|
1295
|
-
}), this.bind(s.inputs.volume, "wheel", (a) => {
|
|
1296
|
-
const l = a.webkitDirectionInvertedFromDevice, [o, c] = [a.deltaX, -a.deltaY].map((f) => l ? -f : f), u = Math.sign(Math.abs(o) > Math.abs(c) ? o : c);
|
|
1297
|
-
t.increaseVolume(u / 50);
|
|
1298
|
-
const { volume: g } = t.media;
|
|
1299
|
-
(u === 1 && g < 1 || u === -1 && g > 0) && a.preventDefault();
|
|
1300
|
-
}, "volume", !1);
|
|
1301
|
-
}), this.player = i, this.lastKey = null, this.focusTimer = null, this.lastKeyDown = null, this.handleKey = this.handleKey.bind(this), this.toggleMenu = this.toggleMenu.bind(this), this.firstTouch = this.firstTouch.bind(this);
|
|
1302
|
-
}
|
|
1303
|
-
handleKey(i) {
|
|
1304
|
-
const { player: t } = this, { elements: s } = t, { key: n, type: a, altKey: l, ctrlKey: o, metaKey: c, shiftKey: u } = i, g = a === "keydown", f = g && n === this.lastKey;
|
|
1305
|
-
if (!(l || o || c || u) && n) {
|
|
1306
|
-
if (g) {
|
|
1307
|
-
const v = document.activeElement;
|
|
1308
|
-
if (r.element(v)) {
|
|
1309
|
-
const { editable: k } = t.config.selectors, { seek: T } = s.inputs;
|
|
1310
|
-
if (v !== T && K(v, k) || i.key === " " && K(v, 'button, [role^="menuitem"]')) return;
|
|
1311
|
-
}
|
|
1312
|
-
switch ([" ", "ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "c", "f", "k", "l", "m"].includes(n) && (i.preventDefault(), i.stopPropagation()), n) {
|
|
1313
|
-
case "0":
|
|
1314
|
-
case "1":
|
|
1315
|
-
case "2":
|
|
1316
|
-
case "3":
|
|
1317
|
-
case "4":
|
|
1318
|
-
case "5":
|
|
1319
|
-
case "6":
|
|
1320
|
-
case "7":
|
|
1321
|
-
case "8":
|
|
1322
|
-
case "9":
|
|
1323
|
-
f || (d = parseInt(n, 10), t.currentTime = t.duration / 10 * d);
|
|
1324
|
-
break;
|
|
1325
|
-
case " ":
|
|
1326
|
-
case "k":
|
|
1327
|
-
f || V(t.togglePlay());
|
|
1328
|
-
break;
|
|
1329
|
-
case "ArrowUp":
|
|
1330
|
-
t.increaseVolume(0.1);
|
|
1331
|
-
break;
|
|
1332
|
-
case "ArrowDown":
|
|
1333
|
-
t.decreaseVolume(0.1);
|
|
1334
|
-
break;
|
|
1335
|
-
case "m":
|
|
1336
|
-
f || (t.muted = !t.muted);
|
|
1337
|
-
break;
|
|
1338
|
-
case "ArrowRight":
|
|
1339
|
-
t.forward();
|
|
1340
|
-
break;
|
|
1341
|
-
case "ArrowLeft":
|
|
1342
|
-
t.rewind();
|
|
1343
|
-
break;
|
|
1344
|
-
case "f":
|
|
1345
|
-
t.fullscreen.toggle();
|
|
1346
|
-
break;
|
|
1347
|
-
case "c":
|
|
1348
|
-
f || t.toggleCaptions();
|
|
1349
|
-
break;
|
|
1350
|
-
case "l":
|
|
1351
|
-
t.loop = !t.loop;
|
|
1352
|
-
}
|
|
1353
|
-
n === "Escape" && !t.fullscreen.usingNative && t.fullscreen.active && t.fullscreen.toggle(), this.lastKey = n;
|
|
1354
|
-
} else this.lastKey = null;
|
|
1355
|
-
var d;
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
toggleMenu(i) {
|
|
1359
|
-
h.toggleMenu.call(this.player, i);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
function ui(e, i) {
|
|
1363
|
-
return e(i = { exports: {} }, i.exports), i.exports;
|
|
1364
|
-
}
|
|
1365
|
-
var hi = ui(function(e, i) {
|
|
1366
|
-
e.exports = function() {
|
|
1367
|
-
var t = function() {
|
|
1368
|
-
}, s = {}, n = {}, a = {};
|
|
1369
|
-
function l(d, v) {
|
|
1370
|
-
d = d.push ? d : [d];
|
|
1371
|
-
var k, T, M, w = [], p = d.length, A = p;
|
|
1372
|
-
for (k = function(L, j) {
|
|
1373
|
-
j.length && w.push(L), --A || v(w);
|
|
1374
|
-
}; p--; ) T = d[p], (M = n[T]) ? k(T, M) : (a[T] = a[T] || []).push(k);
|
|
1375
|
-
}
|
|
1376
|
-
function o(d, v) {
|
|
1377
|
-
if (d) {
|
|
1378
|
-
var k = a[d];
|
|
1379
|
-
if (n[d] = v, k) for (; k.length; ) k[0](d, v), k.splice(0, 1);
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
function c(d, v) {
|
|
1383
|
-
d.call && (d = { success: d }), v.length ? (d.error || t)(v) : (d.success || t)(d);
|
|
1384
|
-
}
|
|
1385
|
-
function u(d, v, k, T) {
|
|
1386
|
-
var M, w, p = document, A = k.async, L = (k.numRetries || 0) + 1, j = k.before || t, H = d.replace(/[\?|#].*$/, ""), D = d.replace(/^(css|img)!/, "");
|
|
1387
|
-
T = T || 0, /(^css!|\.css$)/.test(H) ? ((w = p.createElement("link")).rel = "stylesheet", w.href = D, (M = "hideFocus" in w) && w.relList && (M = 0, w.rel = "preload", w.as = "style")) : /(^img!|\.(png|gif|jpg|svg|webp)$)/.test(H) ? (w = p.createElement("img")).src = D : ((w = p.createElement("script")).src = d, w.async = A === void 0 || A), w.onload = w.onerror = w.onbeforeload = function(Le) {
|
|
1388
|
-
var ne = Le.type[0];
|
|
1389
|
-
if (M) try {
|
|
1390
|
-
w.sheet.cssText.length || (ne = "e");
|
|
1391
|
-
} catch (dt) {
|
|
1392
|
-
dt.code != 18 && (ne = "e");
|
|
1393
|
-
}
|
|
1394
|
-
if (ne == "e") {
|
|
1395
|
-
if ((T += 1) < L) return u(d, v, k, T);
|
|
1396
|
-
} else if (w.rel == "preload" && w.as == "style") return w.rel = "stylesheet";
|
|
1397
|
-
v(d, ne, Le.defaultPrevented);
|
|
1398
|
-
}, j(d, w) !== !1 && p.head.appendChild(w);
|
|
1399
|
-
}
|
|
1400
|
-
function g(d, v, k) {
|
|
1401
|
-
var T, M, w = (d = d.push ? d : [d]).length, p = w, A = [];
|
|
1402
|
-
for (T = function(L, j, H) {
|
|
1403
|
-
if (j == "e" && A.push(L), j == "b") {
|
|
1404
|
-
if (!H) return;
|
|
1405
|
-
A.push(L);
|
|
1406
|
-
}
|
|
1407
|
-
--w || v(A);
|
|
1408
|
-
}, M = 0; M < p; M++) u(d[M], T, k);
|
|
1409
|
-
}
|
|
1410
|
-
function f(d, v, k) {
|
|
1411
|
-
var T, M;
|
|
1412
|
-
if (v && v.trim && (T = v), M = (T ? k : v) || {}, T) {
|
|
1413
|
-
if (T in s) throw "LoadJS";
|
|
1414
|
-
s[T] = !0;
|
|
1415
|
-
}
|
|
1416
|
-
function w(p, A) {
|
|
1417
|
-
g(d, function(L) {
|
|
1418
|
-
c(M, L), p && c({ success: p, error: A }, L), o(T, L);
|
|
1419
|
-
}, M);
|
|
1420
|
-
}
|
|
1421
|
-
if (M.returnPromise) return new Promise(w);
|
|
1422
|
-
w();
|
|
1423
|
-
}
|
|
1424
|
-
return f.ready = function(d, v) {
|
|
1425
|
-
return l(d, function(k) {
|
|
1426
|
-
c(v, k);
|
|
1427
|
-
}), f;
|
|
1428
|
-
}, f.done = function(d) {
|
|
1429
|
-
o(d, []);
|
|
1430
|
-
}, f.reset = function() {
|
|
1431
|
-
s = {}, n = {}, a = {};
|
|
1432
|
-
}, f.isDefined = function(d) {
|
|
1433
|
-
return d in s;
|
|
1434
|
-
}, f;
|
|
1435
|
-
}();
|
|
1436
|
-
});
|
|
1437
|
-
function xe(e) {
|
|
1438
|
-
return new Promise((i, t) => {
|
|
1439
|
-
hi(e, { success: i, error: t });
|
|
1440
|
-
});
|
|
1441
|
-
}
|
|
1442
|
-
function di(e) {
|
|
1443
|
-
return r.empty(e) ? null : r.number(Number(e)) ? e : e.match(/^.*(vimeo.com\/|video\/)(\d+).*/) ? RegExp.$2 : e;
|
|
1444
|
-
}
|
|
1445
|
-
function mi(e) {
|
|
1446
|
-
const i = e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);
|
|
1447
|
-
return i && i.length === 5 ? i[4] : null;
|
|
1448
|
-
}
|
|
1449
|
-
function Q(e) {
|
|
1450
|
-
e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === e && (this.media.paused = !e, b.call(this, this.media, e ? "play" : "pause"));
|
|
1451
|
-
}
|
|
1452
|
-
const Ce = { setup() {
|
|
1453
|
-
const e = this;
|
|
1454
|
-
S(e.elements.wrapper, e.config.classNames.embed, !0), e.options.speed = e.config.speed.options, Y.call(e), r.object(window.Vimeo) ? Ce.ready.call(e) : xe(e.config.urls.vimeo.sdk).then(() => {
|
|
1455
|
-
Ce.ready.call(e);
|
|
1456
|
-
}).catch((i) => {
|
|
1457
|
-
e.debug.warn("Vimeo SDK (player.js) failed to load", i);
|
|
1458
|
-
});
|
|
1459
|
-
}, ready() {
|
|
1460
|
-
const e = this, i = e.config.vimeo, { premium: t, referrerPolicy: s, ...n } = i;
|
|
1461
|
-
let a = e.media.getAttribute("src"), l = "";
|
|
1462
|
-
r.empty(a) ? (a = e.media.getAttribute(e.config.attributes.embed.id), l = e.media.getAttribute(e.config.attributes.embed.hash)) : l = mi(a);
|
|
1463
|
-
const o = l ? { h: l } : {};
|
|
1464
|
-
t && Object.assign(n, { controls: !1, sidedock: !1 });
|
|
1465
|
-
const c = ot({ loop: e.config.loop.active, autoplay: e.autoplay, muted: e.muted, gesture: "media", playsinline: e.config.playsinline, ...o, ...n }), u = di(a), g = y("iframe"), f = Te(e.config.urls.vimeo.iframe, u, c);
|
|
1466
|
-
if (g.setAttribute("src", f), g.setAttribute("allowfullscreen", ""), g.setAttribute("allow", ["autoplay", "fullscreen", "picture-in-picture", "encrypted-media", "accelerometer", "gyroscope"].join("; ")), r.empty(s) || g.setAttribute("referrerPolicy", s), t || !i.customControls) g.setAttribute("data-poster", e.poster), e.media = oe(g, e.media);
|
|
1467
|
-
else {
|
|
1468
|
-
const p = y("div", { class: e.config.classNames.embedContainer, "data-poster": e.poster });
|
|
1469
|
-
p.appendChild(g), e.media = oe(p, e.media);
|
|
1470
|
-
}
|
|
1471
|
-
i.customControls || se(Te(e.config.urls.vimeo.api, f)).then((p) => {
|
|
1472
|
-
!r.empty(p) && p.thumbnail_url && P.setPoster.call(e, p.thumbnail_url).catch(() => {
|
|
1473
|
-
});
|
|
1474
|
-
}), e.embed = new window.Vimeo.Player(g, { autopause: e.config.autopause, muted: e.muted }), e.media.paused = !0, e.media.currentTime = 0, e.supported.ui && e.embed.disableTextTrack(), e.media.play = () => (Q.call(e, !0), e.embed.play()), e.media.pause = () => (Q.call(e, !1), e.embed.pause()), e.media.stop = () => {
|
|
1475
|
-
e.pause(), e.currentTime = 0;
|
|
1476
|
-
};
|
|
1477
|
-
let { currentTime: d } = e.media;
|
|
1478
|
-
Object.defineProperty(e.media, "currentTime", { get: () => d, set(p) {
|
|
1479
|
-
const { embed: A, media: L, paused: j, volume: H } = e, D = j && !A.hasPlayed;
|
|
1480
|
-
L.seeking = !0, b.call(e, L, "seeking"), Promise.resolve(D && A.setVolume(0)).then(() => A.setCurrentTime(p)).then(() => D && A.pause()).then(() => D && A.setVolume(H)).catch(() => {
|
|
1481
|
-
});
|
|
1482
|
-
} });
|
|
1483
|
-
let v = e.config.speed.selected;
|
|
1484
|
-
Object.defineProperty(e.media, "playbackRate", { get: () => v, set(p) {
|
|
1485
|
-
e.embed.setPlaybackRate(p).then(() => {
|
|
1486
|
-
v = p, b.call(e, e.media, "ratechange");
|
|
1487
|
-
}).catch(() => {
|
|
1488
|
-
e.options.speed = [1];
|
|
1489
|
-
});
|
|
1490
|
-
} });
|
|
1491
|
-
let { volume: k } = e.config;
|
|
1492
|
-
Object.defineProperty(e.media, "volume", { get: () => k, set(p) {
|
|
1493
|
-
e.embed.setVolume(p).then(() => {
|
|
1494
|
-
k = p, b.call(e, e.media, "volumechange");
|
|
1495
|
-
});
|
|
1496
|
-
} });
|
|
1497
|
-
let { muted: T } = e.config;
|
|
1498
|
-
Object.defineProperty(e.media, "muted", { get: () => T, set(p) {
|
|
1499
|
-
const A = !!r.boolean(p) && p;
|
|
1500
|
-
e.embed.setMuted(!!A || e.config.muted).then(() => {
|
|
1501
|
-
T = A, b.call(e, e.media, "volumechange");
|
|
1502
|
-
});
|
|
1503
|
-
} });
|
|
1504
|
-
let M, { loop: w } = e.config;
|
|
1505
|
-
Object.defineProperty(e.media, "loop", { get: () => w, set(p) {
|
|
1506
|
-
const A = r.boolean(p) ? p : e.config.loop.active;
|
|
1507
|
-
e.embed.setLoop(A).then(() => {
|
|
1508
|
-
w = A;
|
|
1509
|
-
});
|
|
1510
|
-
} }), e.embed.getVideoUrl().then((p) => {
|
|
1511
|
-
M = p, h.setDownloadUrl.call(e);
|
|
1512
|
-
}).catch((p) => {
|
|
1513
|
-
this.debug.warn(p);
|
|
1514
|
-
}), Object.defineProperty(e.media, "currentSrc", { get: () => M }), Object.defineProperty(e.media, "ended", { get: () => e.currentTime === e.duration }), Promise.all([e.embed.getVideoWidth(), e.embed.getVideoHeight()]).then((p) => {
|
|
1515
|
-
const [A, L] = p;
|
|
1516
|
-
e.embed.ratio = st(A, L), Y.call(this);
|
|
1517
|
-
}), e.embed.setAutopause(e.config.autopause).then((p) => {
|
|
1518
|
-
e.config.autopause = p;
|
|
1519
|
-
}), e.embed.getVideoTitle().then((p) => {
|
|
1520
|
-
e.config.title = p, P.setTitle.call(this);
|
|
1521
|
-
}), e.embed.getCurrentTime().then((p) => {
|
|
1522
|
-
d = p, b.call(e, e.media, "timeupdate");
|
|
1523
|
-
}), e.embed.getDuration().then((p) => {
|
|
1524
|
-
e.media.duration = p, b.call(e, e.media, "durationchange");
|
|
1525
|
-
}), e.embed.getTextTracks().then((p) => {
|
|
1526
|
-
e.media.textTracks = p, E.setup.call(e);
|
|
1527
|
-
}), e.embed.on("cuechange", ({ cues: p = [] }) => {
|
|
1528
|
-
const A = p.map((L) => si(L.text));
|
|
1529
|
-
E.updateCues.call(e, A);
|
|
1530
|
-
}), e.embed.on("loaded", () => {
|
|
1531
|
-
e.embed.getPaused().then((p) => {
|
|
1532
|
-
Q.call(e, !p), p || b.call(e, e.media, "playing");
|
|
1533
|
-
}), r.element(e.embed.element) && e.supported.ui && e.embed.element.setAttribute("tabindex", -1);
|
|
1534
|
-
}), e.embed.on("bufferstart", () => {
|
|
1535
|
-
b.call(e, e.media, "waiting");
|
|
1536
|
-
}), e.embed.on("bufferend", () => {
|
|
1537
|
-
b.call(e, e.media, "playing");
|
|
1538
|
-
}), e.embed.on("play", () => {
|
|
1539
|
-
Q.call(e, !0), b.call(e, e.media, "playing");
|
|
1540
|
-
}), e.embed.on("pause", () => {
|
|
1541
|
-
Q.call(e, !1);
|
|
1542
|
-
}), e.embed.on("timeupdate", (p) => {
|
|
1543
|
-
e.media.seeking = !1, d = p.seconds, b.call(e, e.media, "timeupdate");
|
|
1544
|
-
}), e.embed.on("progress", (p) => {
|
|
1545
|
-
e.media.buffered = p.percent, b.call(e, e.media, "progress"), parseInt(p.percent, 10) === 1 && b.call(e, e.media, "canplaythrough"), e.embed.getDuration().then((A) => {
|
|
1546
|
-
A !== e.media.duration && (e.media.duration = A, b.call(e, e.media, "durationchange"));
|
|
1547
|
-
});
|
|
1548
|
-
}), e.embed.on("seeked", () => {
|
|
1549
|
-
e.media.seeking = !1, b.call(e, e.media, "seeked");
|
|
1550
|
-
}), e.embed.on("ended", () => {
|
|
1551
|
-
e.media.paused = !0, b.call(e, e.media, "ended");
|
|
1552
|
-
}), e.embed.on("error", (p) => {
|
|
1553
|
-
e.media.error = p, b.call(e, e.media, "error");
|
|
1554
|
-
}), i.customControls && setTimeout(() => P.build.call(e), 0);
|
|
1555
|
-
} };
|
|
1556
|
-
function pi(e) {
|
|
1557
|
-
return r.empty(e) ? null : e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/) ? RegExp.$2 : e;
|
|
1558
|
-
}
|
|
1559
|
-
function X(e) {
|
|
1560
|
-
e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === e && (this.media.paused = !e, b.call(this, this.media, e ? "play" : "pause"));
|
|
1561
|
-
}
|
|
1562
|
-
function gi(e) {
|
|
1563
|
-
return e.noCookie ? "https://www.youtube-nocookie.com" : window.location.protocol === "http:" ? "http://www.youtube.com" : void 0;
|
|
1564
|
-
}
|
|
1565
|
-
const le = { setup() {
|
|
1566
|
-
if (S(this.elements.wrapper, this.config.classNames.embed, !0), r.object(window.YT) && r.function(window.YT.Player)) le.ready.call(this);
|
|
1567
|
-
else {
|
|
1568
|
-
const e = window.onYouTubeIframeAPIReady;
|
|
1569
|
-
window.onYouTubeIframeAPIReady = () => {
|
|
1570
|
-
r.function(e) && e(), le.ready.call(this);
|
|
1571
|
-
}, xe(this.config.urls.youtube.sdk).catch((i) => {
|
|
1572
|
-
this.debug.warn("YouTube API failed to load", i);
|
|
1573
|
-
});
|
|
1574
|
-
}
|
|
1575
|
-
}, getTitle(e) {
|
|
1576
|
-
se(Te(this.config.urls.youtube.api, e)).then((i) => {
|
|
1577
|
-
if (r.object(i)) {
|
|
1578
|
-
const { title: t, height: s, width: n } = i;
|
|
1579
|
-
this.config.title = t, P.setTitle.call(this), this.embed.ratio = st(n, s);
|
|
1580
|
-
}
|
|
1581
|
-
Y.call(this);
|
|
1582
|
-
}).catch(() => {
|
|
1583
|
-
Y.call(this);
|
|
1584
|
-
});
|
|
1585
|
-
}, ready() {
|
|
1586
|
-
const e = this, i = e.config.youtube, t = e.media && e.media.getAttribute("id");
|
|
1587
|
-
if (!r.empty(t) && t.startsWith("youtube-")) return;
|
|
1588
|
-
let s = e.media.getAttribute("src");
|
|
1589
|
-
r.empty(s) && (s = e.media.getAttribute(this.config.attributes.embed.id));
|
|
1590
|
-
const n = pi(s), a = y("div", { id: Zt(e.provider), "data-poster": i.customControls ? e.poster : void 0 });
|
|
1591
|
-
if (e.media = oe(a, e.media), i.customControls) {
|
|
1592
|
-
const l = (o) => `https://i.ytimg.com/vi/${n}/${o}default.jpg`;
|
|
1593
|
-
re(l("maxres"), 121).catch(() => re(l("sd"), 121)).catch(() => re(l("hq"))).then((o) => P.setPoster.call(e, o.src)).then((o) => {
|
|
1594
|
-
o.includes("maxres") || (e.elements.poster.style.backgroundSize = "cover");
|
|
1595
|
-
}).catch(() => {
|
|
1596
|
-
});
|
|
1597
|
-
}
|
|
1598
|
-
e.embed = new window.YT.Player(e.media, { videoId: n, host: gi(i), playerVars: N({}, { autoplay: e.config.autoplay ? 1 : 0, hl: e.config.hl, controls: e.supported.ui && i.customControls ? 0 : 1, disablekb: 1, playsinline: e.config.playsinline && !e.config.fullscreen.iosNative ? 1 : 0, cc_load_policy: e.captions.active ? 1 : 0, cc_lang_pref: e.config.captions.language, widget_referrer: window ? window.location.href : null }, i), events: { onError(l) {
|
|
1599
|
-
if (!e.media.error) {
|
|
1600
|
-
const o = l.data, c = { 2: "The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.", 5: "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.", 100: "The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.", 101: "The owner of the requested video does not allow it to be played in embedded players.", 150: "The owner of the requested video does not allow it to be played in embedded players." }[o] || "An unknown error occurred";
|
|
1601
|
-
e.media.error = { code: o, message: c }, b.call(e, e.media, "error");
|
|
1602
|
-
}
|
|
1603
|
-
}, onPlaybackRateChange(l) {
|
|
1604
|
-
const o = l.target;
|
|
1605
|
-
e.media.playbackRate = o.getPlaybackRate(), b.call(e, e.media, "ratechange");
|
|
1606
|
-
}, onReady(l) {
|
|
1607
|
-
if (r.function(e.media.play)) return;
|
|
1608
|
-
const o = l.target;
|
|
1609
|
-
le.getTitle.call(e, n), e.media.play = () => {
|
|
1610
|
-
X.call(e, !0), o.playVideo();
|
|
1611
|
-
}, e.media.pause = () => {
|
|
1612
|
-
X.call(e, !1), o.pauseVideo();
|
|
1613
|
-
}, e.media.stop = () => {
|
|
1614
|
-
o.stopVideo();
|
|
1615
|
-
}, e.media.duration = o.getDuration(), e.media.paused = !0, e.media.currentTime = 0, Object.defineProperty(e.media, "currentTime", { get: () => Number(o.getCurrentTime()), set(f) {
|
|
1616
|
-
e.paused && !e.embed.hasPlayed && e.embed.mute(), e.media.seeking = !0, b.call(e, e.media, "seeking"), o.seekTo(f);
|
|
1617
|
-
} }), Object.defineProperty(e.media, "playbackRate", { get: () => o.getPlaybackRate(), set(f) {
|
|
1618
|
-
o.setPlaybackRate(f);
|
|
1619
|
-
} });
|
|
1620
|
-
let { volume: c } = e.config;
|
|
1621
|
-
Object.defineProperty(e.media, "volume", { get: () => c, set(f) {
|
|
1622
|
-
c = f, o.setVolume(100 * c), b.call(e, e.media, "volumechange");
|
|
1623
|
-
} });
|
|
1624
|
-
let { muted: u } = e.config;
|
|
1625
|
-
Object.defineProperty(e.media, "muted", { get: () => u, set(f) {
|
|
1626
|
-
const d = r.boolean(f) ? f : u;
|
|
1627
|
-
u = d, o[d ? "mute" : "unMute"](), o.setVolume(100 * c), b.call(e, e.media, "volumechange");
|
|
1628
|
-
} }), Object.defineProperty(e.media, "currentSrc", { get: () => o.getVideoUrl() }), Object.defineProperty(e.media, "ended", { get: () => e.currentTime === e.duration });
|
|
1629
|
-
const g = o.getAvailablePlaybackRates();
|
|
1630
|
-
e.options.speed = g.filter((f) => e.config.speed.options.includes(f)), e.supported.ui && i.customControls && e.media.setAttribute("tabindex", -1), b.call(e, e.media, "timeupdate"), b.call(e, e.media, "durationchange"), clearInterval(e.timers.buffering), e.timers.buffering = setInterval(() => {
|
|
1631
|
-
e.media.buffered = o.getVideoLoadedFraction(), (e.media.lastBuffered === null || e.media.lastBuffered < e.media.buffered) && b.call(e, e.media, "progress"), e.media.lastBuffered = e.media.buffered, e.media.buffered === 1 && (clearInterval(e.timers.buffering), b.call(e, e.media, "canplaythrough"));
|
|
1632
|
-
}, 200), i.customControls && setTimeout(() => P.build.call(e), 50);
|
|
1633
|
-
}, onStateChange(l) {
|
|
1634
|
-
const o = l.target;
|
|
1635
|
-
switch (clearInterval(e.timers.playing), e.media.seeking && [1, 2].includes(l.data) && (e.media.seeking = !1, b.call(e, e.media, "seeked")), l.data) {
|
|
1636
|
-
case -1:
|
|
1637
|
-
b.call(e, e.media, "timeupdate"), e.media.buffered = o.getVideoLoadedFraction(), b.call(e, e.media, "progress");
|
|
1638
|
-
break;
|
|
1639
|
-
case 0:
|
|
1640
|
-
X.call(e, !1), e.media.loop ? (o.stopVideo(), o.playVideo()) : b.call(e, e.media, "ended");
|
|
1641
|
-
break;
|
|
1642
|
-
case 1:
|
|
1643
|
-
i.customControls && !e.config.autoplay && e.media.paused && !e.embed.hasPlayed ? e.media.pause() : (X.call(e, !0), b.call(e, e.media, "playing"), e.timers.playing = setInterval(() => {
|
|
1644
|
-
b.call(e, e.media, "timeupdate");
|
|
1645
|
-
}, 50), e.media.duration !== o.getDuration() && (e.media.duration = o.getDuration(), b.call(e, e.media, "durationchange")));
|
|
1646
|
-
break;
|
|
1647
|
-
case 2:
|
|
1648
|
-
e.muted || e.embed.unMute(), X.call(e, !1);
|
|
1649
|
-
break;
|
|
1650
|
-
case 3:
|
|
1651
|
-
b.call(e, e.media, "waiting");
|
|
1652
|
-
}
|
|
1653
|
-
b.call(e, e.elements.container, "statechange", !1, { code: l.data });
|
|
1654
|
-
} } });
|
|
1655
|
-
} }, ut = { setup() {
|
|
1656
|
-
this.media ? (S(this.elements.container, this.config.classNames.type.replace("{0}", this.type), !0), S(this.elements.container, this.config.classNames.provider.replace("{0}", this.provider), !0), this.isEmbed && S(this.elements.container, this.config.classNames.type.replace("{0}", "video"), !0), this.isVideo && (this.elements.wrapper = y("div", { class: this.config.classNames.video }), Ze(this.media, this.elements.wrapper), this.elements.poster = y("div", { class: this.config.classNames.poster }), this.elements.wrapper.appendChild(this.elements.poster)), this.isHTML5 ? W.setup.call(this) : this.isYouTube ? le.setup.call(this) : this.isVimeo && Ce.setup.call(this)) : this.debug.warn("No media element found!");
|
|
1657
|
-
} };
|
|
1658
|
-
class fi {
|
|
1659
|
-
constructor(i) {
|
|
1660
|
-
m(this, "load", () => {
|
|
1661
|
-
this.enabled && (r.object(window.google) && r.object(window.google.ima) ? this.ready() : xe(this.player.config.urls.googleIMA.sdk).then(() => {
|
|
1662
|
-
this.ready();
|
|
1663
|
-
}).catch(() => {
|
|
1664
|
-
this.trigger("error", new Error("Google IMA SDK failed to load"));
|
|
1665
|
-
}));
|
|
1666
|
-
}), m(this, "ready", () => {
|
|
1667
|
-
var t;
|
|
1668
|
-
this.enabled || ((t = this).manager && t.manager.destroy(), t.elements.displayContainer && t.elements.displayContainer.destroy(), t.elements.container.remove()), this.startSafetyTimer(12e3, "ready()"), this.managerPromise.then(() => {
|
|
1669
|
-
this.clearSafetyTimer("onAdsManagerLoaded()");
|
|
1670
|
-
}), this.listeners(), this.setupIMA();
|
|
1671
|
-
}), m(this, "setupIMA", () => {
|
|
1672
|
-
this.elements.container = y("div", { class: this.player.config.classNames.ads }), this.player.elements.container.appendChild(this.elements.container), google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED), google.ima.settings.setLocale(this.player.config.ads.language), google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline), this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media), this.loader = new google.ima.AdsLoader(this.elements.displayContainer), this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, (t) => this.onAdsManagerLoaded(t), !1), this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, (t) => this.onAdError(t), !1), this.requestAds();
|
|
1673
|
-
}), m(this, "requestAds", () => {
|
|
1674
|
-
const { container: t } = this.player.elements;
|
|
1675
|
-
try {
|
|
1676
|
-
const s = new google.ima.AdsRequest();
|
|
1677
|
-
s.adTagUrl = this.tagUrl, s.linearAdSlotWidth = t.offsetWidth, s.linearAdSlotHeight = t.offsetHeight, s.nonLinearAdSlotWidth = t.offsetWidth, s.nonLinearAdSlotHeight = t.offsetHeight, s.forceNonLinearFullSlot = !1, s.setAdWillPlayMuted(!this.player.muted), this.loader.requestAds(s);
|
|
1678
|
-
} catch (s) {
|
|
1679
|
-
this.onAdError(s);
|
|
1680
|
-
}
|
|
1681
|
-
}), m(this, "pollCountdown", (t = !1) => {
|
|
1682
|
-
if (!t) return clearInterval(this.countdownTimer), void this.elements.container.removeAttribute("data-badge-text");
|
|
1683
|
-
this.countdownTimer = setInterval(() => {
|
|
1684
|
-
const s = pe(Math.max(this.manager.getRemainingTime(), 0)), n = `${$.get("advertisement", this.player.config)} - ${s}`;
|
|
1685
|
-
this.elements.container.setAttribute("data-badge-text", n);
|
|
1686
|
-
}, 100);
|
|
1687
|
-
}), m(this, "onAdsManagerLoaded", (t) => {
|
|
1688
|
-
if (!this.enabled) return;
|
|
1689
|
-
const s = new google.ima.AdsRenderingSettings();
|
|
1690
|
-
s.restoreCustomPlaybackStateOnAdBreakComplete = !0, s.enablePreloading = !0, this.manager = t.getAdsManager(this.player, s), this.cuePoints = this.manager.getCuePoints(), this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, (n) => this.onAdError(n)), Object.keys(google.ima.AdEvent.Type).forEach((n) => {
|
|
1691
|
-
this.manager.addEventListener(google.ima.AdEvent.Type[n], (a) => this.onAdEvent(a));
|
|
1692
|
-
}), this.trigger("loaded");
|
|
1693
|
-
}), m(this, "addCuePoints", () => {
|
|
1694
|
-
r.empty(this.cuePoints) || this.cuePoints.forEach((t) => {
|
|
1695
|
-
if (t !== 0 && t !== -1 && t < this.player.duration) {
|
|
1696
|
-
const s = this.player.elements.progress;
|
|
1697
|
-
if (r.element(s)) {
|
|
1698
|
-
const n = 100 / this.player.duration * t, a = y("span", { class: this.player.config.classNames.cues });
|
|
1699
|
-
a.style.left = `${n.toString()}%`, s.appendChild(a);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
}), m(this, "onAdEvent", (t) => {
|
|
1704
|
-
const { container: s } = this.player.elements, n = t.getAd(), a = t.getAdData();
|
|
1705
|
-
switch (((l) => {
|
|
1706
|
-
b.call(this.player, this.player.media, `ads${l.replace(/_/g, "").toLowerCase()}`);
|
|
1707
|
-
})(t.type), t.type) {
|
|
1708
|
-
case google.ima.AdEvent.Type.LOADED:
|
|
1709
|
-
this.trigger("loaded"), this.pollCountdown(!0), n.isLinear() || (n.width = s.offsetWidth, n.height = s.offsetHeight);
|
|
1710
|
-
break;
|
|
1711
|
-
case google.ima.AdEvent.Type.STARTED:
|
|
1712
|
-
this.manager.setVolume(this.player.volume);
|
|
1713
|
-
break;
|
|
1714
|
-
case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
|
|
1715
|
-
this.player.ended ? this.loadAds() : this.loader.contentComplete();
|
|
1716
|
-
break;
|
|
1717
|
-
case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
|
|
1718
|
-
this.pauseContent();
|
|
1719
|
-
break;
|
|
1720
|
-
case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
|
|
1721
|
-
this.pollCountdown(), this.resumeContent();
|
|
1722
|
-
break;
|
|
1723
|
-
case google.ima.AdEvent.Type.LOG:
|
|
1724
|
-
a.adError && this.player.debug.warn(`Non-fatal ad error: ${a.adError.getMessage()}`);
|
|
1725
|
-
}
|
|
1726
|
-
}), m(this, "onAdError", (t) => {
|
|
1727
|
-
this.cancel(), this.player.debug.warn("Ads error", t);
|
|
1728
|
-
}), m(this, "listeners", () => {
|
|
1729
|
-
const { container: t } = this.player.elements;
|
|
1730
|
-
let s;
|
|
1731
|
-
this.player.on("canplay", () => {
|
|
1732
|
-
this.addCuePoints();
|
|
1733
|
-
}), this.player.on("ended", () => {
|
|
1734
|
-
this.loader.contentComplete();
|
|
1735
|
-
}), this.player.on("timeupdate", () => {
|
|
1736
|
-
s = this.player.currentTime;
|
|
1737
|
-
}), this.player.on("seeked", () => {
|
|
1738
|
-
const n = this.player.currentTime;
|
|
1739
|
-
r.empty(this.cuePoints) || this.cuePoints.forEach((a, l) => {
|
|
1740
|
-
s < a && a < n && (this.manager.discardAdBreak(), this.cuePoints.splice(l, 1));
|
|
1741
|
-
});
|
|
1742
|
-
}), window.addEventListener("resize", () => {
|
|
1743
|
-
this.manager && this.manager.resize(t.offsetWidth, t.offsetHeight, google.ima.ViewMode.NORMAL);
|
|
1744
|
-
});
|
|
1745
|
-
}), m(this, "play", () => {
|
|
1746
|
-
const { container: t } = this.player.elements;
|
|
1747
|
-
this.managerPromise || this.resumeContent(), this.managerPromise.then(() => {
|
|
1748
|
-
this.manager.setVolume(this.player.volume), this.elements.displayContainer.initialize();
|
|
1749
|
-
try {
|
|
1750
|
-
this.initialized || (this.manager.init(t.offsetWidth, t.offsetHeight, google.ima.ViewMode.NORMAL), this.manager.start()), this.initialized = !0;
|
|
1751
|
-
} catch (s) {
|
|
1752
|
-
this.onAdError(s);
|
|
1753
|
-
}
|
|
1754
|
-
}).catch(() => {
|
|
1755
|
-
});
|
|
1756
|
-
}), m(this, "resumeContent", () => {
|
|
1757
|
-
this.elements.container.style.zIndex = "", this.playing = !1, V(this.player.media.play());
|
|
1758
|
-
}), m(this, "pauseContent", () => {
|
|
1759
|
-
this.elements.container.style.zIndex = 3, this.playing = !0, this.player.media.pause();
|
|
1760
|
-
}), m(this, "cancel", () => {
|
|
1761
|
-
this.initialized && this.resumeContent(), this.trigger("error"), this.loadAds();
|
|
1762
|
-
}), m(this, "loadAds", () => {
|
|
1763
|
-
this.managerPromise.then(() => {
|
|
1764
|
-
this.manager && this.manager.destroy(), this.managerPromise = new Promise((t) => {
|
|
1765
|
-
this.on("loaded", t), this.player.debug.log(this.manager);
|
|
1766
|
-
}), this.initialized = !1, this.requestAds();
|
|
1767
|
-
}).catch(() => {
|
|
1768
|
-
});
|
|
1769
|
-
}), m(this, "trigger", (t, ...s) => {
|
|
1770
|
-
const n = this.events[t];
|
|
1771
|
-
r.array(n) && n.forEach((a) => {
|
|
1772
|
-
r.function(a) && a.apply(this, s);
|
|
1773
|
-
});
|
|
1774
|
-
}), m(this, "on", (t, s) => (r.array(this.events[t]) || (this.events[t] = []), this.events[t].push(s), this)), m(this, "startSafetyTimer", (t, s) => {
|
|
1775
|
-
this.player.debug.log(`Safety timer invoked from: ${s}`), this.safetyTimer = setTimeout(() => {
|
|
1776
|
-
this.cancel(), this.clearSafetyTimer("startSafetyTimer()");
|
|
1777
|
-
}, t);
|
|
1778
|
-
}), m(this, "clearSafetyTimer", (t) => {
|
|
1779
|
-
r.nullOrUndefined(this.safetyTimer) || (this.player.debug.log(`Safety timer cleared from: ${t}`), clearTimeout(this.safetyTimer), this.safetyTimer = null);
|
|
1780
|
-
}), this.player = i, this.config = i.config.ads, this.playing = !1, this.initialized = !1, this.elements = { container: null, displayContainer: null }, this.manager = null, this.loader = null, this.cuePoints = null, this.events = {}, this.safetyTimer = null, this.countdownTimer = null, this.managerPromise = new Promise((t, s) => {
|
|
1781
|
-
this.on("loaded", t), this.on("error", s);
|
|
1782
|
-
}), this.load();
|
|
1783
|
-
}
|
|
1784
|
-
get enabled() {
|
|
1785
|
-
const { config: i } = this;
|
|
1786
|
-
return this.player.isHTML5 && this.player.isVideo && i.enabled && (!r.empty(i.publisherId) || r.url(i.tagUrl));
|
|
1787
|
-
}
|
|
1788
|
-
get tagUrl() {
|
|
1789
|
-
const { config: i } = this;
|
|
1790
|
-
return r.url(i.tagUrl) ? i.tagUrl : `https://go.aniview.com/api/adserver6/vast/?${ot({ AV_PUBLISHERID: "58c25bb0073ef448b1087ad6", AV_CHANNELID: "5a0458dc28a06145e4519d21", AV_URL: window.location.hostname, cb: Date.now(), AV_WIDTH: 640, AV_HEIGHT: 480, AV_CDIM2: i.publisherId })}`;
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
function ht(e = 0, i = 0, t = 255) {
|
|
1794
|
-
return Math.min(Math.max(e, i), t);
|
|
1795
|
-
}
|
|
1796
|
-
const yi = (e) => {
|
|
1797
|
-
const i = [];
|
|
1798
|
-
return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((t) => {
|
|
1799
|
-
const s = {};
|
|
1800
|
-
t.split(/\r\n|\n|\r/).forEach((n) => {
|
|
1801
|
-
if (r.number(s.startTime)) {
|
|
1802
|
-
if (!r.empty(n.trim()) && r.empty(s.text)) {
|
|
1803
|
-
const a = n.trim().split("#xywh=");
|
|
1804
|
-
[s.text] = a, a[1] && ([s.x, s.y, s.w, s.h] = a[1].split(","));
|
|
1805
|
-
}
|
|
1806
|
-
} else {
|
|
1807
|
-
const a = n.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);
|
|
1808
|
-
a && (s.startTime = 60 * Number(a[1] || 0) * 60 + 60 * Number(a[2]) + Number(a[3]) + +`0.${a[4]}`, s.endTime = 60 * Number(a[6] || 0) * 60 + 60 * Number(a[7]) + Number(a[8]) + +`0.${a[9]}`);
|
|
1809
|
-
}
|
|
1810
|
-
}), s.text && i.push(s);
|
|
1811
|
-
}), i;
|
|
1812
|
-
}, qe = (e, i) => {
|
|
1813
|
-
const t = {};
|
|
1814
|
-
return e > i.width / i.height ? (t.width = i.width, t.height = 1 / e * i.width) : (t.height = i.height, t.width = e * i.height), t;
|
|
1815
|
-
};
|
|
1816
|
-
class Ae {
|
|
1817
|
-
constructor(i) {
|
|
1818
|
-
m(this, "load", () => {
|
|
1819
|
-
this.player.elements.display.seekTooltip && (this.player.elements.display.seekTooltip.hidden = this.enabled), this.enabled && this.getThumbnails().then(() => {
|
|
1820
|
-
this.enabled && (this.render(), this.determineContainerAutoSizing(), this.listeners(), this.loaded = !0);
|
|
1821
|
-
});
|
|
1822
|
-
}), m(this, "getThumbnails", () => new Promise((t) => {
|
|
1823
|
-
const { src: s } = this.player.config.previewThumbnails;
|
|
1824
|
-
if (r.empty(s)) throw new Error("Missing previewThumbnails.src config attribute");
|
|
1825
|
-
const n = () => {
|
|
1826
|
-
this.thumbnails.sort((a, l) => a.height - l.height), this.player.debug.log("Preview thumbnails", this.thumbnails), t();
|
|
1827
|
-
};
|
|
1828
|
-
if (r.function(s)) s((a) => {
|
|
1829
|
-
this.thumbnails = a, n();
|
|
1830
|
-
});
|
|
1831
|
-
else {
|
|
1832
|
-
const a = (r.string(s) ? [s] : s).map((l) => this.getThumbnail(l));
|
|
1833
|
-
Promise.all(a).then(n);
|
|
1834
|
-
}
|
|
1835
|
-
})), m(this, "getThumbnail", (t) => new Promise((s) => {
|
|
1836
|
-
se(t).then((n) => {
|
|
1837
|
-
const a = { frames: yi(n), height: null, urlPrefix: "" };
|
|
1838
|
-
a.frames[0].text.startsWith("/") || a.frames[0].text.startsWith("http://") || a.frames[0].text.startsWith("https://") || (a.urlPrefix = t.substring(0, t.lastIndexOf("/") + 1));
|
|
1839
|
-
const l = new Image();
|
|
1840
|
-
l.onload = () => {
|
|
1841
|
-
a.height = l.naturalHeight, a.width = l.naturalWidth, this.thumbnails.push(a), s();
|
|
1842
|
-
}, l.src = a.urlPrefix + a.frames[0].text;
|
|
1843
|
-
});
|
|
1844
|
-
})), m(this, "startMove", (t) => {
|
|
1845
|
-
if (this.loaded && r.event(t) && ["touchmove", "mousemove"].includes(t.type) && this.player.media.duration) {
|
|
1846
|
-
if (t.type === "touchmove") this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
|
|
1847
|
-
else {
|
|
1848
|
-
var s, n;
|
|
1849
|
-
const a = this.player.elements.progress.getBoundingClientRect(), l = 100 / a.width * (t.pageX - a.left);
|
|
1850
|
-
this.seekTime = this.player.media.duration * (l / 100), this.seekTime < 0 && (this.seekTime = 0), this.seekTime > this.player.media.duration - 1 && (this.seekTime = this.player.media.duration - 1), this.mousePosX = t.pageX, this.elements.thumb.time.innerText = pe(this.seekTime);
|
|
1851
|
-
const o = (s = this.player.config.markers) === null || s === void 0 || (n = s.points) === null || n === void 0 ? void 0 : n.find(({ time: c }) => c === Math.round(this.seekTime));
|
|
1852
|
-
o && this.elements.thumb.time.insertAdjacentHTML("afterbegin", `${o.label}<br>`);
|
|
1853
|
-
}
|
|
1854
|
-
this.showImageAtCurrentTime();
|
|
1855
|
-
}
|
|
1856
|
-
}), m(this, "endMove", () => {
|
|
1857
|
-
this.toggleThumbContainer(!1, !0);
|
|
1858
|
-
}), m(this, "startScrubbing", (t) => {
|
|
1859
|
-
(r.nullOrUndefined(t.button) || t.button === !1 || t.button === 0) && (this.mouseDown = !0, this.player.media.duration && (this.toggleScrubbingContainer(!0), this.toggleThumbContainer(!1, !0), this.showImageAtCurrentTime()));
|
|
1860
|
-
}), m(this, "endScrubbing", () => {
|
|
1861
|
-
this.mouseDown = !1, Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime) ? this.toggleScrubbingContainer(!1) : Me.call(this.player, this.player.media, "timeupdate", () => {
|
|
1862
|
-
this.mouseDown || this.toggleScrubbingContainer(!1);
|
|
1863
|
-
});
|
|
1864
|
-
}), m(this, "listeners", () => {
|
|
1865
|
-
this.player.on("play", () => {
|
|
1866
|
-
this.toggleThumbContainer(!1, !0);
|
|
1867
|
-
}), this.player.on("seeked", () => {
|
|
1868
|
-
this.toggleThumbContainer(!1);
|
|
1869
|
-
}), this.player.on("timeupdate", () => {
|
|
1870
|
-
this.lastTime = this.player.media.currentTime;
|
|
1871
|
-
});
|
|
1872
|
-
}), m(this, "render", () => {
|
|
1873
|
-
this.elements.thumb.container = y("div", { class: this.player.config.classNames.previewThumbnails.thumbContainer }), this.elements.thumb.imageContainer = y("div", { class: this.player.config.classNames.previewThumbnails.imageContainer }), this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);
|
|
1874
|
-
const t = y("div", { class: this.player.config.classNames.previewThumbnails.timeContainer });
|
|
1875
|
-
this.elements.thumb.time = y("span", {}, "00:00"), t.appendChild(this.elements.thumb.time), this.elements.thumb.imageContainer.appendChild(t), r.element(this.player.elements.progress) && this.player.elements.progress.appendChild(this.elements.thumb.container), this.elements.scrubbing.container = y("div", { class: this.player.config.classNames.previewThumbnails.scrubbingContainer }), this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
|
|
1876
|
-
}), m(this, "destroy", () => {
|
|
1877
|
-
this.elements.thumb.container && this.elements.thumb.container.remove(), this.elements.scrubbing.container && this.elements.scrubbing.container.remove();
|
|
1878
|
-
}), m(this, "showImageAtCurrentTime", () => {
|
|
1879
|
-
this.mouseDown ? this.setScrubbingContainerSize() : this.setThumbContainerSizeAndPos();
|
|
1880
|
-
const t = this.thumbnails[0].frames.findIndex((a) => this.seekTime >= a.startTime && this.seekTime <= a.endTime), s = t >= 0;
|
|
1881
|
-
let n = 0;
|
|
1882
|
-
this.mouseDown || this.toggleThumbContainer(s), s && (this.thumbnails.forEach((a, l) => {
|
|
1883
|
-
this.loadedImages.includes(a.frames[t].text) && (n = l);
|
|
1884
|
-
}), t !== this.showingThumb && (this.showingThumb = t, this.loadImage(n)));
|
|
1885
|
-
}), m(this, "loadImage", (t = 0) => {
|
|
1886
|
-
const s = this.showingThumb, n = this.thumbnails[t], { urlPrefix: a } = n, l = n.frames[s], o = n.frames[s].text, c = a + o;
|
|
1887
|
-
if (this.currentImageElement && this.currentImageElement.dataset.filename === o) this.showImage(this.currentImageElement, l, t, s, o, !1), this.currentImageElement.dataset.index = s, this.removeOldImages(this.currentImageElement);
|
|
1888
|
-
else {
|
|
1889
|
-
this.loadingImage && this.usingSprites && (this.loadingImage.onload = null);
|
|
1890
|
-
const u = new Image();
|
|
1891
|
-
u.src = c, u.dataset.index = s, u.dataset.filename = o, this.showingThumbFilename = o, this.player.debug.log(`Loading image: ${c}`), u.onload = () => this.showImage(u, l, t, s, o, !0), this.loadingImage = u, this.removeOldImages(u);
|
|
1892
|
-
}
|
|
1893
|
-
}), m(this, "showImage", (t, s, n, a, l, o = !0) => {
|
|
1894
|
-
this.player.debug.log(`Showing thumb: ${l}. num: ${a}. qual: ${n}. newimg: ${o}`), this.setImageSizeAndOffset(t, s), o && (this.currentImageContainer.appendChild(t), this.currentImageElement = t, this.loadedImages.includes(l) || this.loadedImages.push(l)), this.preloadNearby(a, !0).then(this.preloadNearby(a, !1)).then(this.getHigherQuality(n, t, s, l));
|
|
1895
|
-
}), m(this, "removeOldImages", (t) => {
|
|
1896
|
-
Array.from(this.currentImageContainer.children).forEach((s) => {
|
|
1897
|
-
if (s.tagName.toLowerCase() !== "img") return;
|
|
1898
|
-
const n = this.usingSprites ? 500 : 1e3;
|
|
1899
|
-
if (s.dataset.index !== t.dataset.index && !s.dataset.deleting) {
|
|
1900
|
-
s.dataset.deleting = !0;
|
|
1901
|
-
const { currentImageContainer: a } = this;
|
|
1902
|
-
setTimeout(() => {
|
|
1903
|
-
a.removeChild(s), this.player.debug.log(`Removing thumb: ${s.dataset.filename}`);
|
|
1904
|
-
}, n);
|
|
1905
|
-
}
|
|
1906
|
-
});
|
|
1907
|
-
}), m(this, "preloadNearby", (t, s = !0) => new Promise((n) => {
|
|
1908
|
-
setTimeout(() => {
|
|
1909
|
-
const a = this.thumbnails[0].frames[t].text;
|
|
1910
|
-
if (this.showingThumbFilename === a) {
|
|
1911
|
-
let l;
|
|
1912
|
-
l = s ? this.thumbnails[0].frames.slice(t) : this.thumbnails[0].frames.slice(0, t).reverse();
|
|
1913
|
-
let o = !1;
|
|
1914
|
-
l.forEach((c) => {
|
|
1915
|
-
const u = c.text;
|
|
1916
|
-
if (u !== a && !this.loadedImages.includes(u)) {
|
|
1917
|
-
o = !0, this.player.debug.log(`Preloading thumb filename: ${u}`);
|
|
1918
|
-
const { urlPrefix: g } = this.thumbnails[0], f = g + u, d = new Image();
|
|
1919
|
-
d.src = f, d.onload = () => {
|
|
1920
|
-
this.player.debug.log(`Preloaded thumb filename: ${u}`), this.loadedImages.includes(u) || this.loadedImages.push(u), n();
|
|
1921
|
-
};
|
|
1922
|
-
}
|
|
1923
|
-
}), o || n();
|
|
1924
|
-
}
|
|
1925
|
-
}, 300);
|
|
1926
|
-
})), m(this, "getHigherQuality", (t, s, n, a) => {
|
|
1927
|
-
if (t < this.thumbnails.length - 1) {
|
|
1928
|
-
let l = s.naturalHeight;
|
|
1929
|
-
this.usingSprites && (l = n.h), l < this.thumbContainerHeight && setTimeout(() => {
|
|
1930
|
-
this.showingThumbFilename === a && (this.player.debug.log(`Showing higher quality thumb for: ${a}`), this.loadImage(t + 1));
|
|
1931
|
-
}, 300);
|
|
1932
|
-
}
|
|
1933
|
-
}), m(this, "toggleThumbContainer", (t = !1, s = !1) => {
|
|
1934
|
-
const n = this.player.config.classNames.previewThumbnails.thumbContainerShown;
|
|
1935
|
-
this.elements.thumb.container.classList.toggle(n, t), !t && s && (this.showingThumb = null, this.showingThumbFilename = null);
|
|
1936
|
-
}), m(this, "toggleScrubbingContainer", (t = !1) => {
|
|
1937
|
-
const s = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
|
|
1938
|
-
this.elements.scrubbing.container.classList.toggle(s, t), t || (this.showingThumb = null, this.showingThumbFilename = null);
|
|
1939
|
-
}), m(this, "determineContainerAutoSizing", () => {
|
|
1940
|
-
(this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) && (this.sizeSpecifiedInCSS = !0);
|
|
1941
|
-
}), m(this, "setThumbContainerSizeAndPos", () => {
|
|
1942
|
-
const { imageContainer: t } = this.elements.thumb;
|
|
1943
|
-
if (this.sizeSpecifiedInCSS) {
|
|
1944
|
-
if (t.clientHeight > 20 && t.clientWidth < 20) {
|
|
1945
|
-
const s = Math.floor(t.clientHeight * this.thumbAspectRatio);
|
|
1946
|
-
t.style.width = `${s}px`;
|
|
1947
|
-
} else if (t.clientHeight < 20 && t.clientWidth > 20) {
|
|
1948
|
-
const s = Math.floor(t.clientWidth / this.thumbAspectRatio);
|
|
1949
|
-
t.style.height = `${s}px`;
|
|
1950
|
-
}
|
|
1951
|
-
} else {
|
|
1952
|
-
const s = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
|
|
1953
|
-
t.style.height = `${this.thumbContainerHeight}px`, t.style.width = `${s}px`;
|
|
1954
|
-
}
|
|
1955
|
-
this.setThumbContainerPos();
|
|
1956
|
-
}), m(this, "setThumbContainerPos", () => {
|
|
1957
|
-
const t = this.player.elements.progress.getBoundingClientRect(), s = this.player.elements.container.getBoundingClientRect(), { container: n } = this.elements.thumb, a = s.left - t.left + 10, l = s.right - t.left - n.clientWidth - 10, o = this.mousePosX - t.left - n.clientWidth / 2, c = ht(o, a, l);
|
|
1958
|
-
n.style.left = `${c}px`, n.style.setProperty("--preview-arrow-offset", o - c + "px");
|
|
1959
|
-
}), m(this, "setScrubbingContainerSize", () => {
|
|
1960
|
-
const { width: t, height: s } = qe(this.thumbAspectRatio, { width: this.player.media.clientWidth, height: this.player.media.clientHeight });
|
|
1961
|
-
this.elements.scrubbing.container.style.width = `${t}px`, this.elements.scrubbing.container.style.height = `${s}px`;
|
|
1962
|
-
}), m(this, "setImageSizeAndOffset", (t, s) => {
|
|
1963
|
-
if (!this.usingSprites) return;
|
|
1964
|
-
const n = this.thumbContainerHeight / s.h;
|
|
1965
|
-
t.style.height = t.naturalHeight * n + "px", t.style.width = t.naturalWidth * n + "px", t.style.left = `-${s.x * n}px`, t.style.top = `-${s.y * n}px`;
|
|
1966
|
-
}), this.player = i, this.thumbnails = [], this.loaded = !1, this.lastMouseMoveTime = Date.now(), this.mouseDown = !1, this.loadedImages = [], this.elements = { thumb: {}, scrubbing: {} }, this.load();
|
|
1967
|
-
}
|
|
1968
|
-
get enabled() {
|
|
1969
|
-
return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
|
|
1970
|
-
}
|
|
1971
|
-
get currentImageContainer() {
|
|
1972
|
-
return this.mouseDown ? this.elements.scrubbing.container : this.elements.thumb.imageContainer;
|
|
1973
|
-
}
|
|
1974
|
-
get usingSprites() {
|
|
1975
|
-
return Object.keys(this.thumbnails[0].frames[0]).includes("w");
|
|
1976
|
-
}
|
|
1977
|
-
get thumbAspectRatio() {
|
|
1978
|
-
return this.usingSprites ? this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h : this.thumbnails[0].width / this.thumbnails[0].height;
|
|
1979
|
-
}
|
|
1980
|
-
get thumbContainerHeight() {
|
|
1981
|
-
if (this.mouseDown) {
|
|
1982
|
-
const { height: i } = qe(this.thumbAspectRatio, { width: this.player.media.clientWidth, height: this.player.media.clientHeight });
|
|
1983
|
-
return i;
|
|
1984
|
-
}
|
|
1985
|
-
return this.sizeSpecifiedInCSS ? this.elements.thumb.imageContainer.clientHeight : Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
|
|
1986
|
-
}
|
|
1987
|
-
get currentImageElement() {
|
|
1988
|
-
return this.mouseDown ? this.currentScrubbingImageElement : this.currentThumbnailImageElement;
|
|
1989
|
-
}
|
|
1990
|
-
set currentImageElement(i) {
|
|
1991
|
-
this.mouseDown ? this.currentScrubbingImageElement = i : this.currentThumbnailImageElement = i;
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
const Ee = { insertElements(e, i) {
|
|
1995
|
-
r.string(i) ? je(e, this.media, { src: i }) : r.array(i) && i.forEach((t) => {
|
|
1996
|
-
je(e, this.media, t);
|
|
1997
|
-
});
|
|
1998
|
-
}, change(e) {
|
|
1999
|
-
Ge(e, "sources.length") ? (W.cancelRequests.call(this), this.destroy.call(this, () => {
|
|
2000
|
-
this.options.quality = [], F(this.media), this.media = null, r.element(this.elements.container) && this.elements.container.removeAttribute("class");
|
|
2001
|
-
const { sources: i, type: t } = e, [{ provider: s = B.html5, src: n }] = i, a = s === "html5" ? t : "div", l = s === "html5" ? {} : { src: n };
|
|
2002
|
-
Object.assign(this, { provider: s, type: t, supported: x.check(t, s, this.config.playsinline), media: y(a, l) }), this.elements.container.appendChild(this.media), r.boolean(e.autoplay) && (this.config.autoplay = e.autoplay), this.isHTML5 && (this.config.crossorigin && this.media.setAttribute("crossorigin", ""), this.config.autoplay && this.media.setAttribute("autoplay", ""), r.empty(e.poster) || (this.poster = e.poster), this.config.loop.active && this.media.setAttribute("loop", ""), this.config.muted && this.media.setAttribute("muted", ""), this.config.playsinline && this.media.setAttribute("playsinline", "")), P.addStyleHook.call(this), this.isHTML5 && Ee.insertElements.call(this, "source", i), this.config.title = e.title, ut.setup.call(this), this.isHTML5 && Object.keys(e).includes("tracks") && Ee.insertElements.call(this, "track", e.tracks), (this.isHTML5 || this.isEmbed && !this.supported.ui) && P.build.call(this), this.isHTML5 && this.media.load(), r.empty(e.previewThumbnails) || (Object.assign(this.config.previewThumbnails, e.previewThumbnails), this.previewThumbnails && this.previewThumbnails.loaded && (this.previewThumbnails.destroy(), this.previewThumbnails = null), this.config.previewThumbnails.enabled && (this.previewThumbnails = new Ae(this))), this.fullscreen.update();
|
|
2003
|
-
}, !0)) : this.debug.warn("Invalid source format");
|
|
2004
|
-
} };
|
|
2005
|
-
class he {
|
|
2006
|
-
constructor(i, t) {
|
|
2007
|
-
if (m(this, "play", () => r.function(this.media.play) ? (this.ads && this.ads.enabled && this.ads.managerPromise.then(() => this.ads.play()).catch(() => V(this.media.play())), this.media.play()) : null), m(this, "pause", () => this.playing && r.function(this.media.pause) ? this.media.pause() : null), m(this, "togglePlay", (o) => (r.boolean(o) ? o : !this.playing) ? this.play() : this.pause()), m(this, "stop", () => {
|
|
2008
|
-
this.isHTML5 ? (this.pause(), this.restart()) : r.function(this.media.stop) && this.media.stop();
|
|
2009
|
-
}), m(this, "restart", () => {
|
|
2010
|
-
this.currentTime = 0;
|
|
2011
|
-
}), m(this, "rewind", (o) => {
|
|
2012
|
-
this.currentTime -= r.number(o) ? o : this.config.seekTime;
|
|
2013
|
-
}), m(this, "forward", (o) => {
|
|
2014
|
-
this.currentTime += r.number(o) ? o : this.config.seekTime;
|
|
2015
|
-
}), m(this, "increaseVolume", (o) => {
|
|
2016
|
-
const c = this.media.muted ? 0 : this.volume;
|
|
2017
|
-
this.volume = c + (r.number(o) ? o : 0);
|
|
2018
|
-
}), m(this, "decreaseVolume", (o) => {
|
|
2019
|
-
this.increaseVolume(-o);
|
|
2020
|
-
}), m(this, "airplay", () => {
|
|
2021
|
-
x.airplay && this.media.webkitShowPlaybackTargetPicker();
|
|
2022
|
-
}), m(this, "toggleControls", (o) => {
|
|
2023
|
-
if (this.supported.ui && !this.isAudio) {
|
|
2024
|
-
const c = ce(this.elements.container, this.config.classNames.hideControls), u = o === void 0 ? void 0 : !o, g = S(this.elements.container, this.config.classNames.hideControls, u);
|
|
2025
|
-
if (g && r.array(this.config.controls) && this.config.controls.includes("settings") && !r.empty(this.config.settings) && h.toggleMenu.call(this, !1), g !== c) {
|
|
2026
|
-
const f = g ? "controlshidden" : "controlsshown";
|
|
2027
|
-
b.call(this, this.media, f);
|
|
2028
|
-
}
|
|
2029
|
-
return !g;
|
|
2030
|
-
}
|
|
2031
|
-
return !1;
|
|
2032
|
-
}), m(this, "on", (o, c) => {
|
|
2033
|
-
C.call(this, this.elements.container, o, c);
|
|
2034
|
-
}), m(this, "once", (o, c) => {
|
|
2035
|
-
Me.call(this, this.elements.container, o, c);
|
|
2036
|
-
}), m(this, "off", (o, c) => {
|
|
2037
|
-
me(this.elements.container, o, c);
|
|
2038
|
-
}), m(this, "destroy", (o, c = !1) => {
|
|
2039
|
-
if (!this.ready) return;
|
|
2040
|
-
const u = () => {
|
|
2041
|
-
document.body.style.overflow = "", this.embed = null, c ? (Object.keys(this.elements).length && (F(this.elements.buttons.play), F(this.elements.captions), F(this.elements.controls), F(this.elements.wrapper), this.elements.buttons.play = null, this.elements.captions = null, this.elements.controls = null, this.elements.wrapper = null), r.function(o) && o()) : (Xt.call(this), W.cancelRequests.call(this), oe(this.elements.original, this.elements.container), b.call(this, this.elements.original, "destroyed", !0), r.function(o) && o.call(this.elements.original), this.ready = !1, setTimeout(() => {
|
|
2042
|
-
this.elements = null, this.media = null;
|
|
2043
|
-
}, 200));
|
|
2044
|
-
};
|
|
2045
|
-
this.stop(), clearTimeout(this.timers.loading), clearTimeout(this.timers.controls), clearTimeout(this.timers.resized), this.isHTML5 ? (P.toggleNativeControls.call(this, !0), u()) : this.isYouTube ? (clearInterval(this.timers.buffering), clearInterval(this.timers.playing), this.embed !== null && r.function(this.embed.destroy) && this.embed.destroy(), u()) : this.isVimeo && (this.embed !== null && this.embed.unload().then(u), setTimeout(u, 200));
|
|
2046
|
-
}), m(this, "supports", (o) => x.mime.call(this, o)), this.timers = {}, this.ready = !1, this.loading = !1, this.failed = !1, this.touch = x.touch, this.media = i, r.string(this.media) && (this.media = document.querySelectorAll(this.media)), (window.jQuery && this.media instanceof jQuery || r.nodeList(this.media) || r.array(this.media)) && (this.media = this.media[0]), this.config = N({}, ct, he.defaults, t || {}, (() => {
|
|
2047
|
-
try {
|
|
2048
|
-
return JSON.parse(this.media.getAttribute("data-plyr-config"));
|
|
2049
|
-
} catch {
|
|
2050
|
-
return {};
|
|
2051
|
-
}
|
|
2052
|
-
})()), this.elements = { container: null, fullscreen: null, captions: null, buttons: {}, display: {}, progress: {}, inputs: {}, settings: { popup: null, menu: null, panels: {}, buttons: {} } }, this.captions = { active: null, currentTrack: -1, meta: /* @__PURE__ */ new WeakMap() }, this.fullscreen = { active: !1 }, this.options = { speed: [], quality: [] }, this.debug = new oi(this.config.debug), this.debug.log("Config", this.config), this.debug.log("Support", x), r.nullOrUndefined(this.media) || !r.element(this.media)) return void this.debug.error("Setup failed: no suitable element passed");
|
|
2053
|
-
if (this.media.plyr) return void this.debug.warn("Target already setup");
|
|
2054
|
-
if (!this.config.enabled) return void this.debug.error("Setup failed: disabled by config");
|
|
2055
|
-
if (!x.check().api) return void this.debug.error("Setup failed: no support");
|
|
2056
|
-
const s = this.media.cloneNode(!0);
|
|
2057
|
-
s.autoplay = !1, this.elements.original = s;
|
|
2058
|
-
const n = this.media.tagName.toLowerCase();
|
|
2059
|
-
let a = null, l = null;
|
|
2060
|
-
switch (n) {
|
|
2061
|
-
case "div":
|
|
2062
|
-
if (a = this.media.querySelector("iframe"), r.element(a)) {
|
|
2063
|
-
if (l = lt(a.getAttribute("src")), this.provider = li(l.toString()), this.elements.container = this.media, this.media = a, this.elements.container.className = "", l.search.length) {
|
|
2064
|
-
const o = ["1", "true"];
|
|
2065
|
-
o.includes(l.searchParams.get("autoplay")) && (this.config.autoplay = !0), o.includes(l.searchParams.get("loop")) && (this.config.loop.active = !0), this.isYouTube ? (this.config.playsinline = o.includes(l.searchParams.get("playsinline")), this.config.youtube.hl = l.searchParams.get("hl")) : this.config.playsinline = !0;
|
|
2066
|
-
}
|
|
2067
|
-
} else this.provider = this.media.getAttribute(this.config.attributes.embed.provider), this.media.removeAttribute(this.config.attributes.embed.provider);
|
|
2068
|
-
if (r.empty(this.provider) || !Object.values(B).includes(this.provider)) return void this.debug.error("Setup failed: Invalid provider");
|
|
2069
|
-
this.type = ye.video;
|
|
2070
|
-
break;
|
|
2071
|
-
case "video":
|
|
2072
|
-
case "audio":
|
|
2073
|
-
this.type = n, this.provider = B.html5, this.media.hasAttribute("crossorigin") && (this.config.crossorigin = !0), this.media.hasAttribute("autoplay") && (this.config.autoplay = !0), (this.media.hasAttribute("playsinline") || this.media.hasAttribute("webkit-playsinline")) && (this.config.playsinline = !0), this.media.hasAttribute("muted") && (this.config.muted = !0), this.media.hasAttribute("loop") && (this.config.loop.active = !0);
|
|
2074
|
-
break;
|
|
2075
|
-
default:
|
|
2076
|
-
return void this.debug.error("Setup failed: unsupported type");
|
|
2077
|
-
}
|
|
2078
|
-
this.supported = x.check(this.type, this.provider), this.supported.api ? (this.eventListeners = [], this.listeners = new ci(this), this.storage = new ee(this), this.media.plyr = this, r.element(this.elements.container) || (this.elements.container = y("div"), Ze(this.media, this.elements.container)), P.migrateStyles.call(this), P.addStyleHook.call(this), ut.setup.call(this), this.config.debug && C.call(this, this.elements.container, this.config.events.join(" "), (o) => {
|
|
2079
|
-
this.debug.log(`event: ${o.type}`);
|
|
2080
|
-
}), this.fullscreen = new R(this), (this.isHTML5 || this.isEmbed && !this.supported.ui) && P.build.call(this), this.listeners.container(), this.listeners.global(), this.config.ads.enabled && (this.ads = new fi(this)), this.isHTML5 && this.config.autoplay && this.once("canplay", () => V(this.play())), this.lastSeekTime = 0, this.config.previewThumbnails.enabled && (this.previewThumbnails = new Ae(this))) : this.debug.error("Setup failed: no support");
|
|
2081
|
-
}
|
|
2082
|
-
get isHTML5() {
|
|
2083
|
-
return this.provider === B.html5;
|
|
2084
|
-
}
|
|
2085
|
-
get isEmbed() {
|
|
2086
|
-
return this.isYouTube || this.isVimeo;
|
|
2087
|
-
}
|
|
2088
|
-
get isYouTube() {
|
|
2089
|
-
return this.provider === B.youtube;
|
|
2090
|
-
}
|
|
2091
|
-
get isVimeo() {
|
|
2092
|
-
return this.provider === B.vimeo;
|
|
2093
|
-
}
|
|
2094
|
-
get isVideo() {
|
|
2095
|
-
return this.type === ye.video;
|
|
2096
|
-
}
|
|
2097
|
-
get isAudio() {
|
|
2098
|
-
return this.type === ye.audio;
|
|
2099
|
-
}
|
|
2100
|
-
get playing() {
|
|
2101
|
-
return !!(this.ready && !this.paused && !this.ended);
|
|
2102
|
-
}
|
|
2103
|
-
get paused() {
|
|
2104
|
-
return !!this.media.paused;
|
|
2105
|
-
}
|
|
2106
|
-
get stopped() {
|
|
2107
|
-
return !!(this.paused && this.currentTime === 0);
|
|
2108
|
-
}
|
|
2109
|
-
get ended() {
|
|
2110
|
-
return !!this.media.ended;
|
|
2111
|
-
}
|
|
2112
|
-
set currentTime(i) {
|
|
2113
|
-
if (!this.duration) return;
|
|
2114
|
-
const t = r.number(i) && i > 0;
|
|
2115
|
-
this.media.currentTime = t ? Math.min(i, this.duration) : 0, this.debug.log(`Seeking to ${this.currentTime} seconds`);
|
|
2116
|
-
}
|
|
2117
|
-
get currentTime() {
|
|
2118
|
-
return Number(this.media.currentTime);
|
|
2119
|
-
}
|
|
2120
|
-
get buffered() {
|
|
2121
|
-
const { buffered: i } = this.media;
|
|
2122
|
-
return r.number(i) ? i : i && i.length && this.duration > 0 ? i.end(0) / this.duration : 0;
|
|
2123
|
-
}
|
|
2124
|
-
get seeking() {
|
|
2125
|
-
return !!this.media.seeking;
|
|
2126
|
-
}
|
|
2127
|
-
get duration() {
|
|
2128
|
-
const i = parseFloat(this.config.duration), t = (this.media || {}).duration, s = r.number(t) && t !== 1 / 0 ? t : 0;
|
|
2129
|
-
return i || s;
|
|
2130
|
-
}
|
|
2131
|
-
set volume(i) {
|
|
2132
|
-
let t = i;
|
|
2133
|
-
r.string(t) && (t = Number(t)), r.number(t) || (t = this.storage.get("volume")), r.number(t) || ({ volume: t } = this.config), t > 1 && (t = 1), t < 0 && (t = 0), this.config.volume = t, this.media.volume = t, !r.empty(i) && this.muted && t > 0 && (this.muted = !1);
|
|
2134
|
-
}
|
|
2135
|
-
get volume() {
|
|
2136
|
-
return Number(this.media.volume);
|
|
2137
|
-
}
|
|
2138
|
-
set muted(i) {
|
|
2139
|
-
let t = i;
|
|
2140
|
-
r.boolean(t) || (t = this.storage.get("muted")), r.boolean(t) || (t = this.config.muted), this.config.muted = t, this.media.muted = t;
|
|
2141
|
-
}
|
|
2142
|
-
get muted() {
|
|
2143
|
-
return !!this.media.muted;
|
|
2144
|
-
}
|
|
2145
|
-
get hasAudio() {
|
|
2146
|
-
return !this.isHTML5 || !!this.isAudio || !!this.media.mozHasAudio || !!this.media.webkitAudioDecodedByteCount || !!(this.media.audioTracks && this.media.audioTracks.length);
|
|
2147
|
-
}
|
|
2148
|
-
set speed(i) {
|
|
2149
|
-
let t = null;
|
|
2150
|
-
r.number(i) && (t = i), r.number(t) || (t = this.storage.get("speed")), r.number(t) || (t = this.config.speed.selected);
|
|
2151
|
-
const { minimumSpeed: s, maximumSpeed: n } = this;
|
|
2152
|
-
t = ht(t, s, n), this.config.speed.selected = t, setTimeout(() => {
|
|
2153
|
-
this.media && (this.media.playbackRate = t);
|
|
2154
|
-
}, 0);
|
|
2155
|
-
}
|
|
2156
|
-
get speed() {
|
|
2157
|
-
return Number(this.media.playbackRate);
|
|
2158
|
-
}
|
|
2159
|
-
get minimumSpeed() {
|
|
2160
|
-
return this.isYouTube ? Math.min(...this.options.speed) : this.isVimeo ? 0.5 : 0.0625;
|
|
2161
|
-
}
|
|
2162
|
-
get maximumSpeed() {
|
|
2163
|
-
return this.isYouTube ? Math.max(...this.options.speed) : this.isVimeo ? 2 : 16;
|
|
2164
|
-
}
|
|
2165
|
-
set quality(i) {
|
|
2166
|
-
const t = this.config.quality, s = this.options.quality;
|
|
2167
|
-
if (!s.length) return;
|
|
2168
|
-
let n = [!r.empty(i) && Number(i), this.storage.get("quality"), t.selected, t.default].find(r.number), a = !0;
|
|
2169
|
-
if (!s.includes(n)) {
|
|
2170
|
-
const l = et(s, n);
|
|
2171
|
-
this.debug.warn(`Unsupported quality option: ${n}, using ${l} instead`), n = l, a = !1;
|
|
2172
|
-
}
|
|
2173
|
-
t.selected = n, this.media.quality = n, a && this.storage.set({ quality: n });
|
|
2174
|
-
}
|
|
2175
|
-
get quality() {
|
|
2176
|
-
return this.media.quality;
|
|
2177
|
-
}
|
|
2178
|
-
set loop(i) {
|
|
2179
|
-
const t = r.boolean(i) ? i : this.config.loop.active;
|
|
2180
|
-
this.config.loop.active = t, this.media.loop = t;
|
|
2181
|
-
}
|
|
2182
|
-
get loop() {
|
|
2183
|
-
return !!this.media.loop;
|
|
2184
|
-
}
|
|
2185
|
-
set source(i) {
|
|
2186
|
-
Ee.change.call(this, i);
|
|
2187
|
-
}
|
|
2188
|
-
get source() {
|
|
2189
|
-
return this.media.currentSrc;
|
|
2190
|
-
}
|
|
2191
|
-
get download() {
|
|
2192
|
-
const { download: i } = this.config.urls;
|
|
2193
|
-
return r.url(i) ? i : this.source;
|
|
2194
|
-
}
|
|
2195
|
-
set download(i) {
|
|
2196
|
-
r.url(i) && (this.config.urls.download = i, h.setDownloadUrl.call(this));
|
|
2197
|
-
}
|
|
2198
|
-
set poster(i) {
|
|
2199
|
-
this.isVideo ? P.setPoster.call(this, i, !1).catch(() => {
|
|
2200
|
-
}) : this.debug.warn("Poster can only be set for video");
|
|
2201
|
-
}
|
|
2202
|
-
get poster() {
|
|
2203
|
-
return this.isVideo ? this.media.getAttribute("poster") || this.media.getAttribute("data-poster") : null;
|
|
2204
|
-
}
|
|
2205
|
-
get ratio() {
|
|
2206
|
-
if (!this.isVideo) return null;
|
|
2207
|
-
const i = ue(Ne.call(this));
|
|
2208
|
-
return r.array(i) ? i.join(":") : i;
|
|
2209
|
-
}
|
|
2210
|
-
set ratio(i) {
|
|
2211
|
-
this.isVideo ? r.string(i) && it(i) ? (this.config.ratio = ue(i), Y.call(this)) : this.debug.error(`Invalid aspect ratio specified (${i})`) : this.debug.warn("Aspect ratio can only be set for video");
|
|
2212
|
-
}
|
|
2213
|
-
set autoplay(i) {
|
|
2214
|
-
this.config.autoplay = r.boolean(i) ? i : this.config.autoplay;
|
|
2215
|
-
}
|
|
2216
|
-
get autoplay() {
|
|
2217
|
-
return !!this.config.autoplay;
|
|
2218
|
-
}
|
|
2219
|
-
toggleCaptions(i) {
|
|
2220
|
-
E.toggle.call(this, i, !1);
|
|
2221
|
-
}
|
|
2222
|
-
set currentTrack(i) {
|
|
2223
|
-
E.set.call(this, i, !1), E.setup.call(this);
|
|
2224
|
-
}
|
|
2225
|
-
get currentTrack() {
|
|
2226
|
-
const { toggled: i, currentTrack: t } = this.captions;
|
|
2227
|
-
return i ? t : -1;
|
|
2228
|
-
}
|
|
2229
|
-
set language(i) {
|
|
2230
|
-
E.setLanguage.call(this, i, !1);
|
|
2231
|
-
}
|
|
2232
|
-
get language() {
|
|
2233
|
-
return (E.getCurrentTrack.call(this) || {}).language;
|
|
2234
|
-
}
|
|
2235
|
-
set pip(i) {
|
|
2236
|
-
if (!x.pip) return;
|
|
2237
|
-
const t = r.boolean(i) ? i : !this.pip;
|
|
2238
|
-
r.function(this.media.webkitSetPresentationMode) && this.media.webkitSetPresentationMode(t ? fe.active : fe.inactive), r.function(this.media.requestPictureInPicture) && (!this.pip && t ? this.media.requestPictureInPicture() : this.pip && !t && document.exitPictureInPicture());
|
|
2239
|
-
}
|
|
2240
|
-
get pip() {
|
|
2241
|
-
return x.pip ? r.empty(this.media.webkitPresentationMode) ? this.media === document.pictureInPictureElement : this.media.webkitPresentationMode === fe.active : null;
|
|
2242
|
-
}
|
|
2243
|
-
setPreviewThumbnails(i) {
|
|
2244
|
-
this.previewThumbnails && this.previewThumbnails.loaded && (this.previewThumbnails.destroy(), this.previewThumbnails = null), Object.assign(this.config.previewThumbnails, i), this.config.previewThumbnails.enabled && (this.previewThumbnails = new Ae(this));
|
|
2245
|
-
}
|
|
2246
|
-
static supported(i, t) {
|
|
2247
|
-
return x.check(i, t);
|
|
2248
|
-
}
|
|
2249
|
-
static loadSprite(i, t) {
|
|
2250
|
-
return at(i, t);
|
|
2251
|
-
}
|
|
2252
|
-
static setup(i, t = {}) {
|
|
2253
|
-
let s = null;
|
|
2254
|
-
return r.string(i) ? s = Array.from(document.querySelectorAll(i)) : r.nodeList(i) ? s = Array.from(i) : r.array(i) && (s = i.filter(r.element)), r.empty(s) ? null : s.map((n) => new he(n, t));
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
he.defaults = zt(ct);
|
|
2258
|
-
export {
|
|
2259
|
-
he as default
|
|
2260
|
-
};
|