@banou/media-player 0.10.32 → 0.10.34
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/README.md +8 -1
- package/dist/ar-CS4Yzfxw.js +52 -0
- package/dist/he-DbFw1CdO.js +52 -0
- package/dist/index.js +265 -252
- package/dist/react/components/chrome.d.ts +3 -1
- package/dist/react/components/skip-chapter.d.ts +5 -1
- package/dist/remote/index.d.ts +17 -4
- package/dist/remote/index.js +17 -5
- package/dist/remote/protocol.d.ts +4 -2
- package/package.json +1 -1
- package/src/lib/locales/ar.json +49 -0
- package/src/lib/locales/he.json +49 -0
- package/src/lib/react/components/chrome.tsx +4 -2
- package/src/lib/react/components/overlay.tsx +2 -1
- package/src/lib/react/components/skip-chapter.tsx +8 -2
- package/src/lib/react/components/tooltip-display.tsx +3 -1
- package/src/lib/react/components/track-menu.tsx +1 -1
- package/src/lib/react/labels.tsx +2 -0
- package/src/lib/react/video-player.tsx +12 -3
- package/src/lib/remote/index.ts +29 -6
- package/src/lib/remote/protocol.ts +6 -3
package/dist/index.js
CHANGED
|
@@ -8,10 +8,10 @@ import { definePlayerFeature as A, videoFeatures as j } from "@videojs/core/dom"
|
|
|
8
8
|
import { makeRemuxer as M } from "libav-wasm";
|
|
9
9
|
import { Fragment as N, jsx as P, jsxs as F } from "@emotion/react/jsx-runtime";
|
|
10
10
|
import { createMediaElementSource as I } from "@banou/ponyfill/web-audio";
|
|
11
|
-
import { Captions as L, CaptionsOff as R, Check as z, ChevronLeft as B, ChevronRight as V, Copy as te, Maximize as H, Minimize as
|
|
12
|
-
import { Tooltip as
|
|
11
|
+
import { Captions as L, CaptionsOff as R, Check as z, ChevronLeft as B, ChevronRight as V, Copy as te, Maximize as H, Minimize as U, Pause as W, Play as G, RotateCcw as K, Settings as q, TriangleAlert as J, Volume1 as ne, Volume2 as re, VolumeX as ie } from "lucide-react";
|
|
12
|
+
import { Tooltip as ae } from "react-tooltip";
|
|
13
13
|
//#region src/lib/react/source-feature.ts
|
|
14
|
-
var
|
|
14
|
+
var oe = {
|
|
15
15
|
indexes: [],
|
|
16
16
|
chapters: [],
|
|
17
17
|
thumbnails: [],
|
|
@@ -36,22 +36,24 @@ var se = {
|
|
|
36
36
|
playbackErrors: [],
|
|
37
37
|
ready: !1,
|
|
38
38
|
setSourceState: () => {}
|
|
39
|
-
},
|
|
39
|
+
}, se = A({
|
|
40
40
|
name: "source",
|
|
41
|
-
state: () => ({ ...
|
|
41
|
+
state: () => ({ ...oe }),
|
|
42
42
|
attach({ set: e }) {
|
|
43
43
|
e({
|
|
44
44
|
setSourceState: (t) => e(t),
|
|
45
45
|
setHideUI: (t) => e({ hideUI: t })
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
}),
|
|
49
|
-
features: [...j,
|
|
48
|
+
}), ce = O({
|
|
49
|
+
features: [...j, se],
|
|
50
50
|
displayName: "MediaPlayer"
|
|
51
|
-
}),
|
|
51
|
+
}), Y = ce.usePlayer, le = {
|
|
52
|
+
ar: () => import("./ar-CS4Yzfxw.js"),
|
|
52
53
|
de: () => import("./de-DphEdq0O.js"),
|
|
53
54
|
"es-419": () => import("./es-419-D6gsvnn8.js"),
|
|
54
55
|
fr: () => import("./fr-BqAzAJX0.js"),
|
|
56
|
+
he: () => import("./he-DbFw1CdO.js"),
|
|
55
57
|
it: () => import("./it-NTcUh3Gr.js"),
|
|
56
58
|
ja: () => import("./ja-DSmX_bxj.js"),
|
|
57
59
|
ko: () => import("./ko-DyPzWasj.js"),
|
|
@@ -61,7 +63,7 @@ var se = {
|
|
|
61
63
|
tr: () => import("./tr-CW7R7N9k.js"),
|
|
62
64
|
"zh-Hans": () => import("./zh-Hans-IhL1Pl78.js"),
|
|
63
65
|
"zh-Hant": () => import("./zh-Hant-C5YyFjEc.js")
|
|
64
|
-
},
|
|
66
|
+
}, ue = Object.keys(le), de = (e) => {
|
|
65
67
|
try {
|
|
66
68
|
let t = new Intl.Locale(e), { language: n, script: r } = t.maximize();
|
|
67
69
|
return {
|
|
@@ -72,24 +74,24 @@ var se = {
|
|
|
72
74
|
} catch {
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
|
-
},
|
|
77
|
+
}, X = (e) => {
|
|
76
78
|
let t = de(e);
|
|
77
79
|
if (!t) return;
|
|
78
|
-
let n =
|
|
80
|
+
let n = ue.map((e) => ({
|
|
79
81
|
...de(e),
|
|
80
82
|
catalogue: e
|
|
81
83
|
}));
|
|
82
84
|
return (n.find(({ tag: e }) => e === t.tag) ?? n.find(({ language: e, script: n }) => e === t.language && n === t.script) ?? n.find(({ language: e }) => e === t.language))?.catalogue;
|
|
83
|
-
},
|
|
84
|
-
let n =
|
|
85
|
-
return n || (n = Promise.all([import("@formatjs/intl"),
|
|
85
|
+
}, fe = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map(), Z = (e, t) => {
|
|
86
|
+
let n = pe.get(e);
|
|
87
|
+
return n || (n = Promise.all([import("@formatjs/intl"), le[t]()]).then(([{ createIntl: t }, { default: n }]) => {
|
|
86
88
|
let r = t({
|
|
87
89
|
locale: e,
|
|
88
90
|
defaultLocale: "en",
|
|
89
91
|
messages: n
|
|
90
92
|
});
|
|
91
|
-
return
|
|
92
|
-
}), n.catch(() =>
|
|
93
|
+
return fe.set(e, r), r;
|
|
94
|
+
}), n.catch(() => pe.delete(e)), pe.set(e, n)), n;
|
|
93
95
|
}, me = (e) => {
|
|
94
96
|
try {
|
|
95
97
|
return Intl.getCanonicalLocales(e)[0];
|
|
@@ -107,17 +109,17 @@ var se = {
|
|
|
107
109
|
locale: r
|
|
108
110
|
};
|
|
109
111
|
}, ge = he(void 0, void 0), _e = _(ge), Q = () => b(_e), ve = ({ language: e, children: t }) => {
|
|
110
|
-
let n = e ?
|
|
112
|
+
let n = e ? X(e) : void 0, [, r] = w();
|
|
111
113
|
x(() => {
|
|
112
|
-
if (!e || !n ||
|
|
114
|
+
if (!e || !n || fe.has(e)) return;
|
|
113
115
|
let t = !1;
|
|
114
|
-
return
|
|
116
|
+
return Z(e, n).then((e) => {
|
|
115
117
|
t || r(e);
|
|
116
118
|
}, () => {}), () => {
|
|
117
119
|
t = !0;
|
|
118
120
|
};
|
|
119
121
|
}, [e, n]);
|
|
120
|
-
let i = e && n ?
|
|
122
|
+
let i = e && n ? fe.get(e) : void 0, a = S(() => e ? he(i, e) : ge, [i, e]);
|
|
121
123
|
return /* @__PURE__ */ P(_e.Provider, {
|
|
122
124
|
value: a,
|
|
123
125
|
children: t
|
|
@@ -167,7 +169,7 @@ var se = {
|
|
|
167
169
|
}
|
|
168
170
|
return t.length ? t.join("\n") : void 0;
|
|
169
171
|
}, Ae = (e, t, n, r) => {
|
|
170
|
-
let a =
|
|
172
|
+
let a = Y(), { read: o, size: c, publicPath: l = "", libavWorkerUrl: f = "", jassubWorkerUrl: p = "", jassubWasmUrl: m = "", jassubLegacyWasmUrl: h, defaultFontUrl: g, cjkFontUrl: _, bufferSize: v, autoplay: b = !1, chapters: S, seekPrepareBudgetMs: T = Te } = n ?? {}, E = C(S);
|
|
171
173
|
E.current = S;
|
|
172
174
|
let [D, O] = w(), k = D && D.size === c ? D.streamIndex : void 0, [ee, A] = w(0), j = C({
|
|
173
175
|
count: 0,
|
|
@@ -196,21 +198,21 @@ var se = {
|
|
|
196
198
|
te.current = n?.onPreferredSubtitleLanguageChange;
|
|
197
199
|
let H = C(n?.onSeek);
|
|
198
200
|
H.current = n?.onSeek;
|
|
199
|
-
let
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
let
|
|
204
|
-
|
|
201
|
+
let U = C(n?.onPlaybackError);
|
|
202
|
+
U.current = n?.onPlaybackError;
|
|
203
|
+
let W = C(r);
|
|
204
|
+
W.current = r;
|
|
205
|
+
let G = Q(), K = C(G);
|
|
206
|
+
K.current = G, x(() => {
|
|
205
207
|
let { audio: e, subtitles: t } = L.current;
|
|
206
|
-
t.length && a.setSourceState({ subtitleTracks: Se(t,
|
|
207
|
-
}, [a,
|
|
208
|
-
let
|
|
208
|
+
t.length && a.setSourceState({ subtitleTracks: Se(t, G) }), e.length && a.setSourceState({ audioTracks: Se(e, G) });
|
|
209
|
+
}, [a, G]);
|
|
210
|
+
let q = y((e) => {
|
|
209
211
|
let t = typeof e == "number" ? e : void 0, n = a.selectedSubtitleTrack === void 0;
|
|
210
212
|
F.current = I.current, a.setSourceState({ selectedSubtitleTrack: t }), N.current?.selectSubtitleStream(t);
|
|
211
213
|
let r = L.current.subtitles.find((e) => e.streamIndex === t), i = t === void 0 ? null : u(r) ?? (n ? r?.title?.trim() || "und" : void 0);
|
|
212
214
|
i !== void 0 && te.current?.(i);
|
|
213
|
-
}, [a]),
|
|
215
|
+
}, [a]), J = y((e) => {
|
|
214
216
|
let t = N.current;
|
|
215
217
|
if (!t || T <= 0) {
|
|
216
218
|
a.seek(e);
|
|
@@ -234,7 +236,7 @@ var se = {
|
|
|
234
236
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
235
237
|
clearTimeout(d), s();
|
|
236
238
|
});
|
|
237
|
-
}, [a, T]),
|
|
239
|
+
}, [a, T]), ne = y((e) => {
|
|
238
240
|
if (typeof e != "number" || I.current === void 0) return;
|
|
239
241
|
a.setSourceState({ selectedAudioTrack: e }), O({
|
|
240
242
|
size: I.current,
|
|
@@ -242,18 +244,18 @@ var se = {
|
|
|
242
244
|
});
|
|
243
245
|
let t = u(L.current.audio.find((t) => t.streamIndex === e));
|
|
244
246
|
t !== void 0 && V.current?.(t);
|
|
245
|
-
}, [a]),
|
|
247
|
+
}, [a]), re = Y((e) => e.setSourceState);
|
|
246
248
|
x(() => {
|
|
247
|
-
|
|
248
|
-
selectSubtitleTrack:
|
|
249
|
-
selectAudioTrack:
|
|
250
|
-
requestSeek:
|
|
249
|
+
re({
|
|
250
|
+
selectSubtitleTrack: q,
|
|
251
|
+
selectAudioTrack: ne,
|
|
252
|
+
requestSeek: J
|
|
251
253
|
});
|
|
252
254
|
}, [
|
|
253
|
-
ie,
|
|
254
|
-
K,
|
|
255
255
|
re,
|
|
256
|
-
q
|
|
256
|
+
q,
|
|
257
|
+
ne,
|
|
258
|
+
J
|
|
257
259
|
]), x(() => {
|
|
258
260
|
if (!e || !t || !c || !o) return;
|
|
259
261
|
let n = !1;
|
|
@@ -298,7 +300,7 @@ var se = {
|
|
|
298
300
|
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), M.current && clearTimeout(M.current), M.current = setTimeout(() => A((e) => e + 1), n);
|
|
299
301
|
return;
|
|
300
302
|
}
|
|
301
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
303
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), U.current?.(e);
|
|
302
304
|
};
|
|
303
305
|
return (async () => {
|
|
304
306
|
try {
|
|
@@ -331,16 +333,16 @@ var se = {
|
|
|
331
333
|
n || a.setSourceState({ playbackError: null });
|
|
332
334
|
},
|
|
333
335
|
onSeek: (e) => H.current?.(e),
|
|
334
|
-
onOutput: (e) =>
|
|
336
|
+
onOutput: (e) => W.current?.(e),
|
|
335
337
|
onSubtitleStreams: (e) => {
|
|
336
338
|
n || (L.current.subtitles = e, a.setSourceState({
|
|
337
|
-
subtitleTracks: Se(e,
|
|
339
|
+
subtitleTracks: Se(e, K.current),
|
|
338
340
|
...F.current === c ? {} : { selectedSubtitleTrack: De(B.current, e) }
|
|
339
341
|
}));
|
|
340
342
|
},
|
|
341
343
|
onAudioStreams: (e, t) => {
|
|
342
344
|
n || (L.current.audio = e, a.setSourceState({
|
|
343
|
-
audioTracks: Se(e,
|
|
345
|
+
audioTracks: Se(e, K.current),
|
|
344
346
|
selectedAudioTrack: t
|
|
345
347
|
}));
|
|
346
348
|
}
|
|
@@ -403,7 +405,7 @@ var se = {
|
|
|
403
405
|
};
|
|
404
406
|
return r;
|
|
405
407
|
}, Pe = (e, t) => {
|
|
406
|
-
let n =
|
|
408
|
+
let n = Y(), r = Y((e) => e.setSourceState), i = C(t);
|
|
407
409
|
i.current = t;
|
|
408
410
|
let a = !!t;
|
|
409
411
|
x(() => {
|
|
@@ -670,7 +672,7 @@ var se = {
|
|
|
670
672
|
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
671
673
|
p.onmessage = ({ data: e }) => {
|
|
672
674
|
if (e.type === "unsupported") {
|
|
673
|
-
|
|
675
|
+
W();
|
|
674
676
|
return;
|
|
675
677
|
}
|
|
676
678
|
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
@@ -788,7 +790,7 @@ var se = {
|
|
|
788
790
|
}
|
|
789
791
|
e(z), z = void 0;
|
|
790
792
|
}
|
|
791
|
-
}, H = () => {},
|
|
793
|
+
}, H = () => {}, U = (e, t) => {
|
|
792
794
|
let n = !1, r = (e) => {
|
|
793
795
|
n && p.postMessage({
|
|
794
796
|
type: "end",
|
|
@@ -823,7 +825,7 @@ var se = {
|
|
|
823
825
|
}, [t]);
|
|
824
826
|
}
|
|
825
827
|
});
|
|
826
|
-
},
|
|
828
|
+
}, W = () => {
|
|
827
829
|
if (!a) {
|
|
828
830
|
a = !0, f(!0), l(), clearInterval(C);
|
|
829
831
|
for (let e of w) n.removeEventListener(e, x);
|
|
@@ -832,13 +834,13 @@ var se = {
|
|
|
832
834
|
_.clear();
|
|
833
835
|
}
|
|
834
836
|
};
|
|
835
|
-
return "tap" in i ?
|
|
836
|
-
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e),
|
|
837
|
+
return "tap" in i ? U(i.tap, i.audioStreamIndex) : te(i).catch((e) => {
|
|
838
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), W());
|
|
837
839
|
}), S(), {
|
|
838
840
|
update: (e) => {
|
|
839
841
|
o = e, f(!1);
|
|
840
842
|
},
|
|
841
|
-
stop:
|
|
843
|
+
stop: W
|
|
842
844
|
};
|
|
843
845
|
}, et = (e, t, n, r, i) => {
|
|
844
846
|
let a = C(null), [o, s] = w(!1), [c, l] = w(null);
|
|
@@ -1010,10 +1012,11 @@ var se = {
|
|
|
1010
1012
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1011
1013
|
pointer-events: none;
|
|
1012
1014
|
`, st = new Set(Object.values(a)), ct = (e) => e instanceof Error && st.has(e.label ?? ""), lt = (e, { format: t }) => ct(e) ? t(e.label, e.values) : e instanceof Error ? e.message : typeof e == "string" ? e : t(a.failed), ut = ({ onSubtitleRef: e }) => {
|
|
1013
|
-
let t = Q(), n =
|
|
1015
|
+
let t = Q(), n = Y((e) => e.title), r = Y((e) => e.hideUI), i = Y((e) => e.playbackError), a = Y((e) => e.ready), o = Y((e) => e.size), s = Y((e) => e.waiting), c = Y((e) => e.seekingTo);
|
|
1014
1016
|
return /* @__PURE__ */ F(N, { children: [
|
|
1015
1017
|
n ? /* @__PURE__ */ P("div", {
|
|
1016
1018
|
className: "title",
|
|
1019
|
+
dir: "auto",
|
|
1017
1020
|
css: rt,
|
|
1018
1021
|
style: { ...r ? {
|
|
1019
1022
|
opacity: "0",
|
|
@@ -1024,6 +1027,7 @@ var se = {
|
|
|
1024
1027
|
((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */ P("div", { css: at }) : void 0,
|
|
1025
1028
|
i ? /* @__PURE__ */ P("div", {
|
|
1026
1029
|
css: ot,
|
|
1030
|
+
dir: "auto",
|
|
1027
1031
|
children: lt(i, t)
|
|
1028
1032
|
}) : void 0,
|
|
1029
1033
|
/* @__PURE__ */ P("div", {
|
|
@@ -1052,7 +1056,7 @@ var se = {
|
|
|
1052
1056
|
max-width: min(calc(26 * var(--mp-unit)), calc(100vw - calc(2.4 * var(--mp-unit))));
|
|
1053
1057
|
white-space: normal;
|
|
1054
1058
|
overflow-wrap: anywhere;
|
|
1055
|
-
text-align:
|
|
1059
|
+
text-align: start;
|
|
1056
1060
|
|
|
1057
1061
|
/*
|
|
1058
1062
|
* The radius carries !important for the same reason the paddings below do.
|
|
@@ -1069,6 +1073,8 @@ var se = {
|
|
|
1069
1073
|
|
|
1070
1074
|
* {
|
|
1071
1075
|
${$.bMedium.regular}
|
|
1076
|
+
/* a label reads in its own direction, though the player around it stays left to right */
|
|
1077
|
+
unicode-bidi: plaintext;
|
|
1072
1078
|
}
|
|
1073
1079
|
|
|
1074
1080
|
${e === "sm" && E`
|
|
@@ -1115,7 +1121,7 @@ var se = {
|
|
|
1115
1121
|
"data-tooltip-delay-hide": i,
|
|
1116
1122
|
"data-tooltip-place": o,
|
|
1117
1123
|
children: n
|
|
1118
|
-
}), !s && /* @__PURE__ */ P(
|
|
1124
|
+
}), !s && /* @__PURE__ */ P(ae, {
|
|
1119
1125
|
ref: u,
|
|
1120
1126
|
css: _t(c),
|
|
1121
1127
|
id: e,
|
|
@@ -1381,7 +1387,7 @@ var se = {
|
|
|
1381
1387
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1382
1388
|
}
|
|
1383
1389
|
`, Tt = 4, Et = () => {
|
|
1384
|
-
let e =
|
|
1390
|
+
let e = Y(), t = Y((e) => e.currentTime), n = Y((e) => e.requestSeek), r = Y((e) => e.duration), i = Y((e) => e.size), a = Y((e) => e.downloadedRanges), o = Y((e) => e.buffered), s = Y((e) => e.indexes), c = Y((e) => e.thumbnails), l = Y((e) => e.thumbnailAt), u = Y((e) => e.requestThumbnail), d = Y((e) => e.chapters), m = Y((e) => e.seekingTo), h = Y((e) => e.setSourceState), g = Y((e) => e.hideUI), _ = C(null), [v, y] = w(void 0), [b, T] = w(void 0), E = (e) => {
|
|
1385
1391
|
T(e), u(e);
|
|
1386
1392
|
}, D = !!b;
|
|
1387
1393
|
x(() => {
|
|
@@ -1419,7 +1425,7 @@ var se = {
|
|
|
1419
1425
|
z.current !== "touch" && E(R(e.clientX));
|
|
1420
1426
|
}, te = () => {
|
|
1421
1427
|
_.current && E(void 0);
|
|
1422
|
-
}, H = (e) => r ? e / r * 100 : 0,
|
|
1428
|
+
}, H = (e) => r ? e / r * 100 : 0, U = (e, t, n) => {
|
|
1423
1429
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1424
1430
|
return /* @__PURE__ */ P("div", {
|
|
1425
1431
|
className: "loaded-part",
|
|
@@ -1428,10 +1434,10 @@ var se = {
|
|
|
1428
1434
|
marginLeft: `${i}%`
|
|
1429
1435
|
}
|
|
1430
1436
|
}, e);
|
|
1431
|
-
},
|
|
1437
|
+
}, W = S(() => i === void 0 ? r ? o.map(([e, t], n) => U(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1432
1438
|
if (!i || !r) return null;
|
|
1433
1439
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1434
|
-
return !a || !o ? null :
|
|
1440
|
+
return !a || !o ? null : U(t, a.timestamp / r, o.timestamp / r);
|
|
1435
1441
|
}) ?? [], [
|
|
1436
1442
|
r,
|
|
1437
1443
|
i,
|
|
@@ -1447,7 +1453,7 @@ var se = {
|
|
|
1447
1453
|
v,
|
|
1448
1454
|
r
|
|
1449
1455
|
]);
|
|
1450
|
-
let
|
|
1456
|
+
let G = S(() => {
|
|
1451
1457
|
if (!r) return 0;
|
|
1452
1458
|
if (M && v !== void 0) return v;
|
|
1453
1459
|
let e = m ?? t;
|
|
@@ -1458,22 +1464,22 @@ var se = {
|
|
|
1458
1464
|
M,
|
|
1459
1465
|
v,
|
|
1460
1466
|
m
|
|
1461
|
-
]),
|
|
1462
|
-
if (!
|
|
1463
|
-
let e = b / r * 100, t =
|
|
1464
|
-
return t >= 0 ? t :
|
|
1467
|
+
]), K = S(() => f(d, r), [d, r]), q = K.length > 0, J = S(() => {
|
|
1468
|
+
if (!q || b === void 0 || !r) return -1;
|
|
1469
|
+
let e = b / r * 100, t = K.findIndex((t, n) => n < K.length - 1 && e >= t && e < K[n + 1]);
|
|
1470
|
+
return t >= 0 ? t : K.length - 2;
|
|
1465
1471
|
}, [
|
|
1472
|
+
q,
|
|
1466
1473
|
K,
|
|
1467
|
-
G,
|
|
1468
1474
|
b,
|
|
1469
1475
|
r
|
|
1470
|
-
]),
|
|
1476
|
+
]), ne = S(() => q ? p(K, (e) => e !== J) : void 0, [
|
|
1477
|
+
q,
|
|
1471
1478
|
K,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
]), ie = S(() => q >= 0 ? p(G, (e) => e === q) : void 0, [G, q]), ae = S(() => {
|
|
1479
|
+
J
|
|
1480
|
+
]), re = S(() => J >= 0 ? p(K, (e) => e === J) : void 0, [K, J]), ie = S(() => {
|
|
1475
1481
|
if (b !== void 0) return d.find(({ start: e, end: t }) => e <= b && b < t);
|
|
1476
|
-
}, [d, b]),
|
|
1482
|
+
}, [d, b]), ae = S(() => {
|
|
1477
1483
|
if (b) {
|
|
1478
1484
|
if (l) return l(b);
|
|
1479
1485
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
|
|
@@ -1482,20 +1488,20 @@ var se = {
|
|
|
1482
1488
|
c,
|
|
1483
1489
|
l,
|
|
1484
1490
|
b
|
|
1485
|
-
]),
|
|
1491
|
+
]), oe = (e, t) => /* @__PURE__ */ F("div", {
|
|
1486
1492
|
className: e ? `track ${e}` : "track",
|
|
1487
1493
|
style: t ? { maskImage: t } : void 0,
|
|
1488
1494
|
children: [
|
|
1489
1495
|
/* @__PURE__ */ P("div", { className: "background-bar" }),
|
|
1490
1496
|
/* @__PURE__ */ P("div", {
|
|
1491
1497
|
className: "loaded",
|
|
1492
|
-
children:
|
|
1498
|
+
children: W
|
|
1493
1499
|
}),
|
|
1494
1500
|
/* @__PURE__ */ P("div", {
|
|
1495
1501
|
className: "play-container",
|
|
1496
1502
|
children: /* @__PURE__ */ P("div", {
|
|
1497
1503
|
className: "play",
|
|
1498
|
-
style: { transform: `scaleX(${
|
|
1504
|
+
style: { transform: `scaleX(${G})` }
|
|
1499
1505
|
})
|
|
1500
1506
|
})
|
|
1501
1507
|
]
|
|
@@ -1506,31 +1512,31 @@ var se = {
|
|
|
1506
1512
|
className: [
|
|
1507
1513
|
"progress-bar",
|
|
1508
1514
|
M ? "dragging" : "",
|
|
1509
|
-
|
|
1515
|
+
q ? "segmented" : ""
|
|
1510
1516
|
].filter(Boolean).join(" "),
|
|
1511
1517
|
onPointerDown: B,
|
|
1512
1518
|
onPointerMove: B,
|
|
1513
1519
|
onMouseMove: V,
|
|
1514
1520
|
onMouseOut: te,
|
|
1515
1521
|
children: [
|
|
1516
|
-
|
|
1522
|
+
oe(void 0, ne),
|
|
1517
1523
|
b ? /* @__PURE__ */ F("div", {
|
|
1518
1524
|
className: "cursor-time",
|
|
1519
1525
|
style: {
|
|
1520
|
-
left:
|
|
1521
|
-
maxWidth:
|
|
1526
|
+
left: ie ? `clamp(var(--thumbnail-half), ${H(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${H(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1527
|
+
maxWidth: ie ? "var(--thumbnail-width)" : void 0
|
|
1522
1528
|
},
|
|
1523
1529
|
children: [/* @__PURE__ */ P("span", {
|
|
1524
1530
|
className: "cursor-time-value",
|
|
1525
1531
|
children: ht(b)
|
|
1526
|
-
}),
|
|
1532
|
+
}), ie ? /* @__PURE__ */ P("span", {
|
|
1527
1533
|
className: "chapter-title",
|
|
1528
|
-
children:
|
|
1534
|
+
children: ie.title
|
|
1529
1535
|
}) : void 0]
|
|
1530
1536
|
}) : void 0,
|
|
1531
1537
|
/* @__PURE__ */ P("div", { className: "progress" }),
|
|
1532
1538
|
/* @__PURE__ */ P("div", { className: "hover" }),
|
|
1533
|
-
|
|
1539
|
+
re ? oe("focus", re) : void 0,
|
|
1534
1540
|
/* @__PURE__ */ P("div", { className: "scrubber" }),
|
|
1535
1541
|
/* @__PURE__ */ P("div", {
|
|
1536
1542
|
className: "padding",
|
|
@@ -1542,7 +1548,7 @@ var se = {
|
|
|
1542
1548
|
/* @__PURE__ */ P("div", {
|
|
1543
1549
|
className: "thumbnail",
|
|
1544
1550
|
style: { left: `clamp(var(--thumbnail-half), ${H(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1545
|
-
children:
|
|
1551
|
+
children: ae?.url ? /* @__PURE__ */ P("img", { src: ae.url }) : void 0
|
|
1546
1552
|
})
|
|
1547
1553
|
]
|
|
1548
1554
|
});
|
|
@@ -1735,6 +1741,7 @@ var se = {
|
|
|
1735
1741
|
}),
|
|
1736
1742
|
c ? /* @__PURE__ */ P("div", {
|
|
1737
1743
|
className: "no-hover failed",
|
|
1744
|
+
dir: "auto",
|
|
1738
1745
|
children: l(a.switchFailed)
|
|
1739
1746
|
}) : null,
|
|
1740
1747
|
o ? d(null, o) : null,
|
|
@@ -1878,7 +1885,7 @@ ${jt}
|
|
|
1878
1885
|
e.detail
|
|
1879
1886
|
].filter(Boolean).join("\n");
|
|
1880
1887
|
}).join("\n\n"), zt = () => {
|
|
1881
|
-
let e =
|
|
1888
|
+
let e = Y((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } = Nt(), [s, c] = w(!1);
|
|
1882
1889
|
if (e.length === 0) return null;
|
|
1883
1890
|
let l = () => {
|
|
1884
1891
|
navigator.clipboard?.writeText(Rt(e)).then(() => {
|
|
@@ -1897,7 +1904,7 @@ ${jt}
|
|
|
1897
1904
|
onClick: i,
|
|
1898
1905
|
"aria-label": u,
|
|
1899
1906
|
"aria-expanded": r,
|
|
1900
|
-
children: /* @__PURE__ */ P(
|
|
1907
|
+
children: /* @__PURE__ */ P(J, { className: "alert-triangle" })
|
|
1901
1908
|
}),
|
|
1902
1909
|
toolTipText: /* @__PURE__ */ P("span", { children: u })
|
|
1903
1910
|
}), r && /* @__PURE__ */ F("div", {
|
|
@@ -1995,7 +2002,7 @@ width: 100%;
|
|
|
1995
2002
|
}
|
|
1996
2003
|
}
|
|
1997
2004
|
`, Vt = () => {
|
|
1998
|
-
let e =
|
|
2005
|
+
let e = Y(), { format: t, number: n } = Q(), r = Y((e) => e.playbackRate), i = C(null), o = C(null), s = .25, c = 2.75, l = (e, t = .05) => Math.round(e / t) * t, u = l(r || 1), d = (e) => (e - s) / c * 100, f = (e) => l(s + e * c), { handlers: p } = Ct({
|
|
1999
2006
|
ref: o,
|
|
2000
2007
|
onChange: (t) => e.setPlaybackRate(f(t))
|
|
2001
2008
|
}), m = (t) => {
|
|
@@ -2132,7 +2139,7 @@ ${jt}
|
|
|
2132
2139
|
1.5,
|
|
2133
2140
|
2
|
|
2134
2141
|
], Wt = () => {
|
|
2135
|
-
let e =
|
|
2142
|
+
let e = Y(), { format: t, number: n } = Q(), r = Y((e) => e.playbackRate), i = Y((e) => e.audioTracks), o = Y((e) => e.selectedAudioTrack), s = Y((e) => e.selectAudioTrack), c = Y((e) => e.quality), l = Y((e) => e.volumeNormalizer), [u, d] = w(0), { open: f, toggle: p, containerRef: m, pending: h, failed: g, runSelect: _ } = Nt({ onReset: () => d(0) }), v = (t) => {
|
|
2136
2143
|
e.setPlaybackRate(t), d(0);
|
|
2137
2144
|
}, y = (e) => {
|
|
2138
2145
|
e !== void 0 && _(e, () => s(e));
|
|
@@ -2154,7 +2161,7 @@ ${jt}
|
|
|
2154
2161
|
onClick: p,
|
|
2155
2162
|
"aria-label": t(a.settings),
|
|
2156
2163
|
"aria-expanded": f,
|
|
2157
|
-
children: /* @__PURE__ */ P(
|
|
2164
|
+
children: /* @__PURE__ */ P(q, {})
|
|
2158
2165
|
}),
|
|
2159
2166
|
toolTipText: /* @__PURE__ */ P("span", { children: t(a.settings) })
|
|
2160
2167
|
}),
|
|
@@ -2257,7 +2264,7 @@ position: static;
|
|
|
2257
2264
|
|
|
2258
2265
|
${jt}
|
|
2259
2266
|
`, Kt = () => {
|
|
2260
|
-
let { format: e } = Q(), t =
|
|
2267
|
+
let { format: e } = Q(), t = Y((e) => e.subtitleTracks), n = Y((e) => e.selectedSubtitleTrack), r = Y((e) => e.selectSubtitleTrack), i = Y((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } = Nt();
|
|
2261
2268
|
if (t.length === 0) return null;
|
|
2262
2269
|
let f = n !== void 0;
|
|
2263
2270
|
return /* @__PURE__ */ F("div", {
|
|
@@ -2336,7 +2343,7 @@ ${jt}
|
|
|
2336
2343
|
height: 10px;
|
|
2337
2344
|
}
|
|
2338
2345
|
`, Yt = ({ value: e, onChange: t }) => {
|
|
2339
|
-
let { number: n } = Q(), r =
|
|
2346
|
+
let { number: n } = Q(), r = Y((e) => e.volume), i = Y((e) => e.muted), a = C(null), o = C(null), { handlers: s } = Ct({
|
|
2340
2347
|
ref: o,
|
|
2341
2348
|
onChange: t
|
|
2342
2349
|
}), c = (n) => {
|
|
@@ -2438,7 +2445,7 @@ ${jt}
|
|
|
2438
2445
|
}
|
|
2439
2446
|
|
|
2440
2447
|
`, Zt = ({ ref: e }) => {
|
|
2441
|
-
let t =
|
|
2448
|
+
let t = Y(), { format: n } = Q(), r = Y((e) => e.volume), i = Y((e) => e.muted), o = S(() => mt(r), [r]);
|
|
2442
2449
|
return /* @__PURE__ */ F("div", {
|
|
2443
2450
|
css: Xt,
|
|
2444
2451
|
children: [/* @__PURE__ */ P(St, {
|
|
@@ -2450,7 +2457,7 @@ ${jt}
|
|
|
2450
2457
|
ref: e,
|
|
2451
2458
|
"aria-label": n(a.mute),
|
|
2452
2459
|
"aria-pressed": i || r === 0,
|
|
2453
|
-
children: P(i || r === 0 ?
|
|
2460
|
+
children: P(i || r === 0 ? ie : r <= .5 ? ne : re, {
|
|
2454
2461
|
size: 18,
|
|
2455
2462
|
color: "#fff"
|
|
2456
2463
|
})
|
|
@@ -2600,9 +2607,9 @@ ${jt}
|
|
|
2600
2607
|
}
|
|
2601
2608
|
}
|
|
2602
2609
|
`, rn = ({ shortcuts: e = "window", root: t, fullscreen: n }) => {
|
|
2603
|
-
let r =
|
|
2610
|
+
let r = Y(), { format: i } = Q(), o = Y((e) => e.paused), s = Y((e) => e.currentTime), c = Y((e) => e.duration), l = Y((e) => e.seekingTo), u = Y((e) => e.fullscreen), d = n ? n.active : u, f = C(n);
|
|
2604
2611
|
f.current = n;
|
|
2605
|
-
let p =
|
|
2612
|
+
let p = Y((e) => e.hideUI), m = Y((e) => e.togglePictureInPicture), h = Y((e) => e.pictureInPictureMode), g = Y((e) => e.burnedInSubtitles), _ = Y((e) => e.passThroughPictureInPicture), v = Y((e) => e.subtitleTracks), b = Y((e) => e.requestSeek), S = Y((e) => e.stepFrame), [T, E] = w(null), D = C(null), O = C(void 0), k = h === "burn-in", ee = v.length > 0, A = c > 0 && s === c, j = y(({ direction: e, stepSize: t }) => {
|
|
2606
2613
|
let n = mt(r.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + i)), o = r.muted;
|
|
2607
2614
|
r.setVolume(pt(a)), o && !r.muted && r.toggleMuted();
|
|
2608
2615
|
}, [r]), M = C(!1), N = y(() => {
|
|
@@ -2703,7 +2710,7 @@ ${jt}
|
|
|
2703
2710
|
type: "button",
|
|
2704
2711
|
onClick: () => r.togglePaused(),
|
|
2705
2712
|
"aria-label": i(A ? a.replay : o ? a.play : a.pause),
|
|
2706
|
-
children: P(A ?
|
|
2713
|
+
children: P(A ? K : o ? G : W, {})
|
|
2707
2714
|
}),
|
|
2708
2715
|
toolTipText: /* @__PURE__ */ P("span", { children: i(A ? a.replayKey : o ? a.playKey : a.pauseKey) })
|
|
2709
2716
|
}),
|
|
@@ -2763,7 +2770,7 @@ ${jt}
|
|
|
2763
2770
|
onClick: N,
|
|
2764
2771
|
"aria-label": i(a.fullScreen),
|
|
2765
2772
|
"aria-pressed": d,
|
|
2766
|
-
children: P(d ?
|
|
2773
|
+
children: P(d ? U : H, {})
|
|
2767
2774
|
}),
|
|
2768
2775
|
toolTipText: /* @__PURE__ */ P("span", { children: i(d ? a.exitFullScreenKey : a.fullScreenKey) })
|
|
2769
2776
|
})
|
|
@@ -2815,7 +2822,7 @@ ${jt}
|
|
|
2815
2822
|
color: #fff;
|
|
2816
2823
|
}
|
|
2817
2824
|
`, sn = () => {
|
|
2818
|
-
let { format: e } = Q(), t =
|
|
2825
|
+
let { format: e } = Q(), t = Y((e) => e.burnedInSubtitles), n = Y((e) => e.pictureInPictureMode), [r, i] = w(!1);
|
|
2819
2826
|
return x(() => {
|
|
2820
2827
|
if (n !== "burn-in" || !t) {
|
|
2821
2828
|
i(!1);
|
|
@@ -2894,44 +2901,47 @@ ${jt}
|
|
|
2894
2901
|
bottom: calc(9 * var(--mp-unit));
|
|
2895
2902
|
}
|
|
2896
2903
|
}
|
|
2897
|
-
`, pn = () => {
|
|
2898
|
-
let
|
|
2899
|
-
|
|
2900
|
-
|
|
2904
|
+
`, pn = ({ endingOffered: e }) => {
|
|
2905
|
+
let t = Y((e) => e.chapters), n = Y((e) => e.currentTime), r = Y((e) => e.requestSeek), i = Y((e) => e.seekPreview), a = Y(), { format: o } = Q(), s = S(() => {
|
|
2906
|
+
let n = m(t), r = e ? -1 : n.lastIndexOf("ending");
|
|
2907
|
+
return n.map((e, t) => t === r ? void 0 : e);
|
|
2908
|
+
}, [t, e]), c = S(() => {
|
|
2909
|
+
if (typeof n != "number") return;
|
|
2910
|
+
let e = t.findIndex((e, t) => s[t] !== void 0 && e.start - cn <= n && n < e.end), r = e >= 0 ? s[e] : void 0;
|
|
2901
2911
|
return r ? {
|
|
2902
2912
|
kind: r,
|
|
2903
|
-
end: e
|
|
2913
|
+
end: t[e].end
|
|
2904
2914
|
} : void 0;
|
|
2905
2915
|
}, [
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
]),
|
|
2916
|
+
t,
|
|
2917
|
+
s,
|
|
2918
|
+
n
|
|
2919
|
+
]), l = C(0), [u, d] = w(0);
|
|
2910
2920
|
x(() => {
|
|
2911
|
-
let e = typeof
|
|
2912
|
-
|
|
2913
|
-
}, [
|
|
2914
|
-
let [
|
|
2921
|
+
let e = typeof n == "number" ? n : 0, t = l.current;
|
|
2922
|
+
l.current = e, e < t - un && d((e) => e + 1);
|
|
2923
|
+
}, [n]);
|
|
2924
|
+
let [f, p] = w(!1), h = c ? `${c.kind}@${c.end}` : "";
|
|
2915
2925
|
return x(() => {
|
|
2916
|
-
if (!
|
|
2917
|
-
|
|
2926
|
+
if (!h) {
|
|
2927
|
+
p(!1);
|
|
2918
2928
|
return;
|
|
2919
2929
|
}
|
|
2920
|
-
|
|
2921
|
-
let e = setTimeout(() =>
|
|
2930
|
+
p(!0);
|
|
2931
|
+
let e = setTimeout(() => p(!1), ln);
|
|
2922
2932
|
return () => clearTimeout(e);
|
|
2923
|
-
}, [
|
|
2924
|
-
|
|
2925
|
-
}, [
|
|
2933
|
+
}, [h, u]), x(() => {
|
|
2934
|
+
c || p(!1);
|
|
2935
|
+
}, [c]), c ? /* @__PURE__ */ P("div", {
|
|
2926
2936
|
css: fn,
|
|
2927
|
-
className:
|
|
2937
|
+
className: f && !i ? "show" : "",
|
|
2928
2938
|
children: /* @__PURE__ */ P("button", {
|
|
2929
2939
|
type: "button",
|
|
2930
2940
|
className: "skip-chapter",
|
|
2931
2941
|
onClick: () => {
|
|
2932
|
-
|
|
2942
|
+
p(!1), r ? r(c.end) : a.seek(c.end);
|
|
2933
2943
|
},
|
|
2934
|
-
children:
|
|
2944
|
+
children: o(dn[c.kind])
|
|
2935
2945
|
})
|
|
2936
2946
|
}) : null;
|
|
2937
2947
|
}, mn = 3e3, hn = E`
|
|
@@ -3011,68 +3021,68 @@ ${jt}
|
|
|
3011
3021
|
key: r,
|
|
3012
3022
|
item: e
|
|
3013
3023
|
}];
|
|
3014
|
-
}), yn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o,
|
|
3015
|
-
let
|
|
3024
|
+
}), yn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, children: c }) => {
|
|
3025
|
+
let l = Y(), u = Y((e) => e.hideUI), d = Y((e) => e.setHideUI), f = Y((e) => e.hasMedia), p = Y((e) => e.passThroughPictureInPicture), m = C(void 0), h = C("mouse"), g = C({
|
|
3016
3026
|
x: -1,
|
|
3017
3027
|
y: -1
|
|
3018
|
-
}),
|
|
3019
|
-
x(() => () => clearTimeout(
|
|
3020
|
-
let e =
|
|
3028
|
+
}), _ = C(!1), v = C(null);
|
|
3029
|
+
x(() => () => clearTimeout(m.current), []), x(() => {
|
|
3030
|
+
let e = v.current;
|
|
3021
3031
|
if (!e) return;
|
|
3022
3032
|
let t = new ResizeObserver(([t]) => e.style.setProperty("--mp-height", `${t.contentRect.height}px`));
|
|
3023
3033
|
return t.observe(e), () => t.disconnect();
|
|
3024
3034
|
}, []), x(() => {
|
|
3025
|
-
|
|
3026
|
-
}, [
|
|
3027
|
-
let
|
|
3028
|
-
|
|
3029
|
-
},
|
|
3030
|
-
|
|
3031
|
-
}, b = () => {
|
|
3032
|
-
if (c.passThroughPictureInPicture?.armed) return !0;
|
|
3033
|
-
if (m.current !== "mouse") return !1;
|
|
3034
|
-
let { x: e, y: t } = h.current;
|
|
3035
|
-
if (!_.current || e < 0) return !1;
|
|
3036
|
-
let n = document.elementFromPoint(e, t);
|
|
3037
|
-
return !n || !_.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || g.current || !!_.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3035
|
+
f || (clearTimeout(m.current), d(!1));
|
|
3036
|
+
}, [f, d]);
|
|
3037
|
+
let y = () => {
|
|
3038
|
+
f && d(!0);
|
|
3039
|
+
}, b = (t) => {
|
|
3040
|
+
v.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
3038
3041
|
}, S = () => {
|
|
3039
|
-
if (
|
|
3040
|
-
|
|
3042
|
+
if (l.passThroughPictureInPicture?.armed) return !0;
|
|
3043
|
+
if (h.current !== "mouse") return !1;
|
|
3044
|
+
let { x: e, y: t } = g.current;
|
|
3045
|
+
if (!v.current || e < 0) return !1;
|
|
3046
|
+
let n = document.elementFromPoint(e, t);
|
|
3047
|
+
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3048
|
+
}, w = () => {
|
|
3049
|
+
if (S()) {
|
|
3050
|
+
m.current = setTimeout(w, mn);
|
|
3041
3051
|
return;
|
|
3042
3052
|
}
|
|
3043
|
-
|
|
3044
|
-
},
|
|
3045
|
-
|
|
3046
|
-
},
|
|
3047
|
-
|
|
3053
|
+
y();
|
|
3054
|
+
}, T = () => {
|
|
3055
|
+
d(!1), clearTimeout(m.current), m.current = setTimeout(w, mn);
|
|
3056
|
+
}, E = (e) => {
|
|
3057
|
+
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
3048
3058
|
x: e.clientX,
|
|
3049
3059
|
y: e.clientY
|
|
3050
|
-
},
|
|
3051
|
-
},
|
|
3052
|
-
|
|
3053
|
-
},
|
|
3054
|
-
|
|
3055
|
-
},
|
|
3060
|
+
}, T());
|
|
3061
|
+
}, D = (e) => {
|
|
3062
|
+
h.current = e.pointerType, _.current = !0;
|
|
3063
|
+
}, O = () => {
|
|
3064
|
+
_.current = !1;
|
|
3065
|
+
}, k = C(!0);
|
|
3056
3066
|
return /* @__PURE__ */ F("div", {
|
|
3057
3067
|
css: _n,
|
|
3058
|
-
ref:
|
|
3059
|
-
onPointerMove:
|
|
3060
|
-
onPointerDown:
|
|
3061
|
-
onPointerUp:
|
|
3062
|
-
onPointerCancel:
|
|
3068
|
+
ref: b,
|
|
3069
|
+
onPointerMove: E,
|
|
3070
|
+
onPointerDown: D,
|
|
3071
|
+
onPointerUp: O,
|
|
3072
|
+
onPointerCancel: O,
|
|
3063
3073
|
onMouseOut: (e) => {
|
|
3064
3074
|
let t = e.relatedTarget;
|
|
3065
3075
|
if (t && e.currentTarget.contains(t)) return;
|
|
3066
3076
|
let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
|
|
3067
|
-
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(
|
|
3077
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(m.current), y());
|
|
3068
3078
|
},
|
|
3069
|
-
className:
|
|
3079
|
+
className: u ? "hide" : "",
|
|
3070
3080
|
tabIndex: a === "player" ? -1 : void 0,
|
|
3071
3081
|
children: [
|
|
3072
3082
|
/* @__PURE__ */ P(ut, { onSubtitleRef: n }),
|
|
3073
3083
|
vn(r).map(({ key: e, item: t }) => /* @__PURE__ */ P("div", {
|
|
3074
3084
|
css: hn,
|
|
3075
|
-
style: { ...
|
|
3085
|
+
style: { ...u ? {
|
|
3076
3086
|
opacity: "0",
|
|
3077
3087
|
visibility: "hidden",
|
|
3078
3088
|
pointerEvents: "none"
|
|
@@ -3083,53 +3093,55 @@ ${jt}
|
|
|
3083
3093
|
value: !!o,
|
|
3084
3094
|
children: /* @__PURE__ */ P(rn, {
|
|
3085
3095
|
shortcuts: a,
|
|
3086
|
-
root:
|
|
3096
|
+
root: v,
|
|
3087
3097
|
fullscreen: o
|
|
3088
3098
|
})
|
|
3089
3099
|
}),
|
|
3090
3100
|
/* @__PURE__ */ P(sn, {}),
|
|
3091
|
-
/* @__PURE__ */ P(pn, {}),
|
|
3092
|
-
|
|
3101
|
+
/* @__PURE__ */ P(pn, { endingOffered: s }),
|
|
3102
|
+
p?.armed && v.current ? /* @__PURE__ */ P("div", {
|
|
3093
3103
|
className: "pass-through",
|
|
3094
|
-
style: { clipPath: gn(
|
|
3095
|
-
onPointerOver:
|
|
3104
|
+
style: { clipPath: gn(p.armed, v.current.getBoundingClientRect()) },
|
|
3105
|
+
onPointerOver: p.disarm
|
|
3096
3106
|
}) : null,
|
|
3097
3107
|
/* @__PURE__ */ F("div", {
|
|
3098
3108
|
className: "video",
|
|
3099
3109
|
onClick: (e) => {
|
|
3100
|
-
if (
|
|
3110
|
+
if (h.current === "mouse") {
|
|
3101
3111
|
if (e.detail > 1) return;
|
|
3102
|
-
|
|
3112
|
+
k.current = l.paused, l.togglePaused();
|
|
3103
3113
|
return;
|
|
3104
3114
|
}
|
|
3105
|
-
|
|
3115
|
+
u ? T() : (clearTimeout(m.current), y());
|
|
3106
3116
|
},
|
|
3107
3117
|
onDoubleClick: () => {
|
|
3108
|
-
|
|
3118
|
+
h.current === "mouse" && (k.current ? l.pause() : l.play().catch(() => {}), o ? o.request() : l.toggleFullscreen());
|
|
3109
3119
|
},
|
|
3110
3120
|
children: [t ? /* @__PURE__ */ P("video", {
|
|
3111
3121
|
ref: t,
|
|
3112
3122
|
playsInline: !0
|
|
3113
|
-
}) : null,
|
|
3123
|
+
}) : null, c]
|
|
3114
3124
|
})
|
|
3115
3125
|
]
|
|
3116
3126
|
});
|
|
3117
3127
|
}, bn = (e, t) => ({ title: e.options.find((e) => e.id === t)?.label }), xn = (e, t) => e instanceof Promise ? e.then(t) : t(), Sn = ({ options: e, children: t }) => {
|
|
3118
3128
|
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: d, thumbnailRead: f, thumbnailsEnabled: p, readsDownload: m } = r ?? {}, h = ee(), g = k(), [_, v] = w(null), [y, b] = w(null), T = n?.media ?? _;
|
|
3119
3129
|
x(() => (h?.(T), () => h?.(null)), [T, h]), Pe(T, n?.stepFrame);
|
|
3120
|
-
let { expose: E } = e, [D, O] = w(null), [A] = w(() => Object.assign(new EventTarget(), {
|
|
3130
|
+
let { expose: E } = e, [D, O] = w(null), [A, j] = w(!0), [M] = w(() => Object.assign(new EventTarget(), {
|
|
3121
3131
|
chapters: [],
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3132
|
+
endingOffered: !0,
|
|
3133
|
+
onHostFullscreen: O,
|
|
3134
|
+
onEndingOffered: j
|
|
3135
|
+
})), N = E === !0 ? {} : E || void 0, F = C(N);
|
|
3136
|
+
F.current = N;
|
|
3137
|
+
let I = N ? N.id : void 0, L = N ? N.origin : void 0, R = N ? N.channel : void 0;
|
|
3126
3138
|
x(() => {
|
|
3127
3139
|
if (!E || !T) return;
|
|
3128
3140
|
let e, t = !1;
|
|
3129
3141
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
3130
3142
|
t || (e = n(T, {
|
|
3131
|
-
...
|
|
3132
|
-
player:
|
|
3143
|
+
...F.current,
|
|
3144
|
+
player: M
|
|
3133
3145
|
}));
|
|
3134
3146
|
}).catch(() => {}), () => {
|
|
3135
3147
|
t = !0, e?.();
|
|
@@ -3137,149 +3149,150 @@ ${jt}
|
|
|
3137
3149
|
}, [
|
|
3138
3150
|
T,
|
|
3139
3151
|
!!E,
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3152
|
+
I,
|
|
3153
|
+
L,
|
|
3154
|
+
R
|
|
3143
3155
|
]);
|
|
3144
|
-
let
|
|
3156
|
+
let z = Y((e) => e.chapters), B = JSON.stringify(z);
|
|
3145
3157
|
x(() => {
|
|
3146
|
-
|
|
3147
|
-
}, [
|
|
3148
|
-
let
|
|
3158
|
+
M.chapters = z, M.endingOffered = A, M.dispatchEvent(new Event("chapterschange"));
|
|
3159
|
+
}, [B, A]);
|
|
3160
|
+
let V = e.fullscreen ?? (D === null ? void 0 : {
|
|
3149
3161
|
active: D,
|
|
3150
|
-
request: () =>
|
|
3151
|
-
}),
|
|
3152
|
-
Ae(_, y, r, m ?
|
|
3153
|
-
let
|
|
3162
|
+
request: () => M.dispatchEvent(new Event("fullscreenrequest"))
|
|
3163
|
+
}), te = S(() => tt(), [o]);
|
|
3164
|
+
Ae(_, y, r, m ? te.push : void 0);
|
|
3165
|
+
let H = r?.normalizeVolume ?? !0, [U, W] = w(H);
|
|
3154
3166
|
x(() => {
|
|
3155
|
-
H
|
|
3156
|
-
}, [
|
|
3157
|
-
let
|
|
3158
|
-
|
|
3159
|
-
let
|
|
3160
|
-
|
|
3161
|
-
let
|
|
3162
|
-
tap:
|
|
3163
|
-
audioStreamIndex:
|
|
3167
|
+
W(H);
|
|
3168
|
+
}, [H]);
|
|
3169
|
+
let G = C(r?.onNormalizeVolumeChange);
|
|
3170
|
+
G.current = r?.onNormalizeVolumeChange;
|
|
3171
|
+
let K = r?.normalizerWorkletUrl, q = C(f ?? d);
|
|
3172
|
+
q.current = f ?? d;
|
|
3173
|
+
let J = Y((e) => e.selectedAudioTrack), ne = !!d, { refused: re } = et(_, K, U, S(() => ne && o && c && l && typeof J == "number" && J >= 0 ? m ? {
|
|
3174
|
+
tap: te,
|
|
3175
|
+
audioStreamIndex: J
|
|
3164
3176
|
} : {
|
|
3165
|
-
read: (e, t) =>
|
|
3177
|
+
read: (e, t) => q.current(e, t),
|
|
3166
3178
|
length: o,
|
|
3167
3179
|
publicPath: c,
|
|
3168
3180
|
libavWorkerUrl: l,
|
|
3169
|
-
audioStreamIndex:
|
|
3181
|
+
audioStreamIndex: J
|
|
3170
3182
|
} : void 0, [
|
|
3171
|
-
|
|
3183
|
+
ne,
|
|
3172
3184
|
o,
|
|
3173
3185
|
c,
|
|
3174
3186
|
l,
|
|
3175
|
-
|
|
3187
|
+
J,
|
|
3176
3188
|
m,
|
|
3177
|
-
|
|
3178
|
-
]), S(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])),
|
|
3179
|
-
enabled:
|
|
3180
|
-
available: !
|
|
3189
|
+
te
|
|
3190
|
+
]), S(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ie = S(() => K && typeof AudioWorkletNode == "function" ? {
|
|
3191
|
+
enabled: U,
|
|
3192
|
+
available: !re,
|
|
3181
3193
|
setEnabled: (e) => {
|
|
3182
|
-
|
|
3194
|
+
W(e), G.current?.(e);
|
|
3183
3195
|
}
|
|
3184
3196
|
} : null, [
|
|
3197
|
+
K,
|
|
3185
3198
|
U,
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
]), { thumbnails: ie, requestThumbnail: ae } = Le({
|
|
3199
|
+
re
|
|
3200
|
+
]), { thumbnails: ae, requestThumbnail: oe } = Le({
|
|
3189
3201
|
publicPath: c,
|
|
3190
3202
|
workerUrl: l,
|
|
3191
3203
|
length: p === !1 ? void 0 : o,
|
|
3192
3204
|
read: f ?? d,
|
|
3193
3205
|
downloadedRanges: s
|
|
3194
|
-
}),
|
|
3206
|
+
}), se = n?.thumbnails?.all ?? ae, { toggle: ce, mode: le, burnedIn: ue } = Re(_, y), de = We(n?.media ?? null, n?.pictureInPicture), X = Y((e) => e.setSourceState), fe = n ? !!n.media : o !== void 0;
|
|
3195
3207
|
x(() => {
|
|
3196
|
-
|
|
3208
|
+
X({
|
|
3197
3209
|
title: i,
|
|
3198
3210
|
size: o,
|
|
3199
3211
|
downloadedRanges: s,
|
|
3200
|
-
hasMedia:
|
|
3212
|
+
hasMedia: fe
|
|
3201
3213
|
});
|
|
3202
3214
|
}, [
|
|
3203
|
-
|
|
3215
|
+
X,
|
|
3204
3216
|
i,
|
|
3205
3217
|
o,
|
|
3206
3218
|
s,
|
|
3207
|
-
|
|
3219
|
+
fe
|
|
3208
3220
|
]);
|
|
3209
|
-
let
|
|
3221
|
+
let pe = n?.thumbnails?.at;
|
|
3210
3222
|
x(() => {
|
|
3211
|
-
|
|
3212
|
-
thumbnails:
|
|
3213
|
-
thumbnailAt:
|
|
3214
|
-
requestThumbnail:
|
|
3215
|
-
togglePictureInPicture:
|
|
3216
|
-
pictureInPictureMode:
|
|
3217
|
-
burnedInSubtitles:
|
|
3223
|
+
X({
|
|
3224
|
+
thumbnails: se,
|
|
3225
|
+
thumbnailAt: pe,
|
|
3226
|
+
requestThumbnail: oe,
|
|
3227
|
+
togglePictureInPicture: ce,
|
|
3228
|
+
pictureInPictureMode: le,
|
|
3229
|
+
burnedInSubtitles: ue
|
|
3218
3230
|
});
|
|
3219
3231
|
}, [
|
|
3220
|
-
|
|
3221
|
-
oe,
|
|
3222
|
-
fe,
|
|
3223
|
-
ae,
|
|
3232
|
+
X,
|
|
3224
3233
|
se,
|
|
3234
|
+
pe,
|
|
3235
|
+
oe,
|
|
3225
3236
|
ce,
|
|
3226
|
-
le
|
|
3237
|
+
le,
|
|
3238
|
+
ue
|
|
3227
3239
|
]), x(() => {
|
|
3228
|
-
|
|
3229
|
-
}, [
|
|
3230
|
-
|
|
3231
|
-
}, [
|
|
3232
|
-
let
|
|
3240
|
+
X({ volumeNormalizer: ie });
|
|
3241
|
+
}, [X, ie]), x(() => {
|
|
3242
|
+
X({ passThroughPictureInPicture: de });
|
|
3243
|
+
}, [X, de]);
|
|
3244
|
+
let Z = n?.subtitles?.selection, me = n?.audioTracks?.selection, he = C({
|
|
3233
3245
|
audio: e.onPreferredAudioLanguageChange,
|
|
3234
3246
|
subtitles: e.onPreferredSubtitleLanguageChange
|
|
3235
3247
|
});
|
|
3236
|
-
|
|
3248
|
+
he.current = {
|
|
3237
3249
|
audio: e.onPreferredAudioLanguageChange,
|
|
3238
3250
|
subtitles: e.onPreferredSubtitleLanguageChange
|
|
3239
3251
|
}, x(() => {
|
|
3240
|
-
|
|
3241
|
-
subtitleTracks:
|
|
3252
|
+
Z && X({
|
|
3253
|
+
subtitleTracks: Z.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3242
3254
|
id: e,
|
|
3243
3255
|
label: t,
|
|
3244
3256
|
disabled: n
|
|
3245
3257
|
})),
|
|
3246
|
-
selectedSubtitleTrack:
|
|
3258
|
+
selectedSubtitleTrack: Z.selectedId ?? void 0,
|
|
3247
3259
|
selectSubtitleTrack: (e) => {
|
|
3248
|
-
let t = e == null ? null : String(e), n = t === null ? void 0 : bn(
|
|
3249
|
-
return xn(
|
|
3260
|
+
let t = e == null ? null : String(e), n = t === null ? void 0 : bn(Z, t), r = Z.selectedId === null;
|
|
3261
|
+
return xn(Z.select(t), () => {
|
|
3250
3262
|
let e = t === null ? null : u(n) ?? (r ? n?.title : void 0);
|
|
3251
|
-
e !== void 0 &&
|
|
3263
|
+
e !== void 0 && he.current.subtitles?.(e);
|
|
3252
3264
|
});
|
|
3253
3265
|
},
|
|
3254
|
-
subtitleOffLabel:
|
|
3266
|
+
subtitleOffLabel: Z.offLabel
|
|
3255
3267
|
});
|
|
3256
|
-
}, [
|
|
3257
|
-
|
|
3258
|
-
audioTracks:
|
|
3268
|
+
}, [X, Z]), x(() => {
|
|
3269
|
+
me && X({
|
|
3270
|
+
audioTracks: me.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3259
3271
|
id: e,
|
|
3260
3272
|
label: t,
|
|
3261
3273
|
disabled: n
|
|
3262
3274
|
})),
|
|
3263
|
-
selectedAudioTrack:
|
|
3264
|
-
selectAudioTrack: (e) => xn(
|
|
3265
|
-
let t = u(bn(
|
|
3266
|
-
t !== void 0 &&
|
|
3275
|
+
selectedAudioTrack: me.selectedId ?? void 0,
|
|
3276
|
+
selectAudioTrack: (e) => xn(me.select(String(e)), () => {
|
|
3277
|
+
let t = u(bn(me, String(e)));
|
|
3278
|
+
t !== void 0 && he.current.audio?.(t);
|
|
3267
3279
|
})
|
|
3268
3280
|
});
|
|
3269
|
-
}, [
|
|
3270
|
-
let
|
|
3281
|
+
}, [X, me]);
|
|
3282
|
+
let ge = n?.quality?.selection ?? null;
|
|
3271
3283
|
return x(() => {
|
|
3272
|
-
|
|
3273
|
-
}, [
|
|
3274
|
-
a &&
|
|
3275
|
-
}, [
|
|
3284
|
+
X({ quality: ge });
|
|
3285
|
+
}, [X, ge]), x(() => {
|
|
3286
|
+
a && X({ chapters: a });
|
|
3287
|
+
}, [X, a]), /* @__PURE__ */ P(yn, {
|
|
3276
3288
|
ref: g,
|
|
3277
3289
|
onVideoRef: n ? void 0 : v,
|
|
3278
3290
|
onSubtitleRef: b,
|
|
3279
3291
|
overlay: e.overlay,
|
|
3280
3292
|
controls: e.controls,
|
|
3281
3293
|
shortcuts: e.shortcuts,
|
|
3282
|
-
fullscreen:
|
|
3294
|
+
fullscreen: V,
|
|
3295
|
+
endingOffered: A,
|
|
3283
3296
|
children: t
|
|
3284
3297
|
});
|
|
3285
3298
|
}, Cn = E`
|
|
@@ -3354,7 +3367,7 @@ ${jt}
|
|
|
3354
3367
|
overflow: hidden;
|
|
3355
3368
|
`, wn = (e) => /* @__PURE__ */ P("div", {
|
|
3356
3369
|
css: Cn,
|
|
3357
|
-
children: /* @__PURE__ */ P(
|
|
3370
|
+
children: /* @__PURE__ */ P(ce.Provider, { children: /* @__PURE__ */ P(ve, {
|
|
3358
3371
|
language: e.language,
|
|
3359
3372
|
children: /* @__PURE__ */ P(Sn, {
|
|
3360
3373
|
options: e,
|
|
@@ -3403,4 +3416,4 @@ ${jt}
|
|
|
3403
3416
|
throw Error(`Unknown source type: ${e}`);
|
|
3404
3417
|
};
|
|
3405
3418
|
//#endregion
|
|
3406
|
-
export { wn as MediaPlayer, wn as default,
|
|
3419
|
+
export { wn as MediaPlayer, wn as default, ce as Player, t as SUBTITLES_OFF, c as createPictureInPicture, l as createSubtitleRenderer, o as createThumbnailGenerator, An as inputToRemuxerInput, En as isDelegatedTracks, Tn as isExternalThumbnails, se as sourceFeature, s as startPlayback, Re as usePictureInPicture, Y as usePlayer, Le as useSeekThumbnails };
|