@banou/media-player 0.9.0 → 0.10.0
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 +7 -0
- package/dist/engine/index.js +1 -1
- package/dist/engine/thumbnails.d.ts +11 -0
- package/dist/{engine-DZrYu66u.js → engine-YeMWShCv.js} +35 -19
- package/dist/index.js +204 -194
- package/dist/react/hooks/use-thumbnails.d.ts +12 -1
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +22 -0
- package/package.json +1 -1
- package/src/lib/engine/thumbnails.ts +80 -21
- package/src/lib/react/components/progress-bar.tsx +17 -4
- package/src/lib/react/hooks/use-thumbnails.ts +19 -3
- package/src/lib/react/source-feature.ts +12 -0
- package/src/lib/react/video-player.tsx +4 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-
|
|
1
|
+
import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-YeMWShCv.js";
|
|
2
2
|
import { Children as s, Fragment as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
3
3
|
import { css as h, keyframes as g } from "@emotion/react";
|
|
4
4
|
import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
|
|
@@ -7,9 +7,10 @@ import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
|
|
|
7
7
|
import { AlertTriangle as T, Check as E, ChevronLeft as D, ChevronRight as O, Copy as k, Maximize as A, Minimize as j, Pause as M, Play as N, RotateCcw as P, Settings as F, Volume1 as I, Volume2 as L, VolumeX as R } from "react-feather";
|
|
8
8
|
import { Tooltip as z } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var B = {
|
|
11
11
|
indexes: [],
|
|
12
12
|
thumbnails: [],
|
|
13
|
+
requestThumbnail: () => {},
|
|
13
14
|
subtitleTracks: [],
|
|
14
15
|
selectedSubtitleTrack: void 0,
|
|
15
16
|
selectSubtitleTrack: () => {},
|
|
@@ -25,19 +26,19 @@ var ee = {
|
|
|
25
26
|
playbackErrors: [],
|
|
26
27
|
ready: !1,
|
|
27
28
|
setSourceState: () => {}
|
|
28
|
-
},
|
|
29
|
+
}, ee = b({
|
|
29
30
|
name: "source",
|
|
30
|
-
state: () => ({ ...
|
|
31
|
+
state: () => ({ ...B }),
|
|
31
32
|
attach({ set: e }) {
|
|
32
33
|
e({
|
|
33
34
|
setSourceState: (t) => e(t),
|
|
34
35
|
setHideUI: (t) => e({ hideUI: t })
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
}),
|
|
38
|
-
features: [...x,
|
|
38
|
+
}), V = _({
|
|
39
|
+
features: [...x, ee],
|
|
39
40
|
displayName: "MediaPlayer"
|
|
40
|
-
}),
|
|
41
|
+
}), H = V.usePlayer, te = (e) => {
|
|
41
42
|
if (!(!e || e === "und")) try {
|
|
42
43
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
43
44
|
type: "language",
|
|
@@ -46,39 +47,39 @@ var ee = {
|
|
|
46
47
|
} catch {
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
},
|
|
50
|
-
let t = e.map((e) =>
|
|
50
|
+
}, ne = (e) => e?.replace(/_/g, " ").trim() || void 0, re = (e) => {
|
|
51
|
+
let t = e.map((e) => te(e.language) ?? ne(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
51
52
|
...e,
|
|
52
53
|
[t]: (e[t] ?? 0) + 1
|
|
53
54
|
}), {});
|
|
54
55
|
return e.map((e, r) => {
|
|
55
|
-
let i = t[r], a =
|
|
56
|
+
let i = t[r], a = ne(e.title);
|
|
56
57
|
return {
|
|
57
58
|
track: e,
|
|
58
59
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
59
60
|
};
|
|
60
61
|
});
|
|
61
|
-
},
|
|
62
|
+
}, ie = (e) => re(e).map(({ track: e, label: t }) => ({
|
|
62
63
|
id: e.streamIndex,
|
|
63
64
|
label: t
|
|
64
|
-
})),
|
|
65
|
+
})), ae = [
|
|
65
66
|
0,
|
|
66
67
|
250,
|
|
67
68
|
1e3,
|
|
68
69
|
3e3,
|
|
69
70
|
1e4
|
|
70
|
-
],
|
|
71
|
+
], oe = 6e4, se = 500, ce = (e) => e instanceof Error ? e.message : String(e), le = (e) => {
|
|
71
72
|
let t = [], n = e?.cause;
|
|
72
73
|
for (let e = 0; n != null && e < 8; e++) {
|
|
73
74
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
74
75
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
75
76
|
break;
|
|
76
77
|
}
|
|
77
|
-
t.push(
|
|
78
|
+
t.push(ce(n)), n = n?.cause;
|
|
78
79
|
}
|
|
79
80
|
return t.length ? t.join("\n") : void 0;
|
|
80
|
-
},
|
|
81
|
-
let a =
|
|
81
|
+
}, ue = (e, t, r) => {
|
|
82
|
+
let a = H(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, seekPrepareBudgetMs: b = se } = r ?? {}, [x, S] = m(void 0), [C, w] = m(0), T = p({
|
|
82
83
|
count: 0,
|
|
83
84
|
at: 0
|
|
84
85
|
}), E = p(void 0);
|
|
@@ -117,7 +118,7 @@ var ee = {
|
|
|
117
118
|
});
|
|
118
119
|
}, [a, b]), F = u((e) => {
|
|
119
120
|
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), S(e));
|
|
120
|
-
}, [a]), I =
|
|
121
|
+
}, [a]), I = H((e) => e.setSourceState);
|
|
121
122
|
d(() => {
|
|
122
123
|
I({
|
|
123
124
|
selectSubtitleTrack: N,
|
|
@@ -137,7 +138,7 @@ var ee = {
|
|
|
137
138
|
ready: !1
|
|
138
139
|
});
|
|
139
140
|
let u = (t, n) => {
|
|
140
|
-
let r = Date.now(), i =
|
|
141
|
+
let r = Date.now(), i = ce(t), o = le(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
141
142
|
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
142
143
|
let e = {
|
|
143
144
|
...c,
|
|
@@ -162,11 +163,11 @@ var ee = {
|
|
|
162
163
|
let t = n(e);
|
|
163
164
|
if (u(e, t), t) {
|
|
164
165
|
let t = performance.now();
|
|
165
|
-
t - T.current.at >
|
|
166
|
+
t - T.current.at > oe && (T.current = {
|
|
166
167
|
count: 0,
|
|
167
168
|
at: t
|
|
168
169
|
});
|
|
169
|
-
let n =
|
|
170
|
+
let n = ae[Math.min(T.current.count, ae.length - 1)];
|
|
170
171
|
T.current = {
|
|
171
172
|
count: T.current.count + 1,
|
|
172
173
|
at: t
|
|
@@ -203,13 +204,13 @@ var ee = {
|
|
|
203
204
|
onSeek: (e) => j.current?.(e),
|
|
204
205
|
onSubtitleStreams: (e) => {
|
|
205
206
|
r || a.setSourceState({
|
|
206
|
-
subtitleTracks:
|
|
207
|
+
subtitleTracks: ie(e),
|
|
207
208
|
...k.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
208
209
|
});
|
|
209
210
|
},
|
|
210
211
|
onAudioStreams: (e, t) => {
|
|
211
212
|
r || a.setSourceState({
|
|
212
|
-
audioTracks:
|
|
213
|
+
audioTracks: ie(e),
|
|
213
214
|
selectedAudioTrack: t
|
|
214
215
|
});
|
|
215
216
|
}
|
|
@@ -246,13 +247,13 @@ var ee = {
|
|
|
246
247
|
y,
|
|
247
248
|
C
|
|
248
249
|
]);
|
|
249
|
-
},
|
|
250
|
+
}, de = 5e3, fe = 6e4, pe = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
250
251
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
251
252
|
l.current = i;
|
|
252
|
-
let
|
|
253
|
-
return
|
|
253
|
+
let h = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = p(h);
|
|
254
|
+
return g.current = h, d(() => {
|
|
254
255
|
if (!n || !i || !e || !t) return;
|
|
255
|
-
let a = !1, o = null, u, d =
|
|
256
|
+
let a = !1, o = null, u, d = de, f = () => {
|
|
256
257
|
r({
|
|
257
258
|
publicPath: e,
|
|
258
259
|
workerUrl: t,
|
|
@@ -266,9 +267,9 @@ var ee = {
|
|
|
266
267
|
e.destroy();
|
|
267
268
|
return;
|
|
268
269
|
}
|
|
269
|
-
o = e, c.current = e, e.update(
|
|
270
|
+
o = e, c.current = e, e.update(g.current);
|
|
270
271
|
}, () => {
|
|
271
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
272
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, fe));
|
|
272
273
|
});
|
|
273
274
|
};
|
|
274
275
|
return f(), () => {
|
|
@@ -279,9 +280,14 @@ var ee = {
|
|
|
279
280
|
e,
|
|
280
281
|
t
|
|
281
282
|
]), d(() => {
|
|
282
|
-
c.current?.update(
|
|
283
|
-
}, [
|
|
284
|
-
|
|
283
|
+
c.current?.update(h);
|
|
284
|
+
}, [h]), {
|
|
285
|
+
thumbnails: o,
|
|
286
|
+
requestThumbnail: u((e) => {
|
|
287
|
+
c.current?.prioritize(e);
|
|
288
|
+
}, [])
|
|
289
|
+
};
|
|
290
|
+
}, me = (e, n) => {
|
|
285
291
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
286
292
|
d(() => {
|
|
287
293
|
if (!e || !n || !s) return;
|
|
@@ -309,7 +315,7 @@ var ee = {
|
|
|
309
315
|
mode: s,
|
|
310
316
|
burnedIn: i
|
|
311
317
|
};
|
|
312
|
-
},
|
|
318
|
+
}, U = {
|
|
313
319
|
headings: {
|
|
314
320
|
large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
|
|
315
321
|
medium: "\n font-weight: 600;\n font-size: calc(2.4 * var(--mp-unit));\n line-height: calc(2.9 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n }\n ",
|
|
@@ -336,7 +342,7 @@ var ee = {
|
|
|
336
342
|
medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
|
|
337
343
|
regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
|
|
338
344
|
}
|
|
339
|
-
},
|
|
345
|
+
}, he = h`
|
|
340
346
|
display: flex;
|
|
341
347
|
justify-content: center;
|
|
342
348
|
align-items: center;
|
|
@@ -349,7 +355,7 @@ var ee = {
|
|
|
349
355
|
margin: auto;
|
|
350
356
|
pointer-events: none;
|
|
351
357
|
}
|
|
352
|
-
`,
|
|
358
|
+
`, ge = h`
|
|
353
359
|
position: absolute;
|
|
354
360
|
top: 0;
|
|
355
361
|
left: 0;
|
|
@@ -357,7 +363,7 @@ var ee = {
|
|
|
357
363
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
358
364
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
359
365
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
360
|
-
${
|
|
366
|
+
${U.headings.small}
|
|
361
367
|
color: white;
|
|
362
368
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
363
369
|
z-index: 2;
|
|
@@ -378,7 +384,7 @@ var ee = {
|
|
|
378
384
|
|
|
379
385
|
background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
|
|
380
386
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
381
|
-
`,
|
|
387
|
+
`, _e = h`
|
|
382
388
|
position: absolute;
|
|
383
389
|
inset: 0;
|
|
384
390
|
z-index: 2;
|
|
@@ -398,44 +404,44 @@ var ee = {
|
|
|
398
404
|
to { transform: rotate(360deg); }
|
|
399
405
|
`} 0.8s linear infinite;
|
|
400
406
|
}
|
|
401
|
-
`,
|
|
407
|
+
`, ve = h`
|
|
402
408
|
position: absolute;
|
|
403
409
|
inset: auto 0 20%;
|
|
404
410
|
z-index: 3;
|
|
405
411
|
padding: 0 calc(2 * var(--mp-unit));
|
|
406
412
|
text-align: center;
|
|
407
413
|
color: #fff;
|
|
408
|
-
${
|
|
414
|
+
${U.bLarge.regular}
|
|
409
415
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
410
416
|
pointer-events: none;
|
|
411
|
-
`,
|
|
412
|
-
let t =
|
|
417
|
+
`, ye = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", be = ({ onSubtitleRef: e }) => {
|
|
418
|
+
let t = H((e) => e.title), n = H((e) => e.hideUI), r = H((e) => e.playbackError), i = H((e) => e.ready), a = H((e) => e.size), o = H((e) => e.waiting);
|
|
413
419
|
return /* @__PURE__ */ w(S, { children: [
|
|
414
420
|
t ? /* @__PURE__ */ C("div", {
|
|
415
421
|
className: "title",
|
|
416
|
-
css:
|
|
422
|
+
css: ge,
|
|
417
423
|
style: { ...n ? {
|
|
418
424
|
opacity: "0",
|
|
419
425
|
pointerEvents: "none"
|
|
420
426
|
} : {} },
|
|
421
427
|
children: t
|
|
422
428
|
}) : void 0,
|
|
423
|
-
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css:
|
|
429
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: _e }) : void 0,
|
|
424
430
|
r ? /* @__PURE__ */ C("div", {
|
|
425
|
-
css:
|
|
426
|
-
children:
|
|
431
|
+
css: ve,
|
|
432
|
+
children: ye(r)
|
|
427
433
|
}) : void 0,
|
|
428
434
|
/* @__PURE__ */ C("div", {
|
|
429
435
|
className: "subtitles",
|
|
430
436
|
ref: e,
|
|
431
|
-
css:
|
|
437
|
+
css: he
|
|
432
438
|
})
|
|
433
439
|
] });
|
|
434
|
-
},
|
|
440
|
+
}, xe = 1e-4, W = 1, Se = (e) => Math.max(xe, Math.min(W, e)) ** 2, G = (e) => Math.max(xe, Math.min(W, e)) ** (W / 2), K = (e) => {
|
|
435
441
|
if (e === void 0) return "0:00";
|
|
436
442
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
437
443
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
438
|
-
},
|
|
444
|
+
}, Ce = (e, t) => `${K(e)} / ${K(t)}`, we = (e) => h`
|
|
439
445
|
display: flex;
|
|
440
446
|
justify-content: flex-start;
|
|
441
447
|
|
|
@@ -467,7 +473,7 @@ var ee = {
|
|
|
467
473
|
z-index: 3;
|
|
468
474
|
|
|
469
475
|
* {
|
|
470
|
-
${
|
|
476
|
+
${U.bMedium.regular}
|
|
471
477
|
}
|
|
472
478
|
|
|
473
479
|
${e === "sm" && h`
|
|
@@ -479,25 +485,25 @@ var ee = {
|
|
|
479
485
|
${e === "lg" && h`
|
|
480
486
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
481
487
|
`}
|
|
482
|
-
`,
|
|
488
|
+
`, q = {
|
|
483
489
|
x: -1,
|
|
484
490
|
y: -1,
|
|
485
491
|
anchors: 0
|
|
486
|
-
},
|
|
487
|
-
|
|
488
|
-
},
|
|
492
|
+
}, Te = (e) => {
|
|
493
|
+
q.x = e.clientX, q.y = e.clientY;
|
|
494
|
+
}, Ee = () => (q.anchors++ === 0 && window.addEventListener("pointermove", Te, {
|
|
489
495
|
capture: !0,
|
|
490
496
|
passive: !0
|
|
491
497
|
}), () => {
|
|
492
|
-
--
|
|
493
|
-
}),
|
|
498
|
+
--q.anchors === 0 && window.removeEventListener("pointermove", Te, { capture: !0 });
|
|
499
|
+
}), J = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
494
500
|
let l = p(null), u = p(null);
|
|
495
501
|
return d(() => {
|
|
496
|
-
let e =
|
|
502
|
+
let e = Ee(), t = () => {
|
|
497
503
|
let e = l.current;
|
|
498
504
|
if (!e) return;
|
|
499
505
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
500
|
-
|
|
506
|
+
q.x >= t && q.x < n && q.y >= r && q.y < i || u.current?.close();
|
|
501
507
|
}, n = ["fullscreenchange", "webkitfullscreenchange"];
|
|
502
508
|
for (let e of n) document.addEventListener(e, t);
|
|
503
509
|
return () => {
|
|
@@ -515,12 +521,12 @@ var ee = {
|
|
|
515
521
|
children: n
|
|
516
522
|
}), !s && /* @__PURE__ */ C(z, {
|
|
517
523
|
ref: u,
|
|
518
|
-
css:
|
|
524
|
+
css: we(c),
|
|
519
525
|
id: e,
|
|
520
526
|
noArrow: !0,
|
|
521
527
|
children: t
|
|
522
528
|
})] });
|
|
523
|
-
},
|
|
529
|
+
}, Y = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
524
530
|
let [i, a] = m(!1), o = p(t);
|
|
525
531
|
o.current = t;
|
|
526
532
|
let s = p(null), c = u((t, r) => {
|
|
@@ -559,7 +565,7 @@ var ee = {
|
|
|
559
565
|
style: { touchAction: "none" }
|
|
560
566
|
}
|
|
561
567
|
};
|
|
562
|
-
},
|
|
568
|
+
}, De = h`
|
|
563
569
|
position: relative;
|
|
564
570
|
height: calc(.4 * var(--mp-unit));
|
|
565
571
|
|
|
@@ -613,7 +619,7 @@ var ee = {
|
|
|
613
619
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
614
620
|
|
|
615
621
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
616
|
-
${
|
|
622
|
+
${U.bMedium.bold}
|
|
617
623
|
|
|
618
624
|
position: absolute;
|
|
619
625
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -730,36 +736,38 @@ var ee = {
|
|
|
730
736
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
731
737
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
732
738
|
}
|
|
733
|
-
`,
|
|
734
|
-
let e =
|
|
735
|
-
|
|
739
|
+
`, Oe = 4, ke = () => {
|
|
740
|
+
let e = H(), t = H((e) => e.currentTime), n = H((e) => e.requestSeek), r = H((e) => e.duration), i = H((e) => e.size), a = H((e) => e.downloadedRanges), o = H((e) => e.indexes), s = H((e) => e.thumbnails), c = H((e) => e.thumbnailAt), l = H((e) => e.requestThumbnail), u = p(null), [h, g] = m(void 0), [_, v] = m(void 0), y = (e) => {
|
|
741
|
+
v(e), l(e);
|
|
742
|
+
}, b = p(void 0), x = p(0), S = p(void 0), T = p(void 0), E = p(!1), { dragging: D, handlers: O } = Y({
|
|
743
|
+
ref: u,
|
|
736
744
|
onChange: (e) => {
|
|
737
|
-
if (
|
|
738
|
-
else if (!
|
|
739
|
-
let t =
|
|
740
|
-
Math.abs(e -
|
|
745
|
+
if (x.current += 1, S.current = e, T.current === void 0) T.current = e;
|
|
746
|
+
else if (!E.current) {
|
|
747
|
+
let t = u.current?.getBoundingClientRect().width ?? 0;
|
|
748
|
+
Math.abs(e - T.current) * t > Oe && (E.current = !0);
|
|
741
749
|
}
|
|
742
|
-
|
|
750
|
+
g(e), b.current !== "mouse" && y(e * r);
|
|
743
751
|
}
|
|
744
|
-
}),
|
|
745
|
-
|
|
746
|
-
},
|
|
747
|
-
|
|
748
|
-
let i =
|
|
752
|
+
}), k = (e) => {
|
|
753
|
+
b.current = e.pointerType, x.current = 0, T.current = void 0, E.current = !1, O.onPointerDown(e);
|
|
754
|
+
}, A = (t) => {
|
|
755
|
+
O.onPointerUp(t);
|
|
756
|
+
let i = x.current > 0 ? S.current : void 0;
|
|
749
757
|
if (i !== void 0 && r) {
|
|
750
758
|
let t = i * r;
|
|
751
759
|
n ? n(t) : e.seek(t);
|
|
752
760
|
}
|
|
753
|
-
|
|
754
|
-
},
|
|
755
|
-
if (!
|
|
756
|
-
let { left: t, right: n } =
|
|
761
|
+
x.current = 0, E.current = !1, T.current = void 0, t.pointerType !== "mouse" && y(void 0);
|
|
762
|
+
}, j = (e) => {
|
|
763
|
+
if (!u.current) return;
|
|
764
|
+
let { left: t, right: n } = u.current.getBoundingClientRect();
|
|
757
765
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
},
|
|
761
|
-
|
|
762
|
-
},
|
|
766
|
+
}, M = (e) => {
|
|
767
|
+
y(j(e.clientX));
|
|
768
|
+
}, N = () => {
|
|
769
|
+
u.current && y(void 0);
|
|
770
|
+
}, P = (e) => r ? e / r * 100 : 0, F = f(() => a?.map((e, t) => {
|
|
763
771
|
if (!i || !r) return null;
|
|
764
772
|
let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
|
|
765
773
|
if (!a || !s) return null;
|
|
@@ -775,72 +783,72 @@ var ee = {
|
|
|
775
783
|
r,
|
|
776
784
|
o.length,
|
|
777
785
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
778
|
-
]),
|
|
779
|
-
if (!
|
|
780
|
-
let e = Math.floor(
|
|
786
|
+
]), I = f(() => {
|
|
787
|
+
if (!_ || _ < 0) return;
|
|
788
|
+
let e = Math.floor(_ / 3600), t = Math.floor((_ - e * 3600) / 60), n = Math.floor(_ - e * 3600 - t * 60);
|
|
781
789
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
782
|
-
}, [
|
|
790
|
+
}, [_]);
|
|
783
791
|
d(() => {
|
|
784
|
-
|
|
792
|
+
h === void 0 || !r || !D || !E.current || e.seek(h * r);
|
|
785
793
|
}, [
|
|
786
794
|
e,
|
|
787
|
-
|
|
788
|
-
|
|
795
|
+
D,
|
|
796
|
+
h,
|
|
789
797
|
r
|
|
790
798
|
]);
|
|
791
|
-
let
|
|
792
|
-
if (
|
|
793
|
-
if (c) return c(
|
|
794
|
-
if (s.length) return s.find(({ startTime: e, endTime: t }) => e <=
|
|
799
|
+
let L = f(() => !r || typeof t != "number" ? 0 : t / r, [r, t]), R = f(() => {
|
|
800
|
+
if (_) {
|
|
801
|
+
if (c) return c(_);
|
|
802
|
+
if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= _ && _ < t);
|
|
795
803
|
}
|
|
796
804
|
}, [
|
|
797
805
|
s,
|
|
798
806
|
c,
|
|
799
|
-
|
|
807
|
+
_
|
|
800
808
|
]);
|
|
801
809
|
return /* @__PURE__ */ w("div", {
|
|
802
|
-
css:
|
|
803
|
-
ref:
|
|
804
|
-
className:
|
|
805
|
-
onMouseMove:
|
|
806
|
-
onMouseOut:
|
|
810
|
+
css: De,
|
|
811
|
+
ref: u,
|
|
812
|
+
className: D ? "progress-bar dragging" : "progress-bar",
|
|
813
|
+
onMouseMove: M,
|
|
814
|
+
onMouseOut: N,
|
|
807
815
|
children: [
|
|
808
816
|
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
809
|
-
|
|
817
|
+
_ ? /* @__PURE__ */ C("div", {
|
|
810
818
|
className: "cursor-time",
|
|
811
|
-
style: { left: `clamp(calc(3 * var(--mp-unit)), ${
|
|
812
|
-
children:
|
|
819
|
+
style: { left: `clamp(calc(3 * var(--mp-unit)), ${P(_)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
820
|
+
children: I
|
|
813
821
|
}) : void 0,
|
|
814
822
|
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
815
823
|
/* @__PURE__ */ C("div", {
|
|
816
824
|
className: "loaded",
|
|
817
|
-
children:
|
|
825
|
+
children: F
|
|
818
826
|
}),
|
|
819
827
|
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
820
828
|
/* @__PURE__ */ C("div", {
|
|
821
829
|
className: "play-container",
|
|
822
830
|
children: /* @__PURE__ */ C("div", {
|
|
823
831
|
className: "play",
|
|
824
|
-
style: { transform: `scaleX(${
|
|
832
|
+
style: { transform: `scaleX(${L})` }
|
|
825
833
|
})
|
|
826
834
|
}),
|
|
827
835
|
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
828
836
|
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
829
837
|
/* @__PURE__ */ C("div", {
|
|
830
838
|
className: "padding",
|
|
831
|
-
...
|
|
832
|
-
onPointerDown:
|
|
833
|
-
onPointerUp:
|
|
834
|
-
onPointerCancel:
|
|
839
|
+
...O,
|
|
840
|
+
onPointerDown: k,
|
|
841
|
+
onPointerUp: A,
|
|
842
|
+
onPointerCancel: A
|
|
835
843
|
}),
|
|
836
844
|
/* @__PURE__ */ C("div", {
|
|
837
845
|
className: "thumbnail",
|
|
838
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
839
|
-
children:
|
|
846
|
+
style: { left: `clamp(var(--thumbnail-half), ${P(_ ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
847
|
+
children: R?.url ? /* @__PURE__ */ C("img", { src: R.url }) : void 0
|
|
840
848
|
})
|
|
841
849
|
]
|
|
842
850
|
});
|
|
843
|
-
},
|
|
851
|
+
}, Ae = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e", X = {
|
|
844
852
|
xmlns: "http://www.w3.org/2000/svg",
|
|
845
853
|
width: 24,
|
|
846
854
|
height: 24,
|
|
@@ -850,8 +858,8 @@ var ee = {
|
|
|
850
858
|
strokeWidth: 2,
|
|
851
859
|
strokeLinecap: "round",
|
|
852
860
|
strokeLinejoin: "round"
|
|
853
|
-
},
|
|
854
|
-
...
|
|
861
|
+
}, je = (e) => /* @__PURE__ */ w("svg", {
|
|
862
|
+
...X,
|
|
855
863
|
...e,
|
|
856
864
|
children: [/* @__PURE__ */ C("rect", {
|
|
857
865
|
x: "3",
|
|
@@ -861,8 +869,8 @@ var ee = {
|
|
|
861
869
|
rx: "2",
|
|
862
870
|
ry: "2"
|
|
863
871
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
864
|
-
}),
|
|
865
|
-
...
|
|
872
|
+
}), Me = (e) => /* @__PURE__ */ w("svg", {
|
|
873
|
+
...X,
|
|
866
874
|
...e,
|
|
867
875
|
children: [
|
|
868
876
|
/* @__PURE__ */ C("rect", {
|
|
@@ -881,8 +889,8 @@ var ee = {
|
|
|
881
889
|
y2: "22"
|
|
882
890
|
})
|
|
883
891
|
]
|
|
884
|
-
}),
|
|
885
|
-
...
|
|
892
|
+
}), Ne = (e) => /* @__PURE__ */ w("svg", {
|
|
893
|
+
...X,
|
|
886
894
|
...e,
|
|
887
895
|
children: [
|
|
888
896
|
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -896,8 +904,8 @@ var ee = {
|
|
|
896
904
|
}),
|
|
897
905
|
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
898
906
|
]
|
|
899
|
-
}),
|
|
900
|
-
...
|
|
907
|
+
}), Pe = (e) => /* @__PURE__ */ w("svg", {
|
|
908
|
+
...X,
|
|
901
909
|
...e,
|
|
902
910
|
children: [
|
|
903
911
|
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -911,7 +919,7 @@ var ee = {
|
|
|
911
919
|
}),
|
|
912
920
|
/* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
|
|
913
921
|
]
|
|
914
|
-
}),
|
|
922
|
+
}), Z = h`
|
|
915
923
|
.popover {
|
|
916
924
|
position: absolute;
|
|
917
925
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -950,7 +958,7 @@ var ee = {
|
|
|
950
958
|
|
|
951
959
|
border-radius: 8px;
|
|
952
960
|
background-color: rgba(28,28,28,0.95);
|
|
953
|
-
${
|
|
961
|
+
${U.bMedium.regular}
|
|
954
962
|
|
|
955
963
|
z-index: 4;
|
|
956
964
|
|
|
@@ -993,7 +1001,7 @@ var ee = {
|
|
|
993
1001
|
|
|
994
1002
|
.secondary {
|
|
995
1003
|
color: #eee;
|
|
996
|
-
${
|
|
1004
|
+
${U.bSmall.regular}
|
|
997
1005
|
}
|
|
998
1006
|
}
|
|
999
1007
|
}
|
|
@@ -1035,10 +1043,10 @@ var ee = {
|
|
|
1035
1043
|
.failed {
|
|
1036
1044
|
border-bottom: 1px solid #4D4D4E;
|
|
1037
1045
|
color: #f66;
|
|
1038
|
-
${
|
|
1046
|
+
${U.bSmall.regular}
|
|
1039
1047
|
}
|
|
1040
1048
|
}
|
|
1041
|
-
`,
|
|
1049
|
+
`, Fe = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1042
1050
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1043
1051
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1044
1052
|
return /* @__PURE__ */ w("div", {
|
|
@@ -1065,7 +1073,7 @@ var ee = {
|
|
|
1065
1073
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1066
1074
|
]
|
|
1067
1075
|
});
|
|
1068
|
-
},
|
|
1076
|
+
}, Ie = ({ onReset: e } = {}) => {
|
|
1069
1077
|
let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
|
|
1070
1078
|
c.current = e;
|
|
1071
1079
|
let l = () => {
|
|
@@ -1122,7 +1130,7 @@ position: static;
|
|
|
1122
1130
|
}
|
|
1123
1131
|
}
|
|
1124
1132
|
|
|
1125
|
-
${
|
|
1133
|
+
${Z}
|
|
1126
1134
|
|
|
1127
1135
|
.popover.error-list {
|
|
1128
1136
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1150,7 +1158,7 @@ ${X}
|
|
|
1150
1158
|
|
|
1151
1159
|
color: #fff;
|
|
1152
1160
|
cursor: pointer;
|
|
1153
|
-
${
|
|
1161
|
+
${U.bSmall.regular}
|
|
1154
1162
|
|
|
1155
1163
|
&:hover {
|
|
1156
1164
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1171,7 +1179,7 @@ ${X}
|
|
|
1171
1179
|
|
|
1172
1180
|
.when {
|
|
1173
1181
|
color: #bbb;
|
|
1174
|
-
${
|
|
1182
|
+
${U.bSmall.regular}
|
|
1175
1183
|
|
|
1176
1184
|
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1177
1185
|
.count {
|
|
@@ -1190,11 +1198,11 @@ ${X}
|
|
|
1190
1198
|
color: #ddd;
|
|
1191
1199
|
overflow-wrap: anywhere;
|
|
1192
1200
|
white-space: pre-wrap;
|
|
1193
|
-
${
|
|
1201
|
+
${U.bSmall.regular}
|
|
1194
1202
|
}
|
|
1195
1203
|
}
|
|
1196
1204
|
}
|
|
1197
|
-
`, Re = (e) => new Date(e).toLocaleTimeString(), Q = (e) => e === void 0 || !Number.isFinite(e) ? void 0 :
|
|
1205
|
+
`, Re = (e) => new Date(e).toLocaleTimeString(), Q = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : K(Math.max(0, e)), ze = (e) => e.reduce((e, t) => e + t.count, 0), Be = (e) => e.map((e, t) => {
|
|
1198
1206
|
let n = Q(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1199
1207
|
return [
|
|
1200
1208
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
@@ -1202,7 +1210,7 @@ ${X}
|
|
|
1202
1210
|
e.detail
|
|
1203
1211
|
].filter(Boolean).join("\n");
|
|
1204
1212
|
}).join("\n\n"), Ve = () => {
|
|
1205
|
-
let e =
|
|
1213
|
+
let e = H((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Ie(), [i, a] = m(!1);
|
|
1206
1214
|
if (e.length === 0) return null;
|
|
1207
1215
|
let o = () => {
|
|
1208
1216
|
navigator.clipboard?.writeText(Be(e)).then(() => {
|
|
@@ -1212,7 +1220,7 @@ ${X}
|
|
|
1212
1220
|
return /* @__PURE__ */ w("div", {
|
|
1213
1221
|
css: Le,
|
|
1214
1222
|
ref: r,
|
|
1215
|
-
children: [/* @__PURE__ */ C(
|
|
1223
|
+
children: [/* @__PURE__ */ C(J, {
|
|
1216
1224
|
id: "errors",
|
|
1217
1225
|
disabled: t,
|
|
1218
1226
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1317,7 +1325,7 @@ width: 100%;
|
|
|
1317
1325
|
}
|
|
1318
1326
|
}
|
|
1319
1327
|
`, Ue = () => {
|
|
1320
|
-
let e =
|
|
1328
|
+
let e = H(), t = H((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = Y({
|
|
1321
1329
|
ref: r,
|
|
1322
1330
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1323
1331
|
}), f = (t) => {
|
|
@@ -1369,7 +1377,7 @@ position: static;
|
|
|
1369
1377
|
}
|
|
1370
1378
|
}
|
|
1371
1379
|
|
|
1372
|
-
${
|
|
1380
|
+
${Z}
|
|
1373
1381
|
|
|
1374
1382
|
.playback-rate {
|
|
1375
1383
|
.slider {
|
|
@@ -1411,7 +1419,7 @@ ${X}
|
|
|
1411
1419
|
}
|
|
1412
1420
|
|
|
1413
1421
|
`, Ge = () => {
|
|
1414
|
-
let e =
|
|
1422
|
+
let e = H(), t = H((e) => e.playbackRate), n = H((e) => e.audioTracks), r = H((e) => e.selectedAudioTrack), i = H((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = Ie({ onReset: () => o(0) }), p = (t) => {
|
|
1415
1423
|
e.setPlaybackRate(t), o(0);
|
|
1416
1424
|
}, h = (e) => {
|
|
1417
1425
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1422,7 +1430,7 @@ ${X}
|
|
|
1422
1430
|
css: We,
|
|
1423
1431
|
ref: l,
|
|
1424
1432
|
children: [
|
|
1425
|
-
/* @__PURE__ */ C(
|
|
1433
|
+
/* @__PURE__ */ C(J, {
|
|
1426
1434
|
id: "settings",
|
|
1427
1435
|
disabled: s,
|
|
1428
1436
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1483,7 +1491,7 @@ ${X}
|
|
|
1483
1491
|
})
|
|
1484
1492
|
]
|
|
1485
1493
|
}),
|
|
1486
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1494
|
+
s && a === 2 && /* @__PURE__ */ C(Fe, {
|
|
1487
1495
|
title: "Audio",
|
|
1488
1496
|
tracks: n,
|
|
1489
1497
|
selected: r,
|
|
@@ -1510,15 +1518,15 @@ position: static;
|
|
|
1510
1518
|
}
|
|
1511
1519
|
}
|
|
1512
1520
|
|
|
1513
|
-
${
|
|
1521
|
+
${Z}
|
|
1514
1522
|
`, qe = () => {
|
|
1515
|
-
let e =
|
|
1523
|
+
let e = H((e) => e.subtitleTracks), t = H((e) => e.selectedSubtitleTrack), n = H((e) => e.selectSubtitleTrack), r = H((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Ie();
|
|
1516
1524
|
if (e.length === 0) return null;
|
|
1517
1525
|
let u = t !== void 0;
|
|
1518
1526
|
return /* @__PURE__ */ w("div", {
|
|
1519
1527
|
css: Ke,
|
|
1520
1528
|
ref: o,
|
|
1521
|
-
children: [/* @__PURE__ */ C(
|
|
1529
|
+
children: [/* @__PURE__ */ C(J, {
|
|
1522
1530
|
id: "subtitles",
|
|
1523
1531
|
disabled: i,
|
|
1524
1532
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1528,10 +1536,10 @@ ${X}
|
|
|
1528
1536
|
"aria-label": "Subtitles",
|
|
1529
1537
|
"aria-expanded": i,
|
|
1530
1538
|
"aria-pressed": u,
|
|
1531
|
-
children: u ? /* @__PURE__ */ C(
|
|
1539
|
+
children: u ? /* @__PURE__ */ C(je, { className: "captions" }) : /* @__PURE__ */ C(Me, { className: "captions-off" })
|
|
1532
1540
|
}),
|
|
1533
1541
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1534
|
-
}), i && /* @__PURE__ */ C(
|
|
1542
|
+
}), i && /* @__PURE__ */ C(Fe, {
|
|
1535
1543
|
title: "Subtitles",
|
|
1536
1544
|
tracks: e,
|
|
1537
1545
|
selected: t,
|
|
@@ -1591,7 +1599,7 @@ ${X}
|
|
|
1591
1599
|
height: 10px;
|
|
1592
1600
|
}
|
|
1593
1601
|
`, Xe = ({ value: e, onChange: t }) => {
|
|
1594
|
-
let n =
|
|
1602
|
+
let n = H((e) => e.volume), r = H((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Y({
|
|
1595
1603
|
ref: a,
|
|
1596
1604
|
onChange: t
|
|
1597
1605
|
}), s = (n) => {
|
|
@@ -1605,8 +1613,8 @@ ${X}
|
|
|
1605
1613
|
e && e.removeEventListener("wheel", s);
|
|
1606
1614
|
};
|
|
1607
1615
|
}, [e]);
|
|
1608
|
-
let c = e * 100, l = f(() => Math.round(r ? 0 :
|
|
1609
|
-
return /* @__PURE__ */ C(
|
|
1616
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
|
|
1617
|
+
return /* @__PURE__ */ C(J, {
|
|
1610
1618
|
id: "volume-slider",
|
|
1611
1619
|
text: /* @__PURE__ */ C("div", {
|
|
1612
1620
|
ref: i,
|
|
@@ -1654,7 +1662,7 @@ ${X}
|
|
|
1654
1662
|
border-radius: 4px;
|
|
1655
1663
|
|
|
1656
1664
|
.volume-value {
|
|
1657
|
-
${
|
|
1665
|
+
${U.bMedium.regular};
|
|
1658
1666
|
color: #ffffff;
|
|
1659
1667
|
}
|
|
1660
1668
|
}
|
|
@@ -1693,10 +1701,10 @@ ${X}
|
|
|
1693
1701
|
}
|
|
1694
1702
|
|
|
1695
1703
|
`, Qe = ({ ref: e }) => {
|
|
1696
|
-
let t =
|
|
1704
|
+
let t = H(), n = H((e) => e.volume), r = H((e) => e.muted), i = f(() => G(n), [n]);
|
|
1697
1705
|
return /* @__PURE__ */ w("div", {
|
|
1698
1706
|
css: Ze,
|
|
1699
|
-
children: [/* @__PURE__ */ C(
|
|
1707
|
+
children: [/* @__PURE__ */ C(J, {
|
|
1700
1708
|
id: "sound",
|
|
1701
1709
|
text: /* @__PURE__ */ C("button", {
|
|
1702
1710
|
className: "sound",
|
|
@@ -1718,7 +1726,7 @@ ${X}
|
|
|
1718
1726
|
children: /* @__PURE__ */ C(Xe, {
|
|
1719
1727
|
value: r ? 0 : i,
|
|
1720
1728
|
onChange: (e) => {
|
|
1721
|
-
t.setVolume(
|
|
1729
|
+
t.setVolume(Se(e));
|
|
1722
1730
|
}
|
|
1723
1731
|
})
|
|
1724
1732
|
})
|
|
@@ -1840,7 +1848,7 @@ ${X}
|
|
|
1840
1848
|
|
|
1841
1849
|
.left {
|
|
1842
1850
|
.time {
|
|
1843
|
-
${
|
|
1851
|
+
${U.bMedium.regular}
|
|
1844
1852
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1845
1853
|
}
|
|
1846
1854
|
}
|
|
@@ -1862,9 +1870,9 @@ ${X}
|
|
|
1862
1870
|
}
|
|
1863
1871
|
}
|
|
1864
1872
|
`, nt = () => {
|
|
1865
|
-
let e =
|
|
1866
|
-
let r =
|
|
1867
|
-
e.setVolume(
|
|
1873
|
+
let e = H(), t = H((e) => e.paused), n = H((e) => e.currentTime), r = H((e) => e.duration), i = H((e) => e.fullscreen), a = H((e) => e.hideUI), o = H((e) => e.togglePictureInPicture), s = H((e) => e.pictureInPictureMode), c = H((e) => e.burnedInSubtitles), l = H((e) => e.subtitleTracks), f = H((e) => e.requestSeek), [p, h] = m(null), g = s === "burn-in", _ = l.length > 0, v = r > 0 && n === r, y = u(({ direction: t, stepSize: n }) => {
|
|
1874
|
+
let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1875
|
+
e.setVolume(Se(a)), o && !e.muted && e.toggleMuted();
|
|
1868
1876
|
}, [e]);
|
|
1869
1877
|
d(() => {
|
|
1870
1878
|
let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
|
|
@@ -1912,12 +1920,12 @@ ${X}
|
|
|
1912
1920
|
opacity: "0",
|
|
1913
1921
|
pointerEvents: "none"
|
|
1914
1922
|
} : {} },
|
|
1915
|
-
children: [/* @__PURE__ */ C(
|
|
1923
|
+
children: [/* @__PURE__ */ C(ke, {}), /* @__PURE__ */ w("div", {
|
|
1916
1924
|
className: "actions",
|
|
1917
1925
|
children: [/* @__PURE__ */ w("div", {
|
|
1918
1926
|
className: "left",
|
|
1919
1927
|
children: [
|
|
1920
|
-
/* @__PURE__ */ C(
|
|
1928
|
+
/* @__PURE__ */ C(J, {
|
|
1921
1929
|
id: "play",
|
|
1922
1930
|
tooltipPlace: "top-start",
|
|
1923
1931
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1932,7 +1940,7 @@ ${X}
|
|
|
1932
1940
|
/* @__PURE__ */ C(Qe, { ref: h }),
|
|
1933
1941
|
/* @__PURE__ */ C("div", {
|
|
1934
1942
|
className: "time",
|
|
1935
|
-
children:
|
|
1943
|
+
children: Ce(n, r)
|
|
1936
1944
|
})
|
|
1937
1945
|
]
|
|
1938
1946
|
}), /* @__PURE__ */ w("div", {
|
|
@@ -1941,7 +1949,7 @@ ${X}
|
|
|
1941
1949
|
/* @__PURE__ */ C(Ve, {}),
|
|
1942
1950
|
/* @__PURE__ */ C(qe, {}),
|
|
1943
1951
|
/* @__PURE__ */ C(Ge, {}),
|
|
1944
|
-
o ? /* @__PURE__ */ C(
|
|
1952
|
+
o ? /* @__PURE__ */ C(J, {
|
|
1945
1953
|
id: "picture-in-picture",
|
|
1946
1954
|
tooltipPlace: "top-end",
|
|
1947
1955
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1951,8 +1959,8 @@ ${X}
|
|
|
1951
1959
|
disabled: g && !_,
|
|
1952
1960
|
"aria-label": g ? "Put the subtitles in the video" : "Picture in picture",
|
|
1953
1961
|
"aria-pressed": g ? c : void 0,
|
|
1954
|
-
children: g ? C(c ?
|
|
1955
|
-
src:
|
|
1962
|
+
children: g ? C(c ? Ne : Pe, {}) : /* @__PURE__ */ C("img", {
|
|
1963
|
+
src: Ae,
|
|
1956
1964
|
alt: ""
|
|
1957
1965
|
})
|
|
1958
1966
|
}),
|
|
@@ -1967,7 +1975,7 @@ ${X}
|
|
|
1967
1975
|
}) : null]
|
|
1968
1976
|
})
|
|
1969
1977
|
}) : null,
|
|
1970
|
-
/* @__PURE__ */ C(
|
|
1978
|
+
/* @__PURE__ */ C(J, {
|
|
1971
1979
|
id: "full-screen",
|
|
1972
1980
|
tooltipPlace: "top-end",
|
|
1973
1981
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -2022,12 +2030,12 @@ ${X}
|
|
|
2022
2030
|
}
|
|
2023
2031
|
|
|
2024
2032
|
.title {
|
|
2025
|
-
${
|
|
2033
|
+
${U.bMedium.bold}
|
|
2026
2034
|
color: #fff;
|
|
2027
2035
|
}
|
|
2028
2036
|
|
|
2029
2037
|
.body {
|
|
2030
|
-
${
|
|
2038
|
+
${U.bSmall.regular}
|
|
2031
2039
|
color: rgba(255, 255, 255, 0.75);
|
|
2032
2040
|
}
|
|
2033
2041
|
|
|
@@ -2039,7 +2047,7 @@ ${X}
|
|
|
2039
2047
|
color: #fff;
|
|
2040
2048
|
}
|
|
2041
2049
|
`, at = () => {
|
|
2042
|
-
let e =
|
|
2050
|
+
let e = H((e) => e.burnedInSubtitles), t = H((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
2043
2051
|
return d(() => {
|
|
2044
2052
|
if (t !== "burn-in" || !e) {
|
|
2045
2053
|
r(!1);
|
|
@@ -2133,7 +2141,7 @@ ${X}
|
|
|
2133
2141
|
item: e
|
|
2134
2142
|
}];
|
|
2135
2143
|
}), ut = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
|
|
2136
|
-
let o =
|
|
2144
|
+
let o = H(), s = H((e) => e.hideUI), c = H((e) => e.setHideUI), l = p(void 0), u = p("mouse"), f = p({
|
|
2137
2145
|
x: -1,
|
|
2138
2146
|
y: -1
|
|
2139
2147
|
}), m = p(null);
|
|
@@ -2175,7 +2183,7 @@ ${X}
|
|
|
2175
2183
|
},
|
|
2176
2184
|
className: s ? "hide" : "",
|
|
2177
2185
|
children: [
|
|
2178
|
-
/* @__PURE__ */ C(
|
|
2186
|
+
/* @__PURE__ */ C(be, { onSubtitleRef: n }),
|
|
2179
2187
|
lt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2180
2188
|
css: st,
|
|
2181
2189
|
style: { ...s ? {
|
|
@@ -2223,66 +2231,68 @@ ${X}
|
|
|
2223
2231
|
O,
|
|
2224
2232
|
k,
|
|
2225
2233
|
A
|
|
2226
|
-
]),
|
|
2227
|
-
let j =
|
|
2234
|
+
]), ue(_, x, r);
|
|
2235
|
+
let { thumbnails: j, requestThumbnail: M } = pe({
|
|
2228
2236
|
publicPath: s,
|
|
2229
2237
|
workerUrl: c,
|
|
2230
2238
|
length: f === !1 ? void 0 : a,
|
|
2231
2239
|
read: u ?? l,
|
|
2232
2240
|
downloadedRanges: o
|
|
2233
|
-
}),
|
|
2241
|
+
}), N = n?.thumbnails?.all ?? j, { toggle: P, mode: F, burnedIn: I } = me(_, x), L = H((e) => e.setSourceState);
|
|
2234
2242
|
d(() => {
|
|
2235
|
-
|
|
2243
|
+
L({
|
|
2236
2244
|
title: i,
|
|
2237
2245
|
size: a,
|
|
2238
2246
|
downloadedRanges: o
|
|
2239
2247
|
});
|
|
2240
2248
|
}, [
|
|
2241
|
-
|
|
2249
|
+
L,
|
|
2242
2250
|
i,
|
|
2243
2251
|
a,
|
|
2244
2252
|
o
|
|
2245
2253
|
]);
|
|
2246
|
-
let
|
|
2254
|
+
let R = n?.thumbnails?.at;
|
|
2247
2255
|
d(() => {
|
|
2248
|
-
|
|
2249
|
-
thumbnails:
|
|
2250
|
-
thumbnailAt:
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2256
|
+
L({
|
|
2257
|
+
thumbnails: N,
|
|
2258
|
+
thumbnailAt: R,
|
|
2259
|
+
requestThumbnail: M,
|
|
2260
|
+
togglePictureInPicture: P,
|
|
2261
|
+
pictureInPictureMode: F,
|
|
2262
|
+
burnedInSubtitles: I
|
|
2254
2263
|
});
|
|
2255
2264
|
}, [
|
|
2256
|
-
I,
|
|
2257
|
-
M,
|
|
2258
2265
|
L,
|
|
2259
2266
|
N,
|
|
2267
|
+
R,
|
|
2268
|
+
M,
|
|
2260
2269
|
P,
|
|
2261
|
-
F
|
|
2270
|
+
F,
|
|
2271
|
+
I
|
|
2262
2272
|
]);
|
|
2263
|
-
let
|
|
2273
|
+
let z = n?.subtitles?.selection, B = n?.audioTracks?.selection;
|
|
2264
2274
|
return d(() => {
|
|
2265
|
-
|
|
2266
|
-
subtitleTracks:
|
|
2275
|
+
z && L({
|
|
2276
|
+
subtitleTracks: z.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2267
2277
|
id: e,
|
|
2268
2278
|
label: t,
|
|
2269
2279
|
disabled: n
|
|
2270
2280
|
})),
|
|
2271
|
-
selectedSubtitleTrack:
|
|
2272
|
-
selectSubtitleTrack: (e) =>
|
|
2273
|
-
subtitleOffLabel:
|
|
2281
|
+
selectedSubtitleTrack: z.selectedId ?? void 0,
|
|
2282
|
+
selectSubtitleTrack: (e) => z.select(e == null ? null : String(e)),
|
|
2283
|
+
subtitleOffLabel: z.offLabel
|
|
2274
2284
|
});
|
|
2275
|
-
}, [
|
|
2276
|
-
|
|
2277
|
-
audioTracks:
|
|
2285
|
+
}, [L, z]), d(() => {
|
|
2286
|
+
B && L({
|
|
2287
|
+
audioTracks: B.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2278
2288
|
id: e,
|
|
2279
2289
|
label: t,
|
|
2280
2290
|
disabled: n
|
|
2281
2291
|
})),
|
|
2282
|
-
selectedAudioTrack:
|
|
2283
|
-
selectAudioTrack: (e) =>
|
|
2292
|
+
selectedAudioTrack: B.selectedId ?? void 0,
|
|
2293
|
+
selectAudioTrack: (e) => B.select(String(e))
|
|
2284
2294
|
});
|
|
2285
|
-
}, [
|
|
2295
|
+
}, [L, B]), /* @__PURE__ */ C(ut, {
|
|
2286
2296
|
ref: g,
|
|
2287
2297
|
onVideoRef: n ? void 0 : b,
|
|
2288
2298
|
onSubtitleRef: S,
|
|
@@ -2362,7 +2372,7 @@ ${X}
|
|
|
2362
2372
|
overflow: hidden;
|
|
2363
2373
|
`, pt = (e) => /* @__PURE__ */ C("div", {
|
|
2364
2374
|
css: ft,
|
|
2365
|
-
children: /* @__PURE__ */ C(
|
|
2375
|
+
children: /* @__PURE__ */ C(V.Provider, { children: /* @__PURE__ */ C(dt, {
|
|
2366
2376
|
options: e,
|
|
2367
2377
|
children: e.children
|
|
2368
2378
|
}) })
|
|
@@ -2405,4 +2415,4 @@ ${X}
|
|
|
2405
2415
|
throw Error(`Unknown source type: ${e}`);
|
|
2406
2416
|
};
|
|
2407
2417
|
//#endregion
|
|
2408
|
-
export { pt as MediaPlayer, pt as default,
|
|
2418
|
+
export { pt as MediaPlayer, pt as default, V as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, yt as inputToRemuxerInput, ht as isDelegatedTracks, mt as isExternalThumbnails, ee as sourceFeature, i as startPlayback, me as usePictureInPicture, H as usePlayer, pe as useSeekThumbnails };
|