@banou/media-player 0.10.37 → 0.10.39
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 +24 -18
- package/dist/engine/index.js +1 -1
- package/dist/engine/playback.d.ts +5 -1
- package/dist/engine/subtitles.d.ts +13 -3
- package/dist/{engine-x5oIkHAN.js → engine-DFqSQyNb.js} +257 -248
- package/dist/index.js +244 -240
- package/dist/react/video-player.d.ts +6 -2
- package/package.json +2 -2
- package/src/lib/engine/picture-in-picture.ts +56 -8
- package/src/lib/engine/playback.ts +9 -2
- package/src/lib/engine/subtitles.ts +33 -18
- package/src/lib/react/hooks/use-playback.ts +7 -4
- package/src/lib/react/video-player.tsx +6 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t, m as n, n as r, o as i, p as a, r as o, s, t as c, u as l } from "./engine-
|
|
1
|
+
import { c as e, l as t, m as n, n as r, o as i, p as a, r as o, s, t as c, u as l } from "./engine-DFqSQyNb.js";
|
|
2
2
|
import { languageOf as u, playsIn as d, startingTracks as f } from "./language/index.js";
|
|
3
3
|
import { n as p, r as m, t as h } from "./chapters-EBYXcEml.js";
|
|
4
4
|
import { Children as g, Fragment as _, createContext as v, isValidElement as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useRef as w, useState as T, useSyncExternalStore as E } from "react";
|
|
@@ -8,10 +8,10 @@ import { definePlayerFeature as M, videoFeatures as N } from "@videojs/core/dom"
|
|
|
8
8
|
import { makeRemuxer as P } from "libav-wasm";
|
|
9
9
|
import { Fragment as F, jsx as I, jsxs as L } from "@emotion/react/jsx-runtime";
|
|
10
10
|
import { createMediaElementSource as R } from "@banou/ponyfill/web-audio";
|
|
11
|
-
import { Captions as z, CaptionsOff as B, Check as V, ChevronLeft as
|
|
12
|
-
import { Tooltip as
|
|
11
|
+
import { Captions as z, CaptionsOff as B, Check as V, ChevronLeft as H, ChevronRight as ee, Copy as U, Maximize as W, Minimize as G, Pause as te, Play as K, RotateCcw as q, Settings as ne, TriangleAlert as re, Volume1 as J, Volume2 as Y, 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 = M({
|
|
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: [...N,
|
|
48
|
+
}), ce = k({
|
|
49
|
+
features: [...N, se],
|
|
50
50
|
displayName: "MediaPlayer"
|
|
51
|
-
}),
|
|
51
|
+
}), X = ce.usePlayer, le = {
|
|
52
52
|
ar: () => import("./ar-CS4Yzfxw.js"),
|
|
53
53
|
cs: () => import("./cs-CxBZ1aTx.js"),
|
|
54
54
|
de: () => import("./de-DphEdq0O.js"),
|
|
@@ -75,7 +75,7 @@ var se = {
|
|
|
75
75
|
vi: () => import("./vi-oOaDECwu.js"),
|
|
76
76
|
"zh-Hans": () => import("./zh-Hans-IhL1Pl78.js"),
|
|
77
77
|
"zh-Hant": () => import("./zh-Hant-C5YyFjEc.js")
|
|
78
|
-
},
|
|
78
|
+
}, ue = Object.keys(le), de = (e) => {
|
|
79
79
|
try {
|
|
80
80
|
let t = new Intl.Locale(e), { language: n, script: r } = t.maximize();
|
|
81
81
|
return {
|
|
@@ -86,24 +86,24 @@ var se = {
|
|
|
86
86
|
} catch {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
},
|
|
90
|
-
let t =
|
|
89
|
+
}, Z = (e) => {
|
|
90
|
+
let t = de(e);
|
|
91
91
|
if (!t) return;
|
|
92
|
-
let n =
|
|
93
|
-
...
|
|
92
|
+
let n = ue.map((e) => ({
|
|
93
|
+
...de(e),
|
|
94
94
|
catalogue: e
|
|
95
95
|
}));
|
|
96
96
|
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;
|
|
97
|
-
},
|
|
98
|
-
let n =
|
|
99
|
-
return n || (n = Promise.all([import("@formatjs/intl"),
|
|
97
|
+
}, fe = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map(), me = (e, t) => {
|
|
98
|
+
let n = pe.get(e);
|
|
99
|
+
return n || (n = Promise.all([import("@formatjs/intl"), le[t]()]).then(([{ createIntl: t }, { default: n }]) => {
|
|
100
100
|
let r = t({
|
|
101
101
|
locale: e,
|
|
102
102
|
defaultLocale: "en",
|
|
103
103
|
messages: n
|
|
104
104
|
});
|
|
105
|
-
return
|
|
106
|
-
}), n.catch(() =>
|
|
105
|
+
return fe.set(e, r), r;
|
|
106
|
+
}), n.catch(() => pe.delete(e)), pe.set(e, n)), n;
|
|
107
107
|
}, he = (e) => {
|
|
108
108
|
try {
|
|
109
109
|
return Intl.getCanonicalLocales(e)[0];
|
|
@@ -121,17 +121,17 @@ var se = {
|
|
|
121
121
|
locale: r
|
|
122
122
|
};
|
|
123
123
|
}, _e = ge(void 0, void 0), ve = v(_e), Q = () => x(ve), ye = ({ language: e, children: t }) => {
|
|
124
|
-
let n = e ?
|
|
124
|
+
let n = e ? Z(e) : void 0, [, r] = T();
|
|
125
125
|
S(() => {
|
|
126
|
-
if (!e || !n ||
|
|
126
|
+
if (!e || !n || fe.has(e)) return;
|
|
127
127
|
let t = !1;
|
|
128
|
-
return
|
|
128
|
+
return me(e, n).then((e) => {
|
|
129
129
|
t || r(e);
|
|
130
130
|
}, () => {}), () => {
|
|
131
131
|
t = !0;
|
|
132
132
|
};
|
|
133
133
|
}, [e, n]);
|
|
134
|
-
let i = e && n ?
|
|
134
|
+
let i = e && n ? fe.get(e) : void 0, a = C(() => e ? ge(i, e) : _e, [i, e]);
|
|
135
135
|
return /* @__PURE__ */ I(ve.Provider, {
|
|
136
136
|
value: a,
|
|
137
137
|
children: t
|
|
@@ -177,57 +177,57 @@ var se = {
|
|
|
177
177
|
}
|
|
178
178
|
return t.length ? t.join("\n") : void 0;
|
|
179
179
|
}, Ae = (e, t, n, r) => {
|
|
180
|
-
let a =
|
|
181
|
-
|
|
182
|
-
let [
|
|
180
|
+
let a = X(), { read: o, size: c, publicPath: l = "", libavWorkerUrl: p = "", jassubWorkerUrl: m = "", jassubWasmUrl: h = "", jassubWasmWorkerUrl: g = "", jassubLegacyWasmUrl: _, jassubLegacyWasmWorkerUrl: v, defaultFontUrl: y, cjkFontUrl: x, bufferSize: C, autoplay: E = !1, chapters: D, seekPrepareBudgetMs: O = Ee } = n ?? {}, k = w(D);
|
|
181
|
+
k.current = D;
|
|
182
|
+
let [A, j] = T(), M = A && A.size === c ? A.streamIndex : void 0, [N, P] = T(0), F = w({
|
|
183
183
|
count: 0,
|
|
184
184
|
at: 0
|
|
185
|
-
}),
|
|
186
|
-
S(() => (
|
|
185
|
+
}), I = w(void 0);
|
|
186
|
+
S(() => (F.current = {
|
|
187
187
|
count: 0,
|
|
188
188
|
at: 0
|
|
189
189
|
}, a.setSourceState({ playbackErrors: [] }), () => {
|
|
190
|
-
|
|
190
|
+
I.current && clearTimeout(I.current);
|
|
191
191
|
}), [c]);
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
let
|
|
192
|
+
let L = w(null), R = w(null), z = w(void 0), B = w(c);
|
|
193
|
+
B.current = c;
|
|
194
|
+
let V = w({
|
|
195
195
|
audio: [],
|
|
196
196
|
subtitles: []
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
let
|
|
197
|
+
}), H = b(() => V.current.audio.find((e) => e.streamIndex === a.selectedAudioTrack), [a]), ee = w(o);
|
|
198
|
+
ee.current = o;
|
|
199
|
+
let U = {
|
|
200
200
|
audio: n?.preferredAudioLanguage,
|
|
201
201
|
original: n?.originalLanguage,
|
|
202
202
|
subtitles: n?.preferredSubtitleLanguage,
|
|
203
203
|
alwaysSubtitles: n?.alwaysShowSubtitles
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
let
|
|
207
|
-
|
|
208
|
-
let
|
|
209
|
-
|
|
210
|
-
let
|
|
211
|
-
|
|
212
|
-
let
|
|
213
|
-
|
|
214
|
-
let
|
|
215
|
-
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
-
let
|
|
219
|
-
|
|
220
|
-
let { audio: e, subtitles: t } =
|
|
221
|
-
t.length && a.setSourceState({ subtitleTracks: Ce(t,
|
|
222
|
-
}, [a,
|
|
204
|
+
}, W = w(U);
|
|
205
|
+
W.current = U;
|
|
206
|
+
let G = w(n?.onPreferredAudioLanguageChange);
|
|
207
|
+
G.current = n?.onPreferredAudioLanguageChange;
|
|
208
|
+
let te = w(n?.onPreferredSubtitleLanguageChange);
|
|
209
|
+
te.current = n?.onPreferredSubtitleLanguageChange;
|
|
210
|
+
let K = w(n?.onAlwaysShowSubtitlesChange);
|
|
211
|
+
K.current = n?.onAlwaysShowSubtitlesChange;
|
|
212
|
+
let q = w(n?.onSeek);
|
|
213
|
+
q.current = n?.onSeek;
|
|
214
|
+
let ne = w(n?.onPlaybackError);
|
|
215
|
+
ne.current = n?.onPlaybackError;
|
|
216
|
+
let re = w(r);
|
|
217
|
+
re.current = r;
|
|
218
|
+
let J = Q(), Y = w(J);
|
|
219
|
+
Y.current = J, S(() => {
|
|
220
|
+
let { audio: e, subtitles: t } = V.current;
|
|
221
|
+
t.length && a.setSourceState({ subtitleTracks: Ce(t, J) }), e.length && a.setSourceState({ audioTracks: Ce(e, J) });
|
|
222
|
+
}, [a, J]);
|
|
223
223
|
let ie = b((e) => {
|
|
224
224
|
let t = typeof e == "number" ? e : void 0, n = a.selectedSubtitleTrack === void 0;
|
|
225
|
-
|
|
226
|
-
let r =
|
|
227
|
-
i !== void 0 &&
|
|
228
|
-
}, [a,
|
|
229
|
-
let t =
|
|
230
|
-
if (!t ||
|
|
225
|
+
z.current = B.current, a.setSourceState({ selectedSubtitleTrack: t }), L.current?.selectSubtitleStream(t);
|
|
226
|
+
let r = V.current.subtitles.find((e) => e.streamIndex === t), i = t === void 0 ? null : u(r) ?? (n ? r?.title?.trim() || "und" : void 0);
|
|
227
|
+
i !== void 0 && te.current?.(i), i && d(H(), i) && K.current?.(!0);
|
|
228
|
+
}, [a, H]), ae = b((e) => {
|
|
229
|
+
let t = L.current;
|
|
230
|
+
if (!t || O <= 0) {
|
|
231
231
|
a.seek(e);
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
@@ -245,30 +245,30 @@ var se = {
|
|
|
245
245
|
c?.addEventListener("seeked", l);
|
|
246
246
|
let d = setTimeout(() => {
|
|
247
247
|
o = "deadline", s();
|
|
248
|
-
},
|
|
248
|
+
}, O);
|
|
249
249
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
250
250
|
clearTimeout(d), s();
|
|
251
251
|
});
|
|
252
|
-
}, [a,
|
|
253
|
-
if (typeof e != "number" ||
|
|
254
|
-
a.setSourceState({ selectedAudioTrack: e }),
|
|
255
|
-
size:
|
|
252
|
+
}, [a, O]), oe = b((e) => {
|
|
253
|
+
if (typeof e != "number" || B.current === void 0) return;
|
|
254
|
+
a.setSourceState({ selectedAudioTrack: e }), j({
|
|
255
|
+
size: B.current,
|
|
256
256
|
streamIndex: e
|
|
257
257
|
});
|
|
258
|
-
let t = u(
|
|
259
|
-
t !== void 0 &&
|
|
260
|
-
}, [a]),
|
|
258
|
+
let t = u(V.current.audio.find((t) => t.streamIndex === e));
|
|
259
|
+
t !== void 0 && G.current?.(t);
|
|
260
|
+
}, [a]), se = X((e) => e.setSourceState);
|
|
261
261
|
S(() => {
|
|
262
|
-
|
|
262
|
+
se({
|
|
263
263
|
selectSubtitleTrack: ie,
|
|
264
|
-
selectAudioTrack:
|
|
265
|
-
requestSeek:
|
|
264
|
+
selectAudioTrack: oe,
|
|
265
|
+
requestSeek: ae
|
|
266
266
|
});
|
|
267
267
|
}, [
|
|
268
|
-
|
|
268
|
+
se,
|
|
269
269
|
ie,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
oe,
|
|
271
|
+
ae
|
|
272
272
|
]), S(() => {
|
|
273
273
|
if (!e || !t || !c || !o) return;
|
|
274
274
|
let n = !1;
|
|
@@ -302,60 +302,62 @@ var se = {
|
|
|
302
302
|
let t = i(e);
|
|
303
303
|
if (r(e, t), t) {
|
|
304
304
|
let t = performance.now();
|
|
305
|
-
t -
|
|
305
|
+
t - F.current.at > Te && (F.current = {
|
|
306
306
|
count: 0,
|
|
307
307
|
at: t
|
|
308
308
|
});
|
|
309
|
-
let n = we[Math.min(
|
|
310
|
-
|
|
311
|
-
count:
|
|
309
|
+
let n = we[Math.min(F.current.count, we.length - 1)];
|
|
310
|
+
F.current = {
|
|
311
|
+
count: F.current.count + 1,
|
|
312
312
|
at: t
|
|
313
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
313
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), I.current && clearTimeout(I.current), I.current = setTimeout(() => P((e) => e + 1), n);
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
316
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), ne.current?.(e);
|
|
317
317
|
};
|
|
318
318
|
return (async () => {
|
|
319
319
|
try {
|
|
320
320
|
let r = await s({
|
|
321
321
|
videoElement: e,
|
|
322
322
|
subtitleContainer: t,
|
|
323
|
-
read: (e, t) =>
|
|
323
|
+
read: (e, t) => ee.current(e, t),
|
|
324
324
|
length: c,
|
|
325
325
|
publicPath: l,
|
|
326
326
|
libavWorkerUrl: p,
|
|
327
327
|
jassubWorkerUrl: m,
|
|
328
328
|
jassubWasmUrl: h,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
jassubWasmWorkerUrl: g,
|
|
330
|
+
jassubLegacyWasmUrl: _,
|
|
331
|
+
jassubLegacyWasmWorkerUrl: v,
|
|
332
|
+
defaultFontUrl: y,
|
|
333
|
+
cjkFontUrl: x,
|
|
334
|
+
bufferSize: C,
|
|
335
|
+
audioStreamIndex: M,
|
|
336
|
+
chooseAudioStream: (e) => e[f(e, [], W.current).audio]?.streamIndex,
|
|
335
337
|
onReady: () => {
|
|
336
338
|
if (n) return;
|
|
337
339
|
a.setSourceState({ ready: !0 });
|
|
338
|
-
let t =
|
|
339
|
-
|
|
340
|
+
let t = R.current;
|
|
341
|
+
R.current = null, t && t.size === c && t.time > 0 && (e.currentTime = t.time), E && e.play().catch(() => {});
|
|
340
342
|
},
|
|
341
343
|
onError: u,
|
|
342
344
|
onRecovered: () => {
|
|
343
345
|
n || a.setSourceState({ playbackError: null });
|
|
344
346
|
},
|
|
345
|
-
onSeek: (e) =>
|
|
346
|
-
onOutput: (e) =>
|
|
347
|
+
onSeek: (e) => q.current?.(e),
|
|
348
|
+
onOutput: (e) => re.current?.(e),
|
|
347
349
|
onSubtitleStreams: (e) => {
|
|
348
350
|
if (n) return;
|
|
349
|
-
|
|
350
|
-
let t =
|
|
351
|
+
V.current.subtitles = e;
|
|
352
|
+
let t = H(), r = f(t ? [t] : [], e, W.current).subtitles;
|
|
351
353
|
a.setSourceState({
|
|
352
|
-
subtitleTracks: Ce(e,
|
|
353
|
-
...
|
|
354
|
+
subtitleTracks: Ce(e, Y.current),
|
|
355
|
+
...z.current === c ? {} : { selectedSubtitleTrack: r === null ? void 0 : e[Math.max(r, 0)]?.streamIndex }
|
|
354
356
|
});
|
|
355
357
|
},
|
|
356
358
|
onAudioStreams: (e, t) => {
|
|
357
|
-
n || (
|
|
358
|
-
audioTracks: Ce(e,
|
|
359
|
+
n || (V.current.audio = e, a.setSourceState({
|
|
360
|
+
audioTracks: Ce(e, Y.current),
|
|
359
361
|
selectedAudioTrack: t
|
|
360
362
|
}));
|
|
361
363
|
}
|
|
@@ -364,9 +366,9 @@ var se = {
|
|
|
364
366
|
r.destroy();
|
|
365
367
|
return;
|
|
366
368
|
}
|
|
367
|
-
|
|
369
|
+
L.current = r, a.setSourceState({
|
|
368
370
|
indexes: r.indexes,
|
|
369
|
-
chapters:
|
|
371
|
+
chapters: k.current ?? r.chapters
|
|
370
372
|
});
|
|
371
373
|
let i = a.selectedSubtitleTrack;
|
|
372
374
|
r.selectSubtitleStream(typeof i == "number" ? i : void 0);
|
|
@@ -374,14 +376,14 @@ var se = {
|
|
|
374
376
|
u(e);
|
|
375
377
|
}
|
|
376
378
|
})(), () => {
|
|
377
|
-
n = !0,
|
|
379
|
+
n = !0, R.current = {
|
|
378
380
|
time: e.currentTime,
|
|
379
381
|
size: c
|
|
380
|
-
},
|
|
382
|
+
}, L.current?.destroy(), L.current = null, a.setSourceState({ ready: !1 });
|
|
381
383
|
};
|
|
382
384
|
}, [
|
|
383
385
|
a,
|
|
384
|
-
|
|
386
|
+
H,
|
|
385
387
|
e,
|
|
386
388
|
t,
|
|
387
389
|
c,
|
|
@@ -393,9 +395,11 @@ var se = {
|
|
|
393
395
|
_,
|
|
394
396
|
v,
|
|
395
397
|
y,
|
|
396
|
-
A,
|
|
397
398
|
x,
|
|
398
|
-
|
|
399
|
+
C,
|
|
400
|
+
M,
|
|
401
|
+
E,
|
|
402
|
+
N
|
|
399
403
|
]);
|
|
400
404
|
}, je = 1001 / 24e3, Me = (e, t) => new Promise((n) => {
|
|
401
405
|
let r = setTimeout(n, t);
|
|
@@ -419,7 +423,7 @@ var se = {
|
|
|
419
423
|
};
|
|
420
424
|
return r;
|
|
421
425
|
}, Pe = (e, t) => {
|
|
422
|
-
let n =
|
|
426
|
+
let n = X(), r = X((e) => e.setSourceState), i = w(t);
|
|
423
427
|
i.current = t;
|
|
424
428
|
let a = !!t;
|
|
425
429
|
S(() => {
|
|
@@ -686,7 +690,7 @@ var se = {
|
|
|
686
690
|
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
687
691
|
p.onmessage = ({ data: e }) => {
|
|
688
692
|
if (e.type === "unsupported") {
|
|
689
|
-
|
|
693
|
+
G();
|
|
690
694
|
return;
|
|
691
695
|
}
|
|
692
696
|
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
@@ -740,7 +744,7 @@ var se = {
|
|
|
740
744
|
run: D,
|
|
741
745
|
finished: e
|
|
742
746
|
}), await t;
|
|
743
|
-
},
|
|
747
|
+
}, H = async (e) => {
|
|
744
748
|
if (A = e.pts + e.duration, !e.data.byteLength) return;
|
|
745
749
|
let t = v("ack", D);
|
|
746
750
|
p.postMessage({
|
|
@@ -748,7 +752,7 @@ var se = {
|
|
|
748
752
|
run: D,
|
|
749
753
|
data: e.data
|
|
750
754
|
}, [e.data]), await t;
|
|
751
|
-
},
|
|
755
|
+
}, ee = async (t) => {
|
|
752
756
|
if (B = await P({
|
|
753
757
|
publicPath: t.publicPath,
|
|
754
758
|
workerUrl: t.libavWorkerUrl,
|
|
@@ -781,7 +785,7 @@ var se = {
|
|
|
781
785
|
let e = await L(B.read());
|
|
782
786
|
if (a) return;
|
|
783
787
|
if (!e) continue;
|
|
784
|
-
await
|
|
788
|
+
await H(e), e.finished && await V(!0);
|
|
785
789
|
} else {
|
|
786
790
|
await V(!1), j.set(Math.round(e * 10), g);
|
|
787
791
|
let t = B.seek(Math.max(0, e - Ze));
|
|
@@ -795,7 +799,7 @@ var se = {
|
|
|
795
799
|
pts: n.timestampOffset,
|
|
796
800
|
from: r.pts,
|
|
797
801
|
start: r.pts <= 0
|
|
798
|
-
}), await
|
|
802
|
+
}), await H(r), r.finished && await V(!0);
|
|
799
803
|
}
|
|
800
804
|
} catch {
|
|
801
805
|
if (a) return;
|
|
@@ -804,7 +808,7 @@ var se = {
|
|
|
804
808
|
}
|
|
805
809
|
e(B), B = void 0;
|
|
806
810
|
}
|
|
807
|
-
},
|
|
811
|
+
}, U = () => {}, W = (e, t) => {
|
|
808
812
|
let n = !1, r = (e) => {
|
|
809
813
|
n && p.postMessage({
|
|
810
814
|
type: "end",
|
|
@@ -812,7 +816,7 @@ var se = {
|
|
|
812
816
|
finished: e
|
|
813
817
|
}), n = !1;
|
|
814
818
|
};
|
|
815
|
-
|
|
819
|
+
U = e.attach(t, (e, t) => {
|
|
816
820
|
if (e.type === "init") {
|
|
817
821
|
r(!1);
|
|
818
822
|
let t = e.data.slice(0);
|
|
@@ -839,22 +843,22 @@ var se = {
|
|
|
839
843
|
}, [t]);
|
|
840
844
|
}
|
|
841
845
|
});
|
|
842
|
-
},
|
|
846
|
+
}, G = () => {
|
|
843
847
|
if (!a) {
|
|
844
848
|
a = !0, f(!0), l(), clearInterval(C);
|
|
845
849
|
for (let e of w) n.removeEventListener(e, x);
|
|
846
|
-
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z),
|
|
850
|
+
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z), U(), B && e(B), p.terminate(), t.port.postMessage({ analysis: null });
|
|
847
851
|
for (let e of _.values()) e(h);
|
|
848
852
|
_.clear();
|
|
849
853
|
}
|
|
850
854
|
};
|
|
851
|
-
return "tap" in i ?
|
|
852
|
-
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e),
|
|
855
|
+
return "tap" in i ? W(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
|
|
856
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), G());
|
|
853
857
|
}), S(), {
|
|
854
858
|
update: (e) => {
|
|
855
859
|
o = e, f(!1);
|
|
856
860
|
},
|
|
857
|
-
stop:
|
|
861
|
+
stop: G
|
|
858
862
|
};
|
|
859
863
|
}, et = (e, t, n, r, i) => {
|
|
860
864
|
let a = w(null), [o, s] = T(!1), [c, l] = T(null);
|
|
@@ -1026,7 +1030,7 @@ var se = {
|
|
|
1026
1030
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1027
1031
|
pointer-events: none;
|
|
1028
1032
|
`, 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 }) => {
|
|
1029
|
-
let t = Q(), n =
|
|
1033
|
+
let t = Q(), n = X((e) => e.title), r = X((e) => e.hideUI), i = X((e) => e.playbackError), a = X((e) => e.ready), o = X((e) => e.size), s = X((e) => e.waiting), c = X((e) => e.seekingTo);
|
|
1030
1034
|
return /* @__PURE__ */ L(F, { children: [
|
|
1031
1035
|
n ? /* @__PURE__ */ I("div", {
|
|
1032
1036
|
className: "title",
|
|
@@ -1135,7 +1139,7 @@ var se = {
|
|
|
1135
1139
|
"data-tooltip-delay-hide": i,
|
|
1136
1140
|
"data-tooltip-place": o,
|
|
1137
1141
|
children: n
|
|
1138
|
-
}), !s && /* @__PURE__ */ I(
|
|
1142
|
+
}), !s && /* @__PURE__ */ I(ae, {
|
|
1139
1143
|
ref: u,
|
|
1140
1144
|
css: _t(c),
|
|
1141
1145
|
id: e,
|
|
@@ -1401,7 +1405,7 @@ var se = {
|
|
|
1401
1405
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1402
1406
|
}
|
|
1403
1407
|
`, Tt = 4, Et = () => {
|
|
1404
|
-
let e =
|
|
1408
|
+
let e = X(), t = X((e) => e.currentTime), n = X((e) => e.requestSeek), r = X((e) => e.duration), i = X((e) => e.size), a = X((e) => e.downloadedRanges), o = X((e) => e.buffered), s = X((e) => e.indexes), c = X((e) => e.thumbnails), l = X((e) => e.thumbnailAt), u = X((e) => e.requestThumbnail), d = X((e) => e.chapters), f = X((e) => e.seekingTo), h = X((e) => e.setSourceState), g = X((e) => e.hideUI), _ = w(null), [v, y] = T(void 0), [b, x] = T(void 0), E = (e) => {
|
|
1405
1409
|
x(e), u(e);
|
|
1406
1410
|
}, D = !!b;
|
|
1407
1411
|
S(() => {
|
|
@@ -1435,11 +1439,11 @@ var se = {
|
|
|
1435
1439
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
1436
1440
|
}, B = w("mouse"), V = (e) => {
|
|
1437
1441
|
B.current = e.pointerType;
|
|
1438
|
-
},
|
|
1442
|
+
}, H = (e) => {
|
|
1439
1443
|
B.current !== "touch" && E(z(e.clientX));
|
|
1440
|
-
},
|
|
1444
|
+
}, ee = () => {
|
|
1441
1445
|
_.current && E(void 0);
|
|
1442
|
-
},
|
|
1446
|
+
}, U = (e) => r ? e / r * 100 : 0, W = (e, t, n) => {
|
|
1443
1447
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1444
1448
|
return /* @__PURE__ */ I("div", {
|
|
1445
1449
|
className: "loaded-part",
|
|
@@ -1448,10 +1452,10 @@ var se = {
|
|
|
1448
1452
|
marginLeft: `${i}%`
|
|
1449
1453
|
}
|
|
1450
1454
|
}, e);
|
|
1451
|
-
},
|
|
1455
|
+
}, G = C(() => i === void 0 ? r ? o.map(([e, t], n) => W(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1452
1456
|
if (!i || !r) return null;
|
|
1453
1457
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1454
|
-
return !a || !o ? null :
|
|
1458
|
+
return !a || !o ? null : W(t, a.timestamp / r, o.timestamp / r);
|
|
1455
1459
|
}) ?? [], [
|
|
1456
1460
|
r,
|
|
1457
1461
|
i,
|
|
@@ -1467,7 +1471,7 @@ var se = {
|
|
|
1467
1471
|
v,
|
|
1468
1472
|
r
|
|
1469
1473
|
]);
|
|
1470
|
-
let
|
|
1474
|
+
let te = C(() => {
|
|
1471
1475
|
if (!r) return 0;
|
|
1472
1476
|
if (N && v !== void 0) return v;
|
|
1473
1477
|
let e = f ?? t;
|
|
@@ -1478,22 +1482,22 @@ var se = {
|
|
|
1478
1482
|
N,
|
|
1479
1483
|
v,
|
|
1480
1484
|
f
|
|
1481
|
-
]),
|
|
1482
|
-
if (!
|
|
1483
|
-
let e = b / r * 100, t =
|
|
1484
|
-
return t >= 0 ? t :
|
|
1485
|
+
]), K = C(() => p(d, r), [d, r]), q = K.length > 0, ne = C(() => {
|
|
1486
|
+
if (!q || b === void 0 || !r) return -1;
|
|
1487
|
+
let e = b / r * 100, t = K.findIndex((t, n) => n < K.length - 1 && e >= t && e < K[n + 1]);
|
|
1488
|
+
return t >= 0 ? t : K.length - 2;
|
|
1485
1489
|
}, [
|
|
1486
|
-
|
|
1487
|
-
|
|
1490
|
+
q,
|
|
1491
|
+
K,
|
|
1488
1492
|
b,
|
|
1489
1493
|
r
|
|
1490
|
-
]),
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
]),
|
|
1494
|
+
]), re = C(() => q ? m(K, (e) => e !== ne) : void 0, [
|
|
1495
|
+
q,
|
|
1496
|
+
K,
|
|
1497
|
+
ne
|
|
1498
|
+
]), J = C(() => ne >= 0 ? m(K, (e) => e === ne) : void 0, [K, ne]), Y = C(() => {
|
|
1495
1499
|
if (b !== void 0) return d.find(({ start: e, end: t }) => e <= b && b < t);
|
|
1496
|
-
}, [d, b]),
|
|
1500
|
+
}, [d, b]), ie = C(() => {
|
|
1497
1501
|
if (b) {
|
|
1498
1502
|
if (l) return l(b);
|
|
1499
1503
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
|
|
@@ -1502,20 +1506,20 @@ var se = {
|
|
|
1502
1506
|
c,
|
|
1503
1507
|
l,
|
|
1504
1508
|
b
|
|
1505
|
-
]),
|
|
1509
|
+
]), ae = (e, t) => /* @__PURE__ */ L("div", {
|
|
1506
1510
|
className: e ? `track ${e}` : "track",
|
|
1507
1511
|
style: t ? { maskImage: t } : void 0,
|
|
1508
1512
|
children: [
|
|
1509
1513
|
/* @__PURE__ */ I("div", { className: "background-bar" }),
|
|
1510
1514
|
/* @__PURE__ */ I("div", {
|
|
1511
1515
|
className: "loaded",
|
|
1512
|
-
children:
|
|
1516
|
+
children: G
|
|
1513
1517
|
}),
|
|
1514
1518
|
/* @__PURE__ */ I("div", {
|
|
1515
1519
|
className: "play-container",
|
|
1516
1520
|
children: /* @__PURE__ */ I("div", {
|
|
1517
1521
|
className: "play",
|
|
1518
|
-
style: { transform: `scaleX(${
|
|
1522
|
+
style: { transform: `scaleX(${te})` }
|
|
1519
1523
|
})
|
|
1520
1524
|
})
|
|
1521
1525
|
]
|
|
@@ -1526,31 +1530,31 @@ var se = {
|
|
|
1526
1530
|
className: [
|
|
1527
1531
|
"progress-bar",
|
|
1528
1532
|
N ? "dragging" : "",
|
|
1529
|
-
|
|
1533
|
+
q ? "segmented" : ""
|
|
1530
1534
|
].filter(Boolean).join(" "),
|
|
1531
1535
|
onPointerDown: V,
|
|
1532
1536
|
onPointerMove: V,
|
|
1533
|
-
onMouseMove:
|
|
1534
|
-
onMouseOut:
|
|
1537
|
+
onMouseMove: H,
|
|
1538
|
+
onMouseOut: ee,
|
|
1535
1539
|
children: [
|
|
1536
|
-
|
|
1540
|
+
ae(void 0, re),
|
|
1537
1541
|
b ? /* @__PURE__ */ L("div", {
|
|
1538
1542
|
className: "cursor-time",
|
|
1539
1543
|
style: {
|
|
1540
|
-
left:
|
|
1541
|
-
maxWidth:
|
|
1544
|
+
left: Y ? `clamp(var(--thumbnail-half), ${U(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${U(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1545
|
+
maxWidth: Y ? "var(--thumbnail-width)" : void 0
|
|
1542
1546
|
},
|
|
1543
1547
|
children: [/* @__PURE__ */ I("span", {
|
|
1544
1548
|
className: "cursor-time-value",
|
|
1545
1549
|
children: ht(b)
|
|
1546
|
-
}),
|
|
1550
|
+
}), Y ? /* @__PURE__ */ I("span", {
|
|
1547
1551
|
className: "chapter-title",
|
|
1548
|
-
children:
|
|
1552
|
+
children: Y.title
|
|
1549
1553
|
}) : void 0]
|
|
1550
1554
|
}) : void 0,
|
|
1551
1555
|
/* @__PURE__ */ I("div", { className: "progress" }),
|
|
1552
1556
|
/* @__PURE__ */ I("div", { className: "hover" }),
|
|
1553
|
-
|
|
1557
|
+
J ? ae("focus", J) : void 0,
|
|
1554
1558
|
/* @__PURE__ */ I("div", { className: "scrubber" }),
|
|
1555
1559
|
/* @__PURE__ */ I("div", {
|
|
1556
1560
|
className: "padding",
|
|
@@ -1561,8 +1565,8 @@ var se = {
|
|
|
1561
1565
|
}),
|
|
1562
1566
|
/* @__PURE__ */ I("div", {
|
|
1563
1567
|
className: "thumbnail",
|
|
1564
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
1565
|
-
children:
|
|
1568
|
+
style: { left: `clamp(var(--thumbnail-half), ${U(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1569
|
+
children: ie?.url ? /* @__PURE__ */ I("img", { src: ie.url }) : void 0
|
|
1566
1570
|
})
|
|
1567
1571
|
]
|
|
1568
1572
|
});
|
|
@@ -1751,7 +1755,7 @@ var se = {
|
|
|
1751
1755
|
/* @__PURE__ */ L("div", {
|
|
1752
1756
|
className: i ? "back" : "back no-hover",
|
|
1753
1757
|
onClick: i,
|
|
1754
|
-
children: [i ? /* @__PURE__ */ I(
|
|
1758
|
+
children: [i ? /* @__PURE__ */ I(H, {}) : null, /* @__PURE__ */ I("span", { children: e })]
|
|
1755
1759
|
}),
|
|
1756
1760
|
c ? /* @__PURE__ */ I("div", {
|
|
1757
1761
|
className: "no-hover failed",
|
|
@@ -1899,7 +1903,7 @@ ${jt}
|
|
|
1899
1903
|
e.detail
|
|
1900
1904
|
].filter(Boolean).join("\n");
|
|
1901
1905
|
}).join("\n\n"), zt = () => {
|
|
1902
|
-
let e =
|
|
1906
|
+
let e = X((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } = Nt(), [s, c] = T(!1);
|
|
1903
1907
|
if (e.length === 0) return null;
|
|
1904
1908
|
let l = () => {
|
|
1905
1909
|
navigator.clipboard?.writeText(Rt(e)).then(() => {
|
|
@@ -1918,7 +1922,7 @@ ${jt}
|
|
|
1918
1922
|
onClick: i,
|
|
1919
1923
|
"aria-label": u,
|
|
1920
1924
|
"aria-expanded": r,
|
|
1921
|
-
children: /* @__PURE__ */ I(
|
|
1925
|
+
children: /* @__PURE__ */ I(re, { className: "alert-triangle" })
|
|
1922
1926
|
}),
|
|
1923
1927
|
toolTipText: /* @__PURE__ */ I("span", { children: u })
|
|
1924
1928
|
}), r && /* @__PURE__ */ L("div", {
|
|
@@ -1930,7 +1934,7 @@ ${jt}
|
|
|
1930
1934
|
type: "button",
|
|
1931
1935
|
onClick: l,
|
|
1932
1936
|
"aria-label": t(a.copyErrors),
|
|
1933
|
-
children: [I(s ? V :
|
|
1937
|
+
children: [I(s ? V : U, {}), /* @__PURE__ */ I("span", { children: t(s ? a.copied : a.copy) })]
|
|
1934
1938
|
})]
|
|
1935
1939
|
}), e.map((e, r) => /* @__PURE__ */ L("div", {
|
|
1936
1940
|
className: "entry no-hover",
|
|
@@ -2016,7 +2020,7 @@ width: 100%;
|
|
|
2016
2020
|
}
|
|
2017
2021
|
}
|
|
2018
2022
|
`, Vt = () => {
|
|
2019
|
-
let e =
|
|
2023
|
+
let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = w(null), o = w(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({
|
|
2020
2024
|
ref: o,
|
|
2021
2025
|
onChange: (t) => e.setPlaybackRate(f(t))
|
|
2022
2026
|
}), m = (t) => {
|
|
@@ -2153,7 +2157,7 @@ ${jt}
|
|
|
2153
2157
|
1.5,
|
|
2154
2158
|
2
|
|
2155
2159
|
], Wt = () => {
|
|
2156
|
-
let e =
|
|
2160
|
+
let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = X((e) => e.audioTracks), o = X((e) => e.selectedAudioTrack), s = X((e) => e.selectAudioTrack), c = X((e) => e.quality), l = X((e) => e.volumeNormalizer), [u, d] = T(0), { open: f, toggle: p, containerRef: m, pending: h, failed: g, runSelect: _ } = Nt({ onReset: () => d(0) }), v = (t) => {
|
|
2157
2161
|
e.setPlaybackRate(t), d(0);
|
|
2158
2162
|
}, y = (e) => {
|
|
2159
2163
|
e !== void 0 && _(e, () => s(e));
|
|
@@ -2175,7 +2179,7 @@ ${jt}
|
|
|
2175
2179
|
onClick: p,
|
|
2176
2180
|
"aria-label": t(a.settings),
|
|
2177
2181
|
"aria-expanded": f,
|
|
2178
|
-
children: /* @__PURE__ */ I(
|
|
2182
|
+
children: /* @__PURE__ */ I(ne, {})
|
|
2179
2183
|
}),
|
|
2180
2184
|
toolTipText: /* @__PURE__ */ I("span", { children: t(a.settings) })
|
|
2181
2185
|
}),
|
|
@@ -2184,14 +2188,14 @@ ${jt}
|
|
|
2184
2188
|
children: [
|
|
2185
2189
|
i.length > 1 ? /* @__PURE__ */ L("div", {
|
|
2186
2190
|
onClick: C(2),
|
|
2187
|
-
children: [/* @__PURE__ */ I("div", { children: t(a.audio) }), /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(
|
|
2191
|
+
children: [/* @__PURE__ */ I("div", { children: t(a.audio) }), /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(ee, {}) })]
|
|
2188
2192
|
}) : null,
|
|
2189
2193
|
x > 1 ? /* @__PURE__ */ L("div", {
|
|
2190
2194
|
onClick: C(3),
|
|
2191
2195
|
children: [/* @__PURE__ */ I("div", { children: t(a.quality) }), /* @__PURE__ */ L("div", { children: [S ? /* @__PURE__ */ I("span", {
|
|
2192
2196
|
className: "secondary",
|
|
2193
2197
|
children: S
|
|
2194
|
-
}) : null, /* @__PURE__ */ I(
|
|
2198
|
+
}) : null, /* @__PURE__ */ I(ee, {})] })]
|
|
2195
2199
|
}) : null,
|
|
2196
2200
|
/* @__PURE__ */ L("div", {
|
|
2197
2201
|
onClick: C(1),
|
|
@@ -2201,7 +2205,7 @@ ${jt}
|
|
|
2201
2205
|
minimumFractionDigits: 2,
|
|
2202
2206
|
maximumFractionDigits: 2
|
|
2203
2207
|
})
|
|
2204
|
-
}), /* @__PURE__ */ I(
|
|
2208
|
+
}), /* @__PURE__ */ I(ee, {})] })]
|
|
2205
2209
|
}),
|
|
2206
2210
|
l ? /* @__PURE__ */ L("div", {
|
|
2207
2211
|
role: "switch",
|
|
@@ -2224,7 +2228,7 @@ ${jt}
|
|
|
2224
2228
|
/* @__PURE__ */ L("div", {
|
|
2225
2229
|
className: "back",
|
|
2226
2230
|
onClick: C(0),
|
|
2227
|
-
children: [/* @__PURE__ */ I(
|
|
2231
|
+
children: [/* @__PURE__ */ I(H, {}), /* @__PURE__ */ I("span", { children: t(a.playbackSpeed) })]
|
|
2228
2232
|
}),
|
|
2229
2233
|
/* @__PURE__ */ I("div", {
|
|
2230
2234
|
className: "slider no-hover",
|
|
@@ -2278,7 +2282,7 @@ position: static;
|
|
|
2278
2282
|
|
|
2279
2283
|
${jt}
|
|
2280
2284
|
`, Kt = () => {
|
|
2281
|
-
let { format: e } = Q(), t =
|
|
2285
|
+
let { format: e } = Q(), t = X((e) => e.subtitleTracks), n = X((e) => e.selectedSubtitleTrack), r = X((e) => e.selectSubtitleTrack), i = X((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } = Nt();
|
|
2282
2286
|
if (t.length === 0) return null;
|
|
2283
2287
|
let f = n !== void 0;
|
|
2284
2288
|
return /* @__PURE__ */ L("div", {
|
|
@@ -2357,7 +2361,7 @@ ${jt}
|
|
|
2357
2361
|
height: 10px;
|
|
2358
2362
|
}
|
|
2359
2363
|
`, Yt = ({ value: e, onChange: t }) => {
|
|
2360
|
-
let { number: n } = Q(), r =
|
|
2364
|
+
let { number: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), a = w(null), o = w(null), { handlers: s } = Ct({
|
|
2361
2365
|
ref: o,
|
|
2362
2366
|
onChange: t
|
|
2363
2367
|
}), c = (n) => {
|
|
@@ -2459,7 +2463,7 @@ ${jt}
|
|
|
2459
2463
|
}
|
|
2460
2464
|
|
|
2461
2465
|
`, Zt = ({ ref: e }) => {
|
|
2462
|
-
let t =
|
|
2466
|
+
let t = X(), { format: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), o = C(() => mt(r), [r]);
|
|
2463
2467
|
return /* @__PURE__ */ L("div", {
|
|
2464
2468
|
css: Xt,
|
|
2465
2469
|
children: [/* @__PURE__ */ I(St, {
|
|
@@ -2471,7 +2475,7 @@ ${jt}
|
|
|
2471
2475
|
ref: e,
|
|
2472
2476
|
"aria-label": n(a.mute),
|
|
2473
2477
|
"aria-pressed": i || r === 0,
|
|
2474
|
-
children: I(i || r === 0 ?
|
|
2478
|
+
children: I(i || r === 0 ? ie : r <= .5 ? J : Y, {
|
|
2475
2479
|
size: 18,
|
|
2476
2480
|
color: "#fff"
|
|
2477
2481
|
})
|
|
@@ -2621,9 +2625,9 @@ ${jt}
|
|
|
2621
2625
|
}
|
|
2622
2626
|
}
|
|
2623
2627
|
`, rn = ({ shortcuts: e = "window", root: t, fullscreen: n }) => {
|
|
2624
|
-
let r =
|
|
2628
|
+
let r = X(), { format: i } = Q(), o = X((e) => e.paused), s = X((e) => e.currentTime), c = X((e) => e.duration), l = X((e) => e.seekingTo), u = X((e) => e.fullscreen), d = n ? n.active : u, f = w(n);
|
|
2625
2629
|
f.current = n;
|
|
2626
|
-
let p =
|
|
2630
|
+
let p = X((e) => e.hideUI), m = X((e) => e.togglePictureInPicture), h = X((e) => e.pictureInPictureMode), g = X((e) => e.burnedInSubtitles), _ = X((e) => e.passThroughPictureInPicture), v = X((e) => e.subtitleTracks), y = X((e) => e.requestSeek), x = X((e) => e.stepFrame), [C, E] = T(null), D = w(null), O = w(void 0), k = h === "burn-in", A = v.length > 0, j = c > 0 && s === c, M = b(({ direction: e, stepSize: t }) => {
|
|
2627
2631
|
let n = mt(r.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + i)), o = r.muted;
|
|
2628
2632
|
r.setVolume(pt(a)), o && !r.muted && r.toggleMuted();
|
|
2629
2633
|
}, [r]), N = w(!1), P = b(() => {
|
|
@@ -2724,7 +2728,7 @@ ${jt}
|
|
|
2724
2728
|
type: "button",
|
|
2725
2729
|
onClick: () => r.togglePaused(),
|
|
2726
2730
|
"aria-label": i(j ? a.replay : o ? a.play : a.pause),
|
|
2727
|
-
children: I(j ?
|
|
2731
|
+
children: I(j ? q : o ? K : te, {})
|
|
2728
2732
|
}),
|
|
2729
2733
|
toolTipText: /* @__PURE__ */ I("span", { children: i(j ? a.replayKey : o ? a.playKey : a.pauseKey) })
|
|
2730
2734
|
}),
|
|
@@ -2784,7 +2788,7 @@ ${jt}
|
|
|
2784
2788
|
onClick: P,
|
|
2785
2789
|
"aria-label": i(a.fullScreen),
|
|
2786
2790
|
"aria-pressed": d,
|
|
2787
|
-
children: I(d ?
|
|
2791
|
+
children: I(d ? G : W, {})
|
|
2788
2792
|
}),
|
|
2789
2793
|
toolTipText: /* @__PURE__ */ I("span", { children: i(d ? a.exitFullScreenKey : a.fullScreenKey) })
|
|
2790
2794
|
})
|
|
@@ -2836,7 +2840,7 @@ ${jt}
|
|
|
2836
2840
|
color: #fff;
|
|
2837
2841
|
}
|
|
2838
2842
|
`, sn = () => {
|
|
2839
|
-
let { format: e } = Q(), t =
|
|
2843
|
+
let { format: e } = Q(), t = X((e) => e.burnedInSubtitles), n = X((e) => e.pictureInPictureMode), [r, i] = T(!1);
|
|
2840
2844
|
return S(() => {
|
|
2841
2845
|
if (n !== "burn-in" || !t) {
|
|
2842
2846
|
i(!1);
|
|
@@ -2916,7 +2920,7 @@ ${jt}
|
|
|
2916
2920
|
}
|
|
2917
2921
|
}
|
|
2918
2922
|
`, pn = ({ endingOffered: e }) => {
|
|
2919
|
-
let t =
|
|
2923
|
+
let t = X((e) => e.chapters), n = X((e) => e.currentTime), r = X((e) => e.requestSeek), i = X((e) => e.seekPreview), a = X(), { format: o } = Q(), s = C(() => {
|
|
2920
2924
|
let n = h(t), r = e ? -1 : n.lastIndexOf("ending");
|
|
2921
2925
|
return n.map((e, t) => t === r ? void 0 : e);
|
|
2922
2926
|
}, [t, e]), c = C(() => {
|
|
@@ -3036,7 +3040,7 @@ ${jt}
|
|
|
3036
3040
|
item: e
|
|
3037
3041
|
}];
|
|
3038
3042
|
}), yn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, children: c }) => {
|
|
3039
|
-
let l =
|
|
3043
|
+
let l = X(), u = X((e) => e.hideUI), d = X((e) => e.setHideUI), f = X((e) => e.hasMedia), p = X((e) => e.passThroughPictureInPicture), m = w(void 0), h = w("mouse"), g = w({
|
|
3040
3044
|
x: -1,
|
|
3041
3045
|
y: -1
|
|
3042
3046
|
}), _ = w(!1), v = w(null);
|
|
@@ -3167,95 +3171,95 @@ ${jt}
|
|
|
3167
3171
|
z,
|
|
3168
3172
|
B
|
|
3169
3173
|
]);
|
|
3170
|
-
let V =
|
|
3174
|
+
let V = X((e) => e.chapters), H = JSON.stringify(V);
|
|
3171
3175
|
S(() => {
|
|
3172
3176
|
P.chapters = V, P.endingOffered = M, P.dispatchEvent(new Event("chapterschange"));
|
|
3173
|
-
}, [
|
|
3174
|
-
let
|
|
3177
|
+
}, [H, M]);
|
|
3178
|
+
let ee = e.fullscreen ?? (O === null ? void 0 : {
|
|
3175
3179
|
active: O,
|
|
3176
3180
|
request: () => P.dispatchEvent(new Event("fullscreenrequest"))
|
|
3177
|
-
}),
|
|
3178
|
-
Ae(v, b, r, h ?
|
|
3179
|
-
let
|
|
3181
|
+
}), U = C(() => tt(), [o]);
|
|
3182
|
+
Ae(v, b, r, h ? U.push : void 0);
|
|
3183
|
+
let W = r?.normalizeVolume ?? !0, [G, te] = T(W);
|
|
3180
3184
|
S(() => {
|
|
3181
|
-
|
|
3182
|
-
}, [
|
|
3183
|
-
let
|
|
3184
|
-
|
|
3185
|
-
let
|
|
3186
|
-
|
|
3187
|
-
let
|
|
3188
|
-
tap:
|
|
3189
|
-
audioStreamIndex:
|
|
3185
|
+
te(W);
|
|
3186
|
+
}, [W]);
|
|
3187
|
+
let K = w(r?.onNormalizeVolumeChange);
|
|
3188
|
+
K.current = r?.onNormalizeVolumeChange;
|
|
3189
|
+
let q = r?.normalizerWorkletUrl, ne = w(p ?? f);
|
|
3190
|
+
ne.current = p ?? f;
|
|
3191
|
+
let re = X((e) => e.selectedAudioTrack), J = !!f, { refused: Y } = et(v, q, G, C(() => J && o && c && l && typeof re == "number" && re >= 0 ? h ? {
|
|
3192
|
+
tap: U,
|
|
3193
|
+
audioStreamIndex: re
|
|
3190
3194
|
} : {
|
|
3191
|
-
read: (e, t) =>
|
|
3195
|
+
read: (e, t) => ne.current(e, t),
|
|
3192
3196
|
length: o,
|
|
3193
3197
|
publicPath: c,
|
|
3194
3198
|
libavWorkerUrl: l,
|
|
3195
|
-
audioStreamIndex:
|
|
3199
|
+
audioStreamIndex: re
|
|
3196
3200
|
} : void 0, [
|
|
3197
|
-
|
|
3201
|
+
J,
|
|
3198
3202
|
o,
|
|
3199
3203
|
c,
|
|
3200
3204
|
l,
|
|
3201
|
-
|
|
3205
|
+
re,
|
|
3202
3206
|
h,
|
|
3203
|
-
|
|
3204
|
-
]), C(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])),
|
|
3205
|
-
enabled:
|
|
3206
|
-
available: !
|
|
3207
|
+
U
|
|
3208
|
+
]), C(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ie = C(() => q && typeof AudioWorkletNode == "function" ? {
|
|
3209
|
+
enabled: G,
|
|
3210
|
+
available: !Y,
|
|
3207
3211
|
setEnabled: (e) => {
|
|
3208
|
-
|
|
3212
|
+
te(e), K.current?.(e);
|
|
3209
3213
|
}
|
|
3210
3214
|
} : null, [
|
|
3215
|
+
q,
|
|
3211
3216
|
G,
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
]), { thumbnails: oe, requestThumbnail: se } = Le({
|
|
3217
|
+
Y
|
|
3218
|
+
]), { thumbnails: ae, requestThumbnail: oe } = Le({
|
|
3215
3219
|
publicPath: c,
|
|
3216
3220
|
workerUrl: l,
|
|
3217
3221
|
length: m === !1 ? void 0 : o,
|
|
3218
3222
|
read: p ?? f,
|
|
3219
3223
|
downloadedRanges: s
|
|
3220
|
-
}),
|
|
3224
|
+
}), se = n?.thumbnails?.all ?? ae, { toggle: ce, mode: le, burnedIn: ue } = Re(v, b), de = We(n?.media ?? null, n?.pictureInPicture), Z = X((e) => e.setSourceState), fe = n ? !!n.media : o !== void 0;
|
|
3221
3225
|
S(() => {
|
|
3222
|
-
|
|
3226
|
+
Z({
|
|
3223
3227
|
title: i,
|
|
3224
3228
|
size: o,
|
|
3225
3229
|
downloadedRanges: s,
|
|
3226
|
-
hasMedia:
|
|
3230
|
+
hasMedia: fe
|
|
3227
3231
|
});
|
|
3228
3232
|
}, [
|
|
3229
|
-
|
|
3233
|
+
Z,
|
|
3230
3234
|
i,
|
|
3231
3235
|
o,
|
|
3232
3236
|
s,
|
|
3233
|
-
|
|
3237
|
+
fe
|
|
3234
3238
|
]);
|
|
3235
|
-
let
|
|
3239
|
+
let pe = n?.thumbnails?.at;
|
|
3236
3240
|
S(() => {
|
|
3237
|
-
|
|
3238
|
-
thumbnails:
|
|
3239
|
-
thumbnailAt:
|
|
3240
|
-
requestThumbnail:
|
|
3241
|
-
togglePictureInPicture:
|
|
3242
|
-
pictureInPictureMode:
|
|
3243
|
-
burnedInSubtitles:
|
|
3241
|
+
Z({
|
|
3242
|
+
thumbnails: se,
|
|
3243
|
+
thumbnailAt: pe,
|
|
3244
|
+
requestThumbnail: oe,
|
|
3245
|
+
togglePictureInPicture: ce,
|
|
3246
|
+
pictureInPictureMode: le,
|
|
3247
|
+
burnedInSubtitles: ue
|
|
3244
3248
|
});
|
|
3245
3249
|
}, [
|
|
3246
|
-
|
|
3247
|
-
ce,
|
|
3248
|
-
me,
|
|
3250
|
+
Z,
|
|
3249
3251
|
se,
|
|
3252
|
+
pe,
|
|
3253
|
+
oe,
|
|
3254
|
+
ce,
|
|
3250
3255
|
le,
|
|
3251
|
-
ue
|
|
3252
|
-
de
|
|
3256
|
+
ue
|
|
3253
3257
|
]), S(() => {
|
|
3254
|
-
|
|
3255
|
-
}, [
|
|
3256
|
-
|
|
3257
|
-
}, [
|
|
3258
|
-
let
|
|
3258
|
+
Z({ volumeNormalizer: ie });
|
|
3259
|
+
}, [Z, ie]), S(() => {
|
|
3260
|
+
Z({ passThroughPictureInPicture: de });
|
|
3261
|
+
}, [Z, de]);
|
|
3262
|
+
let me = n?.subtitles?.selection, he = n?.audioTracks?.selection, ge = w({
|
|
3259
3263
|
options: e,
|
|
3260
3264
|
audio: he
|
|
3261
3265
|
});
|
|
@@ -3263,26 +3267,26 @@ ${jt}
|
|
|
3263
3267
|
options: e,
|
|
3264
3268
|
audio: he
|
|
3265
3269
|
}, S(() => {
|
|
3266
|
-
|
|
3267
|
-
subtitleTracks:
|
|
3270
|
+
me && Z({
|
|
3271
|
+
subtitleTracks: me.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3268
3272
|
id: e,
|
|
3269
3273
|
label: t,
|
|
3270
3274
|
disabled: n
|
|
3271
3275
|
})),
|
|
3272
|
-
selectedSubtitleTrack:
|
|
3276
|
+
selectedSubtitleTrack: me.selectedId ?? void 0,
|
|
3273
3277
|
selectSubtitleTrack: (e) => {
|
|
3274
|
-
let t = e == null ? null : String(e), n = t === null ? void 0 : bn(
|
|
3275
|
-
return xn(
|
|
3278
|
+
let t = e == null ? null : String(e), n = t === null ? void 0 : bn(me, t), r = me.selectedId === null;
|
|
3279
|
+
return xn(me.select(t), () => {
|
|
3276
3280
|
let e = t === null ? null : u(n) ?? (r ? n?.title : void 0), i = ge.current;
|
|
3277
3281
|
e !== void 0 && i.options.onPreferredSubtitleLanguageChange?.(e);
|
|
3278
3282
|
let a = i.audio && bn(i.audio, i.audio.selectedId ?? "");
|
|
3279
3283
|
e && d(a, e) && i.options.onAlwaysShowSubtitlesChange?.(!0);
|
|
3280
3284
|
});
|
|
3281
3285
|
},
|
|
3282
|
-
subtitleOffLabel:
|
|
3286
|
+
subtitleOffLabel: me.offLabel
|
|
3283
3287
|
});
|
|
3284
|
-
}, [
|
|
3285
|
-
he &&
|
|
3288
|
+
}, [Z, me]), S(() => {
|
|
3289
|
+
he && Z({
|
|
3286
3290
|
audioTracks: he.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3287
3291
|
id: e,
|
|
3288
3292
|
label: t,
|
|
@@ -3294,20 +3298,20 @@ ${jt}
|
|
|
3294
3298
|
t !== void 0 && ge.current.options.onPreferredAudioLanguageChange?.(t);
|
|
3295
3299
|
})
|
|
3296
3300
|
});
|
|
3297
|
-
}, [
|
|
3301
|
+
}, [Z, he]);
|
|
3298
3302
|
let _e = n?.quality?.selection ?? null;
|
|
3299
3303
|
return S(() => {
|
|
3300
|
-
|
|
3301
|
-
}, [
|
|
3302
|
-
a &&
|
|
3303
|
-
}, [
|
|
3304
|
+
Z({ quality: _e });
|
|
3305
|
+
}, [Z, _e]), S(() => {
|
|
3306
|
+
a && Z({ chapters: a });
|
|
3307
|
+
}, [Z, a]), /* @__PURE__ */ I(yn, {
|
|
3304
3308
|
ref: _,
|
|
3305
3309
|
onVideoRef: n ? void 0 : y,
|
|
3306
3310
|
onSubtitleRef: x,
|
|
3307
3311
|
overlay: e.overlay,
|
|
3308
3312
|
controls: e.controls,
|
|
3309
3313
|
shortcuts: e.shortcuts,
|
|
3310
|
-
fullscreen:
|
|
3314
|
+
fullscreen: ee,
|
|
3311
3315
|
endingOffered: M,
|
|
3312
3316
|
children: t
|
|
3313
3317
|
});
|
|
@@ -3383,7 +3387,7 @@ ${jt}
|
|
|
3383
3387
|
overflow: hidden;
|
|
3384
3388
|
`, wn = (e) => /* @__PURE__ */ I("div", {
|
|
3385
3389
|
css: Cn,
|
|
3386
|
-
children: /* @__PURE__ */ I(
|
|
3390
|
+
children: /* @__PURE__ */ I(ce.Provider, { children: /* @__PURE__ */ I(ye, {
|
|
3387
3391
|
language: e.language,
|
|
3388
3392
|
children: /* @__PURE__ */ I(Sn, {
|
|
3389
3393
|
options: e,
|
|
@@ -3432,4 +3436,4 @@ ${jt}
|
|
|
3432
3436
|
throw Error(`Unknown source type: ${e}`);
|
|
3433
3437
|
};
|
|
3434
3438
|
//#endregion
|
|
3435
|
-
export { wn as MediaPlayer, wn as default,
|
|
3439
|
+
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, X as usePlayer, Le as useSeekThumbnails };
|