@banou/media-player 0.10.32 → 0.10.33
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 +5 -0
- package/dist/index.js +257 -251
- 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/react/components/chrome.tsx +4 -2
- package/src/lib/react/components/skip-chapter.tsx +8 -2
- 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,19 +36,19 @@ 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
52
|
de: () => import("./de-DphEdq0O.js"),
|
|
53
53
|
"es-419": () => import("./es-419-D6gsvnn8.js"),
|
|
54
54
|
fr: () => import("./fr-BqAzAJX0.js"),
|
|
@@ -61,7 +61,7 @@ var se = {
|
|
|
61
61
|
tr: () => import("./tr-CW7R7N9k.js"),
|
|
62
62
|
"zh-Hans": () => import("./zh-Hans-IhL1Pl78.js"),
|
|
63
63
|
"zh-Hant": () => import("./zh-Hant-C5YyFjEc.js")
|
|
64
|
-
},
|
|
64
|
+
}, ue = Object.keys(le), de = (e) => {
|
|
65
65
|
try {
|
|
66
66
|
let t = new Intl.Locale(e), { language: n, script: r } = t.maximize();
|
|
67
67
|
return {
|
|
@@ -72,24 +72,24 @@ var se = {
|
|
|
72
72
|
} catch {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
},
|
|
75
|
+
}, X = (e) => {
|
|
76
76
|
let t = de(e);
|
|
77
77
|
if (!t) return;
|
|
78
|
-
let n =
|
|
78
|
+
let n = ue.map((e) => ({
|
|
79
79
|
...de(e),
|
|
80
80
|
catalogue: e
|
|
81
81
|
}));
|
|
82
82
|
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"),
|
|
83
|
+
}, fe = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map(), Z = (e, t) => {
|
|
84
|
+
let n = pe.get(e);
|
|
85
|
+
return n || (n = Promise.all([import("@formatjs/intl"), le[t]()]).then(([{ createIntl: t }, { default: n }]) => {
|
|
86
86
|
let r = t({
|
|
87
87
|
locale: e,
|
|
88
88
|
defaultLocale: "en",
|
|
89
89
|
messages: n
|
|
90
90
|
});
|
|
91
|
-
return
|
|
92
|
-
}), n.catch(() =>
|
|
91
|
+
return fe.set(e, r), r;
|
|
92
|
+
}), n.catch(() => pe.delete(e)), pe.set(e, n)), n;
|
|
93
93
|
}, me = (e) => {
|
|
94
94
|
try {
|
|
95
95
|
return Intl.getCanonicalLocales(e)[0];
|
|
@@ -107,17 +107,17 @@ var se = {
|
|
|
107
107
|
locale: r
|
|
108
108
|
};
|
|
109
109
|
}, ge = he(void 0, void 0), _e = _(ge), Q = () => b(_e), ve = ({ language: e, children: t }) => {
|
|
110
|
-
let n = e ?
|
|
110
|
+
let n = e ? X(e) : void 0, [, r] = w();
|
|
111
111
|
x(() => {
|
|
112
|
-
if (!e || !n ||
|
|
112
|
+
if (!e || !n || fe.has(e)) return;
|
|
113
113
|
let t = !1;
|
|
114
|
-
return
|
|
114
|
+
return Z(e, n).then((e) => {
|
|
115
115
|
t || r(e);
|
|
116
116
|
}, () => {}), () => {
|
|
117
117
|
t = !0;
|
|
118
118
|
};
|
|
119
119
|
}, [e, n]);
|
|
120
|
-
let i = e && n ?
|
|
120
|
+
let i = e && n ? fe.get(e) : void 0, a = S(() => e ? he(i, e) : ge, [i, e]);
|
|
121
121
|
return /* @__PURE__ */ P(_e.Provider, {
|
|
122
122
|
value: a,
|
|
123
123
|
children: t
|
|
@@ -167,7 +167,7 @@ var se = {
|
|
|
167
167
|
}
|
|
168
168
|
return t.length ? t.join("\n") : void 0;
|
|
169
169
|
}, Ae = (e, t, n, r) => {
|
|
170
|
-
let a =
|
|
170
|
+
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
171
|
E.current = S;
|
|
172
172
|
let [D, O] = w(), k = D && D.size === c ? D.streamIndex : void 0, [ee, A] = w(0), j = C({
|
|
173
173
|
count: 0,
|
|
@@ -196,21 +196,21 @@ var se = {
|
|
|
196
196
|
te.current = n?.onPreferredSubtitleLanguageChange;
|
|
197
197
|
let H = C(n?.onSeek);
|
|
198
198
|
H.current = n?.onSeek;
|
|
199
|
-
let
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
let
|
|
204
|
-
|
|
199
|
+
let U = C(n?.onPlaybackError);
|
|
200
|
+
U.current = n?.onPlaybackError;
|
|
201
|
+
let W = C(r);
|
|
202
|
+
W.current = r;
|
|
203
|
+
let G = Q(), K = C(G);
|
|
204
|
+
K.current = G, x(() => {
|
|
205
205
|
let { audio: e, subtitles: t } = L.current;
|
|
206
|
-
t.length && a.setSourceState({ subtitleTracks: Se(t,
|
|
207
|
-
}, [a,
|
|
208
|
-
let
|
|
206
|
+
t.length && a.setSourceState({ subtitleTracks: Se(t, G) }), e.length && a.setSourceState({ audioTracks: Se(e, G) });
|
|
207
|
+
}, [a, G]);
|
|
208
|
+
let q = y((e) => {
|
|
209
209
|
let t = typeof e == "number" ? e : void 0, n = a.selectedSubtitleTrack === void 0;
|
|
210
210
|
F.current = I.current, a.setSourceState({ selectedSubtitleTrack: t }), N.current?.selectSubtitleStream(t);
|
|
211
211
|
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
212
|
i !== void 0 && te.current?.(i);
|
|
213
|
-
}, [a]),
|
|
213
|
+
}, [a]), J = y((e) => {
|
|
214
214
|
let t = N.current;
|
|
215
215
|
if (!t || T <= 0) {
|
|
216
216
|
a.seek(e);
|
|
@@ -234,7 +234,7 @@ var se = {
|
|
|
234
234
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
235
235
|
clearTimeout(d), s();
|
|
236
236
|
});
|
|
237
|
-
}, [a, T]),
|
|
237
|
+
}, [a, T]), ne = y((e) => {
|
|
238
238
|
if (typeof e != "number" || I.current === void 0) return;
|
|
239
239
|
a.setSourceState({ selectedAudioTrack: e }), O({
|
|
240
240
|
size: I.current,
|
|
@@ -242,18 +242,18 @@ var se = {
|
|
|
242
242
|
});
|
|
243
243
|
let t = u(L.current.audio.find((t) => t.streamIndex === e));
|
|
244
244
|
t !== void 0 && V.current?.(t);
|
|
245
|
-
}, [a]),
|
|
245
|
+
}, [a]), re = Y((e) => e.setSourceState);
|
|
246
246
|
x(() => {
|
|
247
|
-
|
|
248
|
-
selectSubtitleTrack:
|
|
249
|
-
selectAudioTrack:
|
|
250
|
-
requestSeek:
|
|
247
|
+
re({
|
|
248
|
+
selectSubtitleTrack: q,
|
|
249
|
+
selectAudioTrack: ne,
|
|
250
|
+
requestSeek: J
|
|
251
251
|
});
|
|
252
252
|
}, [
|
|
253
|
-
ie,
|
|
254
|
-
K,
|
|
255
253
|
re,
|
|
256
|
-
q
|
|
254
|
+
q,
|
|
255
|
+
ne,
|
|
256
|
+
J
|
|
257
257
|
]), x(() => {
|
|
258
258
|
if (!e || !t || !c || !o) return;
|
|
259
259
|
let n = !1;
|
|
@@ -298,7 +298,7 @@ var se = {
|
|
|
298
298
|
}, 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
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
301
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), U.current?.(e);
|
|
302
302
|
};
|
|
303
303
|
return (async () => {
|
|
304
304
|
try {
|
|
@@ -331,16 +331,16 @@ var se = {
|
|
|
331
331
|
n || a.setSourceState({ playbackError: null });
|
|
332
332
|
},
|
|
333
333
|
onSeek: (e) => H.current?.(e),
|
|
334
|
-
onOutput: (e) =>
|
|
334
|
+
onOutput: (e) => W.current?.(e),
|
|
335
335
|
onSubtitleStreams: (e) => {
|
|
336
336
|
n || (L.current.subtitles = e, a.setSourceState({
|
|
337
|
-
subtitleTracks: Se(e,
|
|
337
|
+
subtitleTracks: Se(e, K.current),
|
|
338
338
|
...F.current === c ? {} : { selectedSubtitleTrack: De(B.current, e) }
|
|
339
339
|
}));
|
|
340
340
|
},
|
|
341
341
|
onAudioStreams: (e, t) => {
|
|
342
342
|
n || (L.current.audio = e, a.setSourceState({
|
|
343
|
-
audioTracks: Se(e,
|
|
343
|
+
audioTracks: Se(e, K.current),
|
|
344
344
|
selectedAudioTrack: t
|
|
345
345
|
}));
|
|
346
346
|
}
|
|
@@ -403,7 +403,7 @@ var se = {
|
|
|
403
403
|
};
|
|
404
404
|
return r;
|
|
405
405
|
}, Pe = (e, t) => {
|
|
406
|
-
let n =
|
|
406
|
+
let n = Y(), r = Y((e) => e.setSourceState), i = C(t);
|
|
407
407
|
i.current = t;
|
|
408
408
|
let a = !!t;
|
|
409
409
|
x(() => {
|
|
@@ -670,7 +670,7 @@ var se = {
|
|
|
670
670
|
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
671
671
|
p.onmessage = ({ data: e }) => {
|
|
672
672
|
if (e.type === "unsupported") {
|
|
673
|
-
|
|
673
|
+
W();
|
|
674
674
|
return;
|
|
675
675
|
}
|
|
676
676
|
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
@@ -788,7 +788,7 @@ var se = {
|
|
|
788
788
|
}
|
|
789
789
|
e(z), z = void 0;
|
|
790
790
|
}
|
|
791
|
-
}, H = () => {},
|
|
791
|
+
}, H = () => {}, U = (e, t) => {
|
|
792
792
|
let n = !1, r = (e) => {
|
|
793
793
|
n && p.postMessage({
|
|
794
794
|
type: "end",
|
|
@@ -823,7 +823,7 @@ var se = {
|
|
|
823
823
|
}, [t]);
|
|
824
824
|
}
|
|
825
825
|
});
|
|
826
|
-
},
|
|
826
|
+
}, W = () => {
|
|
827
827
|
if (!a) {
|
|
828
828
|
a = !0, f(!0), l(), clearInterval(C);
|
|
829
829
|
for (let e of w) n.removeEventListener(e, x);
|
|
@@ -832,13 +832,13 @@ var se = {
|
|
|
832
832
|
_.clear();
|
|
833
833
|
}
|
|
834
834
|
};
|
|
835
|
-
return "tap" in i ?
|
|
836
|
-
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e),
|
|
835
|
+
return "tap" in i ? U(i.tap, i.audioStreamIndex) : te(i).catch((e) => {
|
|
836
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), W());
|
|
837
837
|
}), S(), {
|
|
838
838
|
update: (e) => {
|
|
839
839
|
o = e, f(!1);
|
|
840
840
|
},
|
|
841
|
-
stop:
|
|
841
|
+
stop: W
|
|
842
842
|
};
|
|
843
843
|
}, et = (e, t, n, r, i) => {
|
|
844
844
|
let a = C(null), [o, s] = w(!1), [c, l] = w(null);
|
|
@@ -1010,7 +1010,7 @@ var se = {
|
|
|
1010
1010
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1011
1011
|
pointer-events: none;
|
|
1012
1012
|
`, 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 =
|
|
1013
|
+
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
1014
|
return /* @__PURE__ */ F(N, { children: [
|
|
1015
1015
|
n ? /* @__PURE__ */ P("div", {
|
|
1016
1016
|
className: "title",
|
|
@@ -1115,7 +1115,7 @@ var se = {
|
|
|
1115
1115
|
"data-tooltip-delay-hide": i,
|
|
1116
1116
|
"data-tooltip-place": o,
|
|
1117
1117
|
children: n
|
|
1118
|
-
}), !s && /* @__PURE__ */ P(
|
|
1118
|
+
}), !s && /* @__PURE__ */ P(ae, {
|
|
1119
1119
|
ref: u,
|
|
1120
1120
|
css: _t(c),
|
|
1121
1121
|
id: e,
|
|
@@ -1381,7 +1381,7 @@ var se = {
|
|
|
1381
1381
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1382
1382
|
}
|
|
1383
1383
|
`, Tt = 4, Et = () => {
|
|
1384
|
-
let e =
|
|
1384
|
+
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
1385
|
T(e), u(e);
|
|
1386
1386
|
}, D = !!b;
|
|
1387
1387
|
x(() => {
|
|
@@ -1419,7 +1419,7 @@ var se = {
|
|
|
1419
1419
|
z.current !== "touch" && E(R(e.clientX));
|
|
1420
1420
|
}, te = () => {
|
|
1421
1421
|
_.current && E(void 0);
|
|
1422
|
-
}, H = (e) => r ? e / r * 100 : 0,
|
|
1422
|
+
}, H = (e) => r ? e / r * 100 : 0, U = (e, t, n) => {
|
|
1423
1423
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1424
1424
|
return /* @__PURE__ */ P("div", {
|
|
1425
1425
|
className: "loaded-part",
|
|
@@ -1428,10 +1428,10 @@ var se = {
|
|
|
1428
1428
|
marginLeft: `${i}%`
|
|
1429
1429
|
}
|
|
1430
1430
|
}, e);
|
|
1431
|
-
},
|
|
1431
|
+
}, W = S(() => i === void 0 ? r ? o.map(([e, t], n) => U(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1432
1432
|
if (!i || !r) return null;
|
|
1433
1433
|
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 :
|
|
1434
|
+
return !a || !o ? null : U(t, a.timestamp / r, o.timestamp / r);
|
|
1435
1435
|
}) ?? [], [
|
|
1436
1436
|
r,
|
|
1437
1437
|
i,
|
|
@@ -1447,7 +1447,7 @@ var se = {
|
|
|
1447
1447
|
v,
|
|
1448
1448
|
r
|
|
1449
1449
|
]);
|
|
1450
|
-
let
|
|
1450
|
+
let G = S(() => {
|
|
1451
1451
|
if (!r) return 0;
|
|
1452
1452
|
if (M && v !== void 0) return v;
|
|
1453
1453
|
let e = m ?? t;
|
|
@@ -1458,22 +1458,22 @@ var se = {
|
|
|
1458
1458
|
M,
|
|
1459
1459
|
v,
|
|
1460
1460
|
m
|
|
1461
|
-
]),
|
|
1462
|
-
if (!
|
|
1463
|
-
let e = b / r * 100, t =
|
|
1464
|
-
return t >= 0 ? t :
|
|
1461
|
+
]), K = S(() => f(d, r), [d, r]), q = K.length > 0, J = S(() => {
|
|
1462
|
+
if (!q || b === void 0 || !r) return -1;
|
|
1463
|
+
let e = b / r * 100, t = K.findIndex((t, n) => n < K.length - 1 && e >= t && e < K[n + 1]);
|
|
1464
|
+
return t >= 0 ? t : K.length - 2;
|
|
1465
1465
|
}, [
|
|
1466
|
+
q,
|
|
1466
1467
|
K,
|
|
1467
|
-
G,
|
|
1468
1468
|
b,
|
|
1469
1469
|
r
|
|
1470
|
-
]),
|
|
1470
|
+
]), ne = S(() => q ? p(K, (e) => e !== J) : void 0, [
|
|
1471
|
+
q,
|
|
1471
1472
|
K,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
]), ie = S(() => q >= 0 ? p(G, (e) => e === q) : void 0, [G, q]), ae = S(() => {
|
|
1473
|
+
J
|
|
1474
|
+
]), re = S(() => J >= 0 ? p(K, (e) => e === J) : void 0, [K, J]), ie = S(() => {
|
|
1475
1475
|
if (b !== void 0) return d.find(({ start: e, end: t }) => e <= b && b < t);
|
|
1476
|
-
}, [d, b]),
|
|
1476
|
+
}, [d, b]), ae = S(() => {
|
|
1477
1477
|
if (b) {
|
|
1478
1478
|
if (l) return l(b);
|
|
1479
1479
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
|
|
@@ -1482,20 +1482,20 @@ var se = {
|
|
|
1482
1482
|
c,
|
|
1483
1483
|
l,
|
|
1484
1484
|
b
|
|
1485
|
-
]),
|
|
1485
|
+
]), oe = (e, t) => /* @__PURE__ */ F("div", {
|
|
1486
1486
|
className: e ? `track ${e}` : "track",
|
|
1487
1487
|
style: t ? { maskImage: t } : void 0,
|
|
1488
1488
|
children: [
|
|
1489
1489
|
/* @__PURE__ */ P("div", { className: "background-bar" }),
|
|
1490
1490
|
/* @__PURE__ */ P("div", {
|
|
1491
1491
|
className: "loaded",
|
|
1492
|
-
children:
|
|
1492
|
+
children: W
|
|
1493
1493
|
}),
|
|
1494
1494
|
/* @__PURE__ */ P("div", {
|
|
1495
1495
|
className: "play-container",
|
|
1496
1496
|
children: /* @__PURE__ */ P("div", {
|
|
1497
1497
|
className: "play",
|
|
1498
|
-
style: { transform: `scaleX(${
|
|
1498
|
+
style: { transform: `scaleX(${G})` }
|
|
1499
1499
|
})
|
|
1500
1500
|
})
|
|
1501
1501
|
]
|
|
@@ -1506,31 +1506,31 @@ var se = {
|
|
|
1506
1506
|
className: [
|
|
1507
1507
|
"progress-bar",
|
|
1508
1508
|
M ? "dragging" : "",
|
|
1509
|
-
|
|
1509
|
+
q ? "segmented" : ""
|
|
1510
1510
|
].filter(Boolean).join(" "),
|
|
1511
1511
|
onPointerDown: B,
|
|
1512
1512
|
onPointerMove: B,
|
|
1513
1513
|
onMouseMove: V,
|
|
1514
1514
|
onMouseOut: te,
|
|
1515
1515
|
children: [
|
|
1516
|
-
|
|
1516
|
+
oe(void 0, ne),
|
|
1517
1517
|
b ? /* @__PURE__ */ F("div", {
|
|
1518
1518
|
className: "cursor-time",
|
|
1519
1519
|
style: {
|
|
1520
|
-
left:
|
|
1521
|
-
maxWidth:
|
|
1520
|
+
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))))`,
|
|
1521
|
+
maxWidth: ie ? "var(--thumbnail-width)" : void 0
|
|
1522
1522
|
},
|
|
1523
1523
|
children: [/* @__PURE__ */ P("span", {
|
|
1524
1524
|
className: "cursor-time-value",
|
|
1525
1525
|
children: ht(b)
|
|
1526
|
-
}),
|
|
1526
|
+
}), ie ? /* @__PURE__ */ P("span", {
|
|
1527
1527
|
className: "chapter-title",
|
|
1528
|
-
children:
|
|
1528
|
+
children: ie.title
|
|
1529
1529
|
}) : void 0]
|
|
1530
1530
|
}) : void 0,
|
|
1531
1531
|
/* @__PURE__ */ P("div", { className: "progress" }),
|
|
1532
1532
|
/* @__PURE__ */ P("div", { className: "hover" }),
|
|
1533
|
-
|
|
1533
|
+
re ? oe("focus", re) : void 0,
|
|
1534
1534
|
/* @__PURE__ */ P("div", { className: "scrubber" }),
|
|
1535
1535
|
/* @__PURE__ */ P("div", {
|
|
1536
1536
|
className: "padding",
|
|
@@ -1542,7 +1542,7 @@ var se = {
|
|
|
1542
1542
|
/* @__PURE__ */ P("div", {
|
|
1543
1543
|
className: "thumbnail",
|
|
1544
1544
|
style: { left: `clamp(var(--thumbnail-half), ${H(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1545
|
-
children:
|
|
1545
|
+
children: ae?.url ? /* @__PURE__ */ P("img", { src: ae.url }) : void 0
|
|
1546
1546
|
})
|
|
1547
1547
|
]
|
|
1548
1548
|
});
|
|
@@ -1878,7 +1878,7 @@ ${jt}
|
|
|
1878
1878
|
e.detail
|
|
1879
1879
|
].filter(Boolean).join("\n");
|
|
1880
1880
|
}).join("\n\n"), zt = () => {
|
|
1881
|
-
let e =
|
|
1881
|
+
let e = Y((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } = Nt(), [s, c] = w(!1);
|
|
1882
1882
|
if (e.length === 0) return null;
|
|
1883
1883
|
let l = () => {
|
|
1884
1884
|
navigator.clipboard?.writeText(Rt(e)).then(() => {
|
|
@@ -1897,7 +1897,7 @@ ${jt}
|
|
|
1897
1897
|
onClick: i,
|
|
1898
1898
|
"aria-label": u,
|
|
1899
1899
|
"aria-expanded": r,
|
|
1900
|
-
children: /* @__PURE__ */ P(
|
|
1900
|
+
children: /* @__PURE__ */ P(J, { className: "alert-triangle" })
|
|
1901
1901
|
}),
|
|
1902
1902
|
toolTipText: /* @__PURE__ */ P("span", { children: u })
|
|
1903
1903
|
}), r && /* @__PURE__ */ F("div", {
|
|
@@ -1995,7 +1995,7 @@ width: 100%;
|
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
1997
1997
|
`, Vt = () => {
|
|
1998
|
-
let e =
|
|
1998
|
+
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
1999
|
ref: o,
|
|
2000
2000
|
onChange: (t) => e.setPlaybackRate(f(t))
|
|
2001
2001
|
}), m = (t) => {
|
|
@@ -2132,7 +2132,7 @@ ${jt}
|
|
|
2132
2132
|
1.5,
|
|
2133
2133
|
2
|
|
2134
2134
|
], Wt = () => {
|
|
2135
|
-
let e =
|
|
2135
|
+
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
2136
|
e.setPlaybackRate(t), d(0);
|
|
2137
2137
|
}, y = (e) => {
|
|
2138
2138
|
e !== void 0 && _(e, () => s(e));
|
|
@@ -2154,7 +2154,7 @@ ${jt}
|
|
|
2154
2154
|
onClick: p,
|
|
2155
2155
|
"aria-label": t(a.settings),
|
|
2156
2156
|
"aria-expanded": f,
|
|
2157
|
-
children: /* @__PURE__ */ P(
|
|
2157
|
+
children: /* @__PURE__ */ P(q, {})
|
|
2158
2158
|
}),
|
|
2159
2159
|
toolTipText: /* @__PURE__ */ P("span", { children: t(a.settings) })
|
|
2160
2160
|
}),
|
|
@@ -2257,7 +2257,7 @@ position: static;
|
|
|
2257
2257
|
|
|
2258
2258
|
${jt}
|
|
2259
2259
|
`, Kt = () => {
|
|
2260
|
-
let { format: e } = Q(), t =
|
|
2260
|
+
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
2261
|
if (t.length === 0) return null;
|
|
2262
2262
|
let f = n !== void 0;
|
|
2263
2263
|
return /* @__PURE__ */ F("div", {
|
|
@@ -2336,7 +2336,7 @@ ${jt}
|
|
|
2336
2336
|
height: 10px;
|
|
2337
2337
|
}
|
|
2338
2338
|
`, Yt = ({ value: e, onChange: t }) => {
|
|
2339
|
-
let { number: n } = Q(), r =
|
|
2339
|
+
let { number: n } = Q(), r = Y((e) => e.volume), i = Y((e) => e.muted), a = C(null), o = C(null), { handlers: s } = Ct({
|
|
2340
2340
|
ref: o,
|
|
2341
2341
|
onChange: t
|
|
2342
2342
|
}), c = (n) => {
|
|
@@ -2438,7 +2438,7 @@ ${jt}
|
|
|
2438
2438
|
}
|
|
2439
2439
|
|
|
2440
2440
|
`, Zt = ({ ref: e }) => {
|
|
2441
|
-
let t =
|
|
2441
|
+
let t = Y(), { format: n } = Q(), r = Y((e) => e.volume), i = Y((e) => e.muted), o = S(() => mt(r), [r]);
|
|
2442
2442
|
return /* @__PURE__ */ F("div", {
|
|
2443
2443
|
css: Xt,
|
|
2444
2444
|
children: [/* @__PURE__ */ P(St, {
|
|
@@ -2450,7 +2450,7 @@ ${jt}
|
|
|
2450
2450
|
ref: e,
|
|
2451
2451
|
"aria-label": n(a.mute),
|
|
2452
2452
|
"aria-pressed": i || r === 0,
|
|
2453
|
-
children: P(i || r === 0 ?
|
|
2453
|
+
children: P(i || r === 0 ? ie : r <= .5 ? ne : re, {
|
|
2454
2454
|
size: 18,
|
|
2455
2455
|
color: "#fff"
|
|
2456
2456
|
})
|
|
@@ -2600,9 +2600,9 @@ ${jt}
|
|
|
2600
2600
|
}
|
|
2601
2601
|
}
|
|
2602
2602
|
`, rn = ({ shortcuts: e = "window", root: t, fullscreen: n }) => {
|
|
2603
|
-
let r =
|
|
2603
|
+
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
2604
|
f.current = n;
|
|
2605
|
-
let p =
|
|
2605
|
+
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
2606
|
let n = mt(r.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + i)), o = r.muted;
|
|
2607
2607
|
r.setVolume(pt(a)), o && !r.muted && r.toggleMuted();
|
|
2608
2608
|
}, [r]), M = C(!1), N = y(() => {
|
|
@@ -2703,7 +2703,7 @@ ${jt}
|
|
|
2703
2703
|
type: "button",
|
|
2704
2704
|
onClick: () => r.togglePaused(),
|
|
2705
2705
|
"aria-label": i(A ? a.replay : o ? a.play : a.pause),
|
|
2706
|
-
children: P(A ?
|
|
2706
|
+
children: P(A ? K : o ? G : W, {})
|
|
2707
2707
|
}),
|
|
2708
2708
|
toolTipText: /* @__PURE__ */ P("span", { children: i(A ? a.replayKey : o ? a.playKey : a.pauseKey) })
|
|
2709
2709
|
}),
|
|
@@ -2763,7 +2763,7 @@ ${jt}
|
|
|
2763
2763
|
onClick: N,
|
|
2764
2764
|
"aria-label": i(a.fullScreen),
|
|
2765
2765
|
"aria-pressed": d,
|
|
2766
|
-
children: P(d ?
|
|
2766
|
+
children: P(d ? U : H, {})
|
|
2767
2767
|
}),
|
|
2768
2768
|
toolTipText: /* @__PURE__ */ P("span", { children: i(d ? a.exitFullScreenKey : a.fullScreenKey) })
|
|
2769
2769
|
})
|
|
@@ -2815,7 +2815,7 @@ ${jt}
|
|
|
2815
2815
|
color: #fff;
|
|
2816
2816
|
}
|
|
2817
2817
|
`, sn = () => {
|
|
2818
|
-
let { format: e } = Q(), t =
|
|
2818
|
+
let { format: e } = Q(), t = Y((e) => e.burnedInSubtitles), n = Y((e) => e.pictureInPictureMode), [r, i] = w(!1);
|
|
2819
2819
|
return x(() => {
|
|
2820
2820
|
if (n !== "burn-in" || !t) {
|
|
2821
2821
|
i(!1);
|
|
@@ -2894,44 +2894,47 @@ ${jt}
|
|
|
2894
2894
|
bottom: calc(9 * var(--mp-unit));
|
|
2895
2895
|
}
|
|
2896
2896
|
}
|
|
2897
|
-
`, pn = () => {
|
|
2898
|
-
let
|
|
2899
|
-
|
|
2900
|
-
|
|
2897
|
+
`, pn = ({ endingOffered: e }) => {
|
|
2898
|
+
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(() => {
|
|
2899
|
+
let n = m(t), r = e ? -1 : n.lastIndexOf("ending");
|
|
2900
|
+
return n.map((e, t) => t === r ? void 0 : e);
|
|
2901
|
+
}, [t, e]), c = S(() => {
|
|
2902
|
+
if (typeof n != "number") return;
|
|
2903
|
+
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
2904
|
return r ? {
|
|
2902
2905
|
kind: r,
|
|
2903
|
-
end: e
|
|
2906
|
+
end: t[e].end
|
|
2904
2907
|
} : void 0;
|
|
2905
2908
|
}, [
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
]),
|
|
2909
|
+
t,
|
|
2910
|
+
s,
|
|
2911
|
+
n
|
|
2912
|
+
]), l = C(0), [u, d] = w(0);
|
|
2910
2913
|
x(() => {
|
|
2911
|
-
let e = typeof
|
|
2912
|
-
|
|
2913
|
-
}, [
|
|
2914
|
-
let [
|
|
2914
|
+
let e = typeof n == "number" ? n : 0, t = l.current;
|
|
2915
|
+
l.current = e, e < t - un && d((e) => e + 1);
|
|
2916
|
+
}, [n]);
|
|
2917
|
+
let [f, p] = w(!1), h = c ? `${c.kind}@${c.end}` : "";
|
|
2915
2918
|
return x(() => {
|
|
2916
|
-
if (!
|
|
2917
|
-
|
|
2919
|
+
if (!h) {
|
|
2920
|
+
p(!1);
|
|
2918
2921
|
return;
|
|
2919
2922
|
}
|
|
2920
|
-
|
|
2921
|
-
let e = setTimeout(() =>
|
|
2923
|
+
p(!0);
|
|
2924
|
+
let e = setTimeout(() => p(!1), ln);
|
|
2922
2925
|
return () => clearTimeout(e);
|
|
2923
|
-
}, [
|
|
2924
|
-
|
|
2925
|
-
}, [
|
|
2926
|
+
}, [h, u]), x(() => {
|
|
2927
|
+
c || p(!1);
|
|
2928
|
+
}, [c]), c ? /* @__PURE__ */ P("div", {
|
|
2926
2929
|
css: fn,
|
|
2927
|
-
className:
|
|
2930
|
+
className: f && !i ? "show" : "",
|
|
2928
2931
|
children: /* @__PURE__ */ P("button", {
|
|
2929
2932
|
type: "button",
|
|
2930
2933
|
className: "skip-chapter",
|
|
2931
2934
|
onClick: () => {
|
|
2932
|
-
|
|
2935
|
+
p(!1), r ? r(c.end) : a.seek(c.end);
|
|
2933
2936
|
},
|
|
2934
|
-
children:
|
|
2937
|
+
children: o(dn[c.kind])
|
|
2935
2938
|
})
|
|
2936
2939
|
}) : null;
|
|
2937
2940
|
}, mn = 3e3, hn = E`
|
|
@@ -3011,68 +3014,68 @@ ${jt}
|
|
|
3011
3014
|
key: r,
|
|
3012
3015
|
item: e
|
|
3013
3016
|
}];
|
|
3014
|
-
}), yn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o,
|
|
3015
|
-
let
|
|
3017
|
+
}), yn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, children: c }) => {
|
|
3018
|
+
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
3019
|
x: -1,
|
|
3017
3020
|
y: -1
|
|
3018
|
-
}),
|
|
3019
|
-
x(() => () => clearTimeout(
|
|
3020
|
-
let e =
|
|
3021
|
+
}), _ = C(!1), v = C(null);
|
|
3022
|
+
x(() => () => clearTimeout(m.current), []), x(() => {
|
|
3023
|
+
let e = v.current;
|
|
3021
3024
|
if (!e) return;
|
|
3022
3025
|
let t = new ResizeObserver(([t]) => e.style.setProperty("--mp-height", `${t.contentRect.height}px`));
|
|
3023
3026
|
return t.observe(e), () => t.disconnect();
|
|
3024
3027
|
}, []), 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\"]");
|
|
3028
|
+
f || (clearTimeout(m.current), d(!1));
|
|
3029
|
+
}, [f, d]);
|
|
3030
|
+
let y = () => {
|
|
3031
|
+
f && d(!0);
|
|
3032
|
+
}, b = (t) => {
|
|
3033
|
+
v.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
3038
3034
|
}, S = () => {
|
|
3039
|
-
if (
|
|
3040
|
-
|
|
3035
|
+
if (l.passThroughPictureInPicture?.armed) return !0;
|
|
3036
|
+
if (h.current !== "mouse") return !1;
|
|
3037
|
+
let { x: e, y: t } = g.current;
|
|
3038
|
+
if (!v.current || e < 0) return !1;
|
|
3039
|
+
let n = document.elementFromPoint(e, t);
|
|
3040
|
+
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3041
|
+
}, w = () => {
|
|
3042
|
+
if (S()) {
|
|
3043
|
+
m.current = setTimeout(w, mn);
|
|
3041
3044
|
return;
|
|
3042
3045
|
}
|
|
3043
|
-
|
|
3044
|
-
},
|
|
3045
|
-
|
|
3046
|
-
},
|
|
3047
|
-
|
|
3046
|
+
y();
|
|
3047
|
+
}, T = () => {
|
|
3048
|
+
d(!1), clearTimeout(m.current), m.current = setTimeout(w, mn);
|
|
3049
|
+
}, E = (e) => {
|
|
3050
|
+
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
3048
3051
|
x: e.clientX,
|
|
3049
3052
|
y: e.clientY
|
|
3050
|
-
},
|
|
3051
|
-
},
|
|
3052
|
-
|
|
3053
|
-
},
|
|
3054
|
-
|
|
3055
|
-
},
|
|
3053
|
+
}, T());
|
|
3054
|
+
}, D = (e) => {
|
|
3055
|
+
h.current = e.pointerType, _.current = !0;
|
|
3056
|
+
}, O = () => {
|
|
3057
|
+
_.current = !1;
|
|
3058
|
+
}, k = C(!0);
|
|
3056
3059
|
return /* @__PURE__ */ F("div", {
|
|
3057
3060
|
css: _n,
|
|
3058
|
-
ref:
|
|
3059
|
-
onPointerMove:
|
|
3060
|
-
onPointerDown:
|
|
3061
|
-
onPointerUp:
|
|
3062
|
-
onPointerCancel:
|
|
3061
|
+
ref: b,
|
|
3062
|
+
onPointerMove: E,
|
|
3063
|
+
onPointerDown: D,
|
|
3064
|
+
onPointerUp: O,
|
|
3065
|
+
onPointerCancel: O,
|
|
3063
3066
|
onMouseOut: (e) => {
|
|
3064
3067
|
let t = e.relatedTarget;
|
|
3065
3068
|
if (t && e.currentTarget.contains(t)) return;
|
|
3066
3069
|
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(
|
|
3070
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(m.current), y());
|
|
3068
3071
|
},
|
|
3069
|
-
className:
|
|
3072
|
+
className: u ? "hide" : "",
|
|
3070
3073
|
tabIndex: a === "player" ? -1 : void 0,
|
|
3071
3074
|
children: [
|
|
3072
3075
|
/* @__PURE__ */ P(ut, { onSubtitleRef: n }),
|
|
3073
3076
|
vn(r).map(({ key: e, item: t }) => /* @__PURE__ */ P("div", {
|
|
3074
3077
|
css: hn,
|
|
3075
|
-
style: { ...
|
|
3078
|
+
style: { ...u ? {
|
|
3076
3079
|
opacity: "0",
|
|
3077
3080
|
visibility: "hidden",
|
|
3078
3081
|
pointerEvents: "none"
|
|
@@ -3083,53 +3086,55 @@ ${jt}
|
|
|
3083
3086
|
value: !!o,
|
|
3084
3087
|
children: /* @__PURE__ */ P(rn, {
|
|
3085
3088
|
shortcuts: a,
|
|
3086
|
-
root:
|
|
3089
|
+
root: v,
|
|
3087
3090
|
fullscreen: o
|
|
3088
3091
|
})
|
|
3089
3092
|
}),
|
|
3090
3093
|
/* @__PURE__ */ P(sn, {}),
|
|
3091
|
-
/* @__PURE__ */ P(pn, {}),
|
|
3092
|
-
|
|
3094
|
+
/* @__PURE__ */ P(pn, { endingOffered: s }),
|
|
3095
|
+
p?.armed && v.current ? /* @__PURE__ */ P("div", {
|
|
3093
3096
|
className: "pass-through",
|
|
3094
|
-
style: { clipPath: gn(
|
|
3095
|
-
onPointerOver:
|
|
3097
|
+
style: { clipPath: gn(p.armed, v.current.getBoundingClientRect()) },
|
|
3098
|
+
onPointerOver: p.disarm
|
|
3096
3099
|
}) : null,
|
|
3097
3100
|
/* @__PURE__ */ F("div", {
|
|
3098
3101
|
className: "video",
|
|
3099
3102
|
onClick: (e) => {
|
|
3100
|
-
if (
|
|
3103
|
+
if (h.current === "mouse") {
|
|
3101
3104
|
if (e.detail > 1) return;
|
|
3102
|
-
|
|
3105
|
+
k.current = l.paused, l.togglePaused();
|
|
3103
3106
|
return;
|
|
3104
3107
|
}
|
|
3105
|
-
|
|
3108
|
+
u ? T() : (clearTimeout(m.current), y());
|
|
3106
3109
|
},
|
|
3107
3110
|
onDoubleClick: () => {
|
|
3108
|
-
|
|
3111
|
+
h.current === "mouse" && (k.current ? l.pause() : l.play().catch(() => {}), o ? o.request() : l.toggleFullscreen());
|
|
3109
3112
|
},
|
|
3110
3113
|
children: [t ? /* @__PURE__ */ P("video", {
|
|
3111
3114
|
ref: t,
|
|
3112
3115
|
playsInline: !0
|
|
3113
|
-
}) : null,
|
|
3116
|
+
}) : null, c]
|
|
3114
3117
|
})
|
|
3115
3118
|
]
|
|
3116
3119
|
});
|
|
3117
3120
|
}, 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
3121
|
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
3122
|
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(), {
|
|
3123
|
+
let { expose: E } = e, [D, O] = w(null), [A, j] = w(!0), [M] = w(() => Object.assign(new EventTarget(), {
|
|
3121
3124
|
chapters: [],
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3125
|
+
endingOffered: !0,
|
|
3126
|
+
onHostFullscreen: O,
|
|
3127
|
+
onEndingOffered: j
|
|
3128
|
+
})), N = E === !0 ? {} : E || void 0, F = C(N);
|
|
3129
|
+
F.current = N;
|
|
3130
|
+
let I = N ? N.id : void 0, L = N ? N.origin : void 0, R = N ? N.channel : void 0;
|
|
3126
3131
|
x(() => {
|
|
3127
3132
|
if (!E || !T) return;
|
|
3128
3133
|
let e, t = !1;
|
|
3129
3134
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
3130
3135
|
t || (e = n(T, {
|
|
3131
|
-
...
|
|
3132
|
-
player:
|
|
3136
|
+
...F.current,
|
|
3137
|
+
player: M
|
|
3133
3138
|
}));
|
|
3134
3139
|
}).catch(() => {}), () => {
|
|
3135
3140
|
t = !0, e?.();
|
|
@@ -3137,149 +3142,150 @@ ${jt}
|
|
|
3137
3142
|
}, [
|
|
3138
3143
|
T,
|
|
3139
3144
|
!!E,
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3145
|
+
I,
|
|
3146
|
+
L,
|
|
3147
|
+
R
|
|
3143
3148
|
]);
|
|
3144
|
-
let
|
|
3149
|
+
let z = Y((e) => e.chapters), B = JSON.stringify(z);
|
|
3145
3150
|
x(() => {
|
|
3146
|
-
|
|
3147
|
-
}, [
|
|
3148
|
-
let
|
|
3151
|
+
M.chapters = z, M.endingOffered = A, M.dispatchEvent(new Event("chapterschange"));
|
|
3152
|
+
}, [B, A]);
|
|
3153
|
+
let V = e.fullscreen ?? (D === null ? void 0 : {
|
|
3149
3154
|
active: D,
|
|
3150
|
-
request: () =>
|
|
3151
|
-
}),
|
|
3152
|
-
Ae(_, y, r, m ?
|
|
3153
|
-
let
|
|
3155
|
+
request: () => M.dispatchEvent(new Event("fullscreenrequest"))
|
|
3156
|
+
}), te = S(() => tt(), [o]);
|
|
3157
|
+
Ae(_, y, r, m ? te.push : void 0);
|
|
3158
|
+
let H = r?.normalizeVolume ?? !0, [U, W] = w(H);
|
|
3154
3159
|
x(() => {
|
|
3155
|
-
H
|
|
3156
|
-
}, [
|
|
3157
|
-
let
|
|
3158
|
-
|
|
3159
|
-
let
|
|
3160
|
-
|
|
3161
|
-
let
|
|
3162
|
-
tap:
|
|
3163
|
-
audioStreamIndex:
|
|
3160
|
+
W(H);
|
|
3161
|
+
}, [H]);
|
|
3162
|
+
let G = C(r?.onNormalizeVolumeChange);
|
|
3163
|
+
G.current = r?.onNormalizeVolumeChange;
|
|
3164
|
+
let K = r?.normalizerWorkletUrl, q = C(f ?? d);
|
|
3165
|
+
q.current = f ?? d;
|
|
3166
|
+
let J = Y((e) => e.selectedAudioTrack), ne = !!d, { refused: re } = et(_, K, U, S(() => ne && o && c && l && typeof J == "number" && J >= 0 ? m ? {
|
|
3167
|
+
tap: te,
|
|
3168
|
+
audioStreamIndex: J
|
|
3164
3169
|
} : {
|
|
3165
|
-
read: (e, t) =>
|
|
3170
|
+
read: (e, t) => q.current(e, t),
|
|
3166
3171
|
length: o,
|
|
3167
3172
|
publicPath: c,
|
|
3168
3173
|
libavWorkerUrl: l,
|
|
3169
|
-
audioStreamIndex:
|
|
3174
|
+
audioStreamIndex: J
|
|
3170
3175
|
} : void 0, [
|
|
3171
|
-
|
|
3176
|
+
ne,
|
|
3172
3177
|
o,
|
|
3173
3178
|
c,
|
|
3174
3179
|
l,
|
|
3175
|
-
|
|
3180
|
+
J,
|
|
3176
3181
|
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: !
|
|
3182
|
+
te
|
|
3183
|
+
]), S(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ie = S(() => K && typeof AudioWorkletNode == "function" ? {
|
|
3184
|
+
enabled: U,
|
|
3185
|
+
available: !re,
|
|
3181
3186
|
setEnabled: (e) => {
|
|
3182
|
-
|
|
3187
|
+
W(e), G.current?.(e);
|
|
3183
3188
|
}
|
|
3184
3189
|
} : null, [
|
|
3190
|
+
K,
|
|
3185
3191
|
U,
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
]), { thumbnails: ie, requestThumbnail: ae } = Le({
|
|
3192
|
+
re
|
|
3193
|
+
]), { thumbnails: ae, requestThumbnail: oe } = Le({
|
|
3189
3194
|
publicPath: c,
|
|
3190
3195
|
workerUrl: l,
|
|
3191
3196
|
length: p === !1 ? void 0 : o,
|
|
3192
3197
|
read: f ?? d,
|
|
3193
3198
|
downloadedRanges: s
|
|
3194
|
-
}),
|
|
3199
|
+
}), 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
3200
|
x(() => {
|
|
3196
|
-
|
|
3201
|
+
X({
|
|
3197
3202
|
title: i,
|
|
3198
3203
|
size: o,
|
|
3199
3204
|
downloadedRanges: s,
|
|
3200
|
-
hasMedia:
|
|
3205
|
+
hasMedia: fe
|
|
3201
3206
|
});
|
|
3202
3207
|
}, [
|
|
3203
|
-
|
|
3208
|
+
X,
|
|
3204
3209
|
i,
|
|
3205
3210
|
o,
|
|
3206
3211
|
s,
|
|
3207
|
-
|
|
3212
|
+
fe
|
|
3208
3213
|
]);
|
|
3209
|
-
let
|
|
3214
|
+
let pe = n?.thumbnails?.at;
|
|
3210
3215
|
x(() => {
|
|
3211
|
-
|
|
3212
|
-
thumbnails:
|
|
3213
|
-
thumbnailAt:
|
|
3214
|
-
requestThumbnail:
|
|
3215
|
-
togglePictureInPicture:
|
|
3216
|
-
pictureInPictureMode:
|
|
3217
|
-
burnedInSubtitles:
|
|
3216
|
+
X({
|
|
3217
|
+
thumbnails: se,
|
|
3218
|
+
thumbnailAt: pe,
|
|
3219
|
+
requestThumbnail: oe,
|
|
3220
|
+
togglePictureInPicture: ce,
|
|
3221
|
+
pictureInPictureMode: le,
|
|
3222
|
+
burnedInSubtitles: ue
|
|
3218
3223
|
});
|
|
3219
3224
|
}, [
|
|
3220
|
-
|
|
3221
|
-
oe,
|
|
3222
|
-
fe,
|
|
3223
|
-
ae,
|
|
3225
|
+
X,
|
|
3224
3226
|
se,
|
|
3227
|
+
pe,
|
|
3228
|
+
oe,
|
|
3225
3229
|
ce,
|
|
3226
|
-
le
|
|
3230
|
+
le,
|
|
3231
|
+
ue
|
|
3227
3232
|
]), x(() => {
|
|
3228
|
-
|
|
3229
|
-
}, [
|
|
3230
|
-
|
|
3231
|
-
}, [
|
|
3232
|
-
let
|
|
3233
|
+
X({ volumeNormalizer: ie });
|
|
3234
|
+
}, [X, ie]), x(() => {
|
|
3235
|
+
X({ passThroughPictureInPicture: de });
|
|
3236
|
+
}, [X, de]);
|
|
3237
|
+
let Z = n?.subtitles?.selection, me = n?.audioTracks?.selection, he = C({
|
|
3233
3238
|
audio: e.onPreferredAudioLanguageChange,
|
|
3234
3239
|
subtitles: e.onPreferredSubtitleLanguageChange
|
|
3235
3240
|
});
|
|
3236
|
-
|
|
3241
|
+
he.current = {
|
|
3237
3242
|
audio: e.onPreferredAudioLanguageChange,
|
|
3238
3243
|
subtitles: e.onPreferredSubtitleLanguageChange
|
|
3239
3244
|
}, x(() => {
|
|
3240
|
-
|
|
3241
|
-
subtitleTracks:
|
|
3245
|
+
Z && X({
|
|
3246
|
+
subtitleTracks: Z.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3242
3247
|
id: e,
|
|
3243
3248
|
label: t,
|
|
3244
3249
|
disabled: n
|
|
3245
3250
|
})),
|
|
3246
|
-
selectedSubtitleTrack:
|
|
3251
|
+
selectedSubtitleTrack: Z.selectedId ?? void 0,
|
|
3247
3252
|
selectSubtitleTrack: (e) => {
|
|
3248
|
-
let t = e == null ? null : String(e), n = t === null ? void 0 : bn(
|
|
3249
|
-
return xn(
|
|
3253
|
+
let t = e == null ? null : String(e), n = t === null ? void 0 : bn(Z, t), r = Z.selectedId === null;
|
|
3254
|
+
return xn(Z.select(t), () => {
|
|
3250
3255
|
let e = t === null ? null : u(n) ?? (r ? n?.title : void 0);
|
|
3251
|
-
e !== void 0 &&
|
|
3256
|
+
e !== void 0 && he.current.subtitles?.(e);
|
|
3252
3257
|
});
|
|
3253
3258
|
},
|
|
3254
|
-
subtitleOffLabel:
|
|
3259
|
+
subtitleOffLabel: Z.offLabel
|
|
3255
3260
|
});
|
|
3256
|
-
}, [
|
|
3257
|
-
|
|
3258
|
-
audioTracks:
|
|
3261
|
+
}, [X, Z]), x(() => {
|
|
3262
|
+
me && X({
|
|
3263
|
+
audioTracks: me.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3259
3264
|
id: e,
|
|
3260
3265
|
label: t,
|
|
3261
3266
|
disabled: n
|
|
3262
3267
|
})),
|
|
3263
|
-
selectedAudioTrack:
|
|
3264
|
-
selectAudioTrack: (e) => xn(
|
|
3265
|
-
let t = u(bn(
|
|
3266
|
-
t !== void 0 &&
|
|
3268
|
+
selectedAudioTrack: me.selectedId ?? void 0,
|
|
3269
|
+
selectAudioTrack: (e) => xn(me.select(String(e)), () => {
|
|
3270
|
+
let t = u(bn(me, String(e)));
|
|
3271
|
+
t !== void 0 && he.current.audio?.(t);
|
|
3267
3272
|
})
|
|
3268
3273
|
});
|
|
3269
|
-
}, [
|
|
3270
|
-
let
|
|
3274
|
+
}, [X, me]);
|
|
3275
|
+
let ge = n?.quality?.selection ?? null;
|
|
3271
3276
|
return x(() => {
|
|
3272
|
-
|
|
3273
|
-
}, [
|
|
3274
|
-
a &&
|
|
3275
|
-
}, [
|
|
3277
|
+
X({ quality: ge });
|
|
3278
|
+
}, [X, ge]), x(() => {
|
|
3279
|
+
a && X({ chapters: a });
|
|
3280
|
+
}, [X, a]), /* @__PURE__ */ P(yn, {
|
|
3276
3281
|
ref: g,
|
|
3277
3282
|
onVideoRef: n ? void 0 : v,
|
|
3278
3283
|
onSubtitleRef: b,
|
|
3279
3284
|
overlay: e.overlay,
|
|
3280
3285
|
controls: e.controls,
|
|
3281
3286
|
shortcuts: e.shortcuts,
|
|
3282
|
-
fullscreen:
|
|
3287
|
+
fullscreen: V,
|
|
3288
|
+
endingOffered: A,
|
|
3283
3289
|
children: t
|
|
3284
3290
|
});
|
|
3285
3291
|
}, Cn = E`
|
|
@@ -3354,7 +3360,7 @@ ${jt}
|
|
|
3354
3360
|
overflow: hidden;
|
|
3355
3361
|
`, wn = (e) => /* @__PURE__ */ P("div", {
|
|
3356
3362
|
css: Cn,
|
|
3357
|
-
children: /* @__PURE__ */ P(
|
|
3363
|
+
children: /* @__PURE__ */ P(ce.Provider, { children: /* @__PURE__ */ P(ve, {
|
|
3358
3364
|
language: e.language,
|
|
3359
3365
|
children: /* @__PURE__ */ P(Sn, {
|
|
3360
3366
|
options: e,
|
|
@@ -3403,4 +3409,4 @@ ${jt}
|
|
|
3403
3409
|
throw Error(`Unknown source type: ${e}`);
|
|
3404
3410
|
};
|
|
3405
3411
|
//#endregion
|
|
3406
|
-
export { wn as MediaPlayer, wn as default,
|
|
3412
|
+
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 };
|