@banou/media-player 0.8.21 → 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 +69 -19
- package/dist/engine/index.js +1 -1
- package/dist/engine/picture-in-picture.d.ts +9 -2
- package/dist/engine/playback.d.ts +8 -1
- package/dist/engine/subtitles.d.ts +16 -5
- package/dist/engine/thumbnails.d.ts +11 -0
- package/dist/{engine-B8CKGIng.js → engine-YeMWShCv.js} +243 -182
- package/dist/index.js +235 -205
- package/dist/react/components/chrome.d.ts +2 -2
- package/dist/react/components/overlay.d.ts +2 -2
- package/dist/react/hooks/use-picture-in-picture.d.ts +6 -1
- package/dist/react/hooks/use-playback.d.ts +1 -1
- 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 +3 -4
- package/src/lib/engine/picture-in-picture.ts +24 -9
- package/src/lib/engine/playback.ts +10 -3
- package/src/lib/engine/subtitles.ts +213 -61
- package/src/lib/engine/thumbnails.ts +80 -21
- package/src/lib/react/components/chrome.tsx +16 -3
- package/src/lib/react/components/overlay.tsx +27 -8
- package/src/lib/react/components/progress-bar.tsx +17 -4
- package/src/lib/react/hooks/use-picture-in-picture.ts +10 -6
- package/src/lib/react/hooks/use-playback.ts +4 -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 +8 -6
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
|
|
@@ -179,7 +180,7 @@ var ee = {
|
|
|
179
180
|
try {
|
|
180
181
|
let n = await i({
|
|
181
182
|
videoElement: e,
|
|
182
|
-
|
|
183
|
+
subtitleContainer: t,
|
|
183
184
|
read: (e, t) => A.current(e, t),
|
|
184
185
|
length: s,
|
|
185
186
|
publicPath: c,
|
|
@@ -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,15 +280,20 @@ 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;
|
|
288
294
|
let t = a({
|
|
289
295
|
video: e,
|
|
290
|
-
|
|
296
|
+
subtitles: n,
|
|
291
297
|
mode: s,
|
|
292
298
|
onBurnedInChange: o
|
|
293
299
|
});
|
|
@@ -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,14 +342,20 @@ 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
|
-
},
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
}, he = h`
|
|
346
|
+
display: flex;
|
|
347
|
+
justify-content: center;
|
|
348
|
+
align-items: center;
|
|
349
|
+
|
|
350
|
+
canvas {
|
|
351
|
+
top: unset !important;
|
|
352
|
+
left: unset !important;
|
|
353
|
+
width: 100%;
|
|
354
|
+
height: 100%;
|
|
355
|
+
margin: auto;
|
|
356
|
+
pointer-events: none;
|
|
357
|
+
}
|
|
358
|
+
`, ge = h`
|
|
347
359
|
position: absolute;
|
|
348
360
|
top: 0;
|
|
349
361
|
left: 0;
|
|
@@ -351,7 +363,7 @@ var ee = {
|
|
|
351
363
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
352
364
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
353
365
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
354
|
-
${
|
|
366
|
+
${U.headings.small}
|
|
355
367
|
color: white;
|
|
356
368
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
357
369
|
z-index: 2;
|
|
@@ -372,7 +384,7 @@ var ee = {
|
|
|
372
384
|
|
|
373
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%);
|
|
374
386
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
375
|
-
`,
|
|
387
|
+
`, _e = h`
|
|
376
388
|
position: absolute;
|
|
377
389
|
inset: 0;
|
|
378
390
|
z-index: 2;
|
|
@@ -392,43 +404,44 @@ var ee = {
|
|
|
392
404
|
to { transform: rotate(360deg); }
|
|
393
405
|
`} 0.8s linear infinite;
|
|
394
406
|
}
|
|
395
|
-
`,
|
|
407
|
+
`, ve = h`
|
|
396
408
|
position: absolute;
|
|
397
409
|
inset: auto 0 20%;
|
|
398
410
|
z-index: 3;
|
|
399
411
|
padding: 0 calc(2 * var(--mp-unit));
|
|
400
412
|
text-align: center;
|
|
401
413
|
color: #fff;
|
|
402
|
-
${
|
|
414
|
+
${U.bLarge.regular}
|
|
403
415
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
404
416
|
pointer-events: none;
|
|
405
|
-
`,
|
|
406
|
-
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);
|
|
407
419
|
return /* @__PURE__ */ w(S, { children: [
|
|
408
420
|
t ? /* @__PURE__ */ C("div", {
|
|
409
421
|
className: "title",
|
|
410
|
-
css:
|
|
422
|
+
css: ge,
|
|
411
423
|
style: { ...n ? {
|
|
412
424
|
opacity: "0",
|
|
413
425
|
pointerEvents: "none"
|
|
414
426
|
} : {} },
|
|
415
427
|
children: t
|
|
416
428
|
}) : void 0,
|
|
417
|
-
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css:
|
|
429
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: _e }) : void 0,
|
|
418
430
|
r ? /* @__PURE__ */ C("div", {
|
|
419
|
-
css:
|
|
420
|
-
children:
|
|
431
|
+
css: ve,
|
|
432
|
+
children: ye(r)
|
|
421
433
|
}) : void 0,
|
|
422
|
-
/* @__PURE__ */ C("
|
|
434
|
+
/* @__PURE__ */ C("div", {
|
|
435
|
+
className: "subtitles",
|
|
423
436
|
ref: e,
|
|
424
|
-
css:
|
|
437
|
+
css: he
|
|
425
438
|
})
|
|
426
439
|
] });
|
|
427
|
-
},
|
|
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) => {
|
|
428
441
|
if (e === void 0) return "0:00";
|
|
429
442
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
430
443
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
431
|
-
},
|
|
444
|
+
}, Ce = (e, t) => `${K(e)} / ${K(t)}`, we = (e) => h`
|
|
432
445
|
display: flex;
|
|
433
446
|
justify-content: flex-start;
|
|
434
447
|
|
|
@@ -460,7 +473,7 @@ var ee = {
|
|
|
460
473
|
z-index: 3;
|
|
461
474
|
|
|
462
475
|
* {
|
|
463
|
-
${
|
|
476
|
+
${U.bMedium.regular}
|
|
464
477
|
}
|
|
465
478
|
|
|
466
479
|
${e === "sm" && h`
|
|
@@ -472,25 +485,25 @@ var ee = {
|
|
|
472
485
|
${e === "lg" && h`
|
|
473
486
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
474
487
|
`}
|
|
475
|
-
`,
|
|
488
|
+
`, q = {
|
|
476
489
|
x: -1,
|
|
477
490
|
y: -1,
|
|
478
491
|
anchors: 0
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
},
|
|
492
|
+
}, Te = (e) => {
|
|
493
|
+
q.x = e.clientX, q.y = e.clientY;
|
|
494
|
+
}, Ee = () => (q.anchors++ === 0 && window.addEventListener("pointermove", Te, {
|
|
482
495
|
capture: !0,
|
|
483
496
|
passive: !0
|
|
484
497
|
}), () => {
|
|
485
|
-
--
|
|
486
|
-
}),
|
|
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" }) => {
|
|
487
500
|
let l = p(null), u = p(null);
|
|
488
501
|
return d(() => {
|
|
489
|
-
let e =
|
|
502
|
+
let e = Ee(), t = () => {
|
|
490
503
|
let e = l.current;
|
|
491
504
|
if (!e) return;
|
|
492
505
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
493
|
-
|
|
506
|
+
q.x >= t && q.x < n && q.y >= r && q.y < i || u.current?.close();
|
|
494
507
|
}, n = ["fullscreenchange", "webkitfullscreenchange"];
|
|
495
508
|
for (let e of n) document.addEventListener(e, t);
|
|
496
509
|
return () => {
|
|
@@ -508,12 +521,12 @@ var ee = {
|
|
|
508
521
|
children: n
|
|
509
522
|
}), !s && /* @__PURE__ */ C(z, {
|
|
510
523
|
ref: u,
|
|
511
|
-
css:
|
|
524
|
+
css: we(c),
|
|
512
525
|
id: e,
|
|
513
526
|
noArrow: !0,
|
|
514
527
|
children: t
|
|
515
528
|
})] });
|
|
516
|
-
},
|
|
529
|
+
}, Y = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
517
530
|
let [i, a] = m(!1), o = p(t);
|
|
518
531
|
o.current = t;
|
|
519
532
|
let s = p(null), c = u((t, r) => {
|
|
@@ -552,7 +565,7 @@ var ee = {
|
|
|
552
565
|
style: { touchAction: "none" }
|
|
553
566
|
}
|
|
554
567
|
};
|
|
555
|
-
},
|
|
568
|
+
}, De = h`
|
|
556
569
|
position: relative;
|
|
557
570
|
height: calc(.4 * var(--mp-unit));
|
|
558
571
|
|
|
@@ -606,7 +619,7 @@ var ee = {
|
|
|
606
619
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
607
620
|
|
|
608
621
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
609
|
-
${
|
|
622
|
+
${U.bMedium.bold}
|
|
610
623
|
|
|
611
624
|
position: absolute;
|
|
612
625
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -723,36 +736,38 @@ var ee = {
|
|
|
723
736
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
724
737
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
725
738
|
}
|
|
726
|
-
`,
|
|
727
|
-
let e =
|
|
728
|
-
|
|
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,
|
|
729
744
|
onChange: (e) => {
|
|
730
|
-
if (
|
|
731
|
-
else if (!
|
|
732
|
-
let t =
|
|
733
|
-
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);
|
|
734
749
|
}
|
|
735
|
-
|
|
750
|
+
g(e), b.current !== "mouse" && y(e * r);
|
|
736
751
|
}
|
|
737
|
-
}),
|
|
738
|
-
|
|
739
|
-
},
|
|
740
|
-
|
|
741
|
-
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;
|
|
742
757
|
if (i !== void 0 && r) {
|
|
743
758
|
let t = i * r;
|
|
744
759
|
n ? n(t) : e.seek(t);
|
|
745
760
|
}
|
|
746
|
-
|
|
747
|
-
},
|
|
748
|
-
if (!
|
|
749
|
-
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();
|
|
750
765
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
751
|
-
},
|
|
752
|
-
|
|
753
|
-
},
|
|
754
|
-
|
|
755
|
-
},
|
|
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) => {
|
|
756
771
|
if (!i || !r) return null;
|
|
757
772
|
let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
|
|
758
773
|
if (!a || !s) return null;
|
|
@@ -768,72 +783,72 @@ var ee = {
|
|
|
768
783
|
r,
|
|
769
784
|
o.length,
|
|
770
785
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
771
|
-
]),
|
|
772
|
-
if (!
|
|
773
|
-
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);
|
|
774
789
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
775
|
-
}, [
|
|
790
|
+
}, [_]);
|
|
776
791
|
d(() => {
|
|
777
|
-
|
|
792
|
+
h === void 0 || !r || !D || !E.current || e.seek(h * r);
|
|
778
793
|
}, [
|
|
779
794
|
e,
|
|
780
|
-
|
|
781
|
-
|
|
795
|
+
D,
|
|
796
|
+
h,
|
|
782
797
|
r
|
|
783
798
|
]);
|
|
784
|
-
let
|
|
785
|
-
if (
|
|
786
|
-
if (c) return c(
|
|
787
|
-
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);
|
|
788
803
|
}
|
|
789
804
|
}, [
|
|
790
805
|
s,
|
|
791
806
|
c,
|
|
792
|
-
|
|
807
|
+
_
|
|
793
808
|
]);
|
|
794
809
|
return /* @__PURE__ */ w("div", {
|
|
795
|
-
css:
|
|
796
|
-
ref:
|
|
797
|
-
className:
|
|
798
|
-
onMouseMove:
|
|
799
|
-
onMouseOut:
|
|
810
|
+
css: De,
|
|
811
|
+
ref: u,
|
|
812
|
+
className: D ? "progress-bar dragging" : "progress-bar",
|
|
813
|
+
onMouseMove: M,
|
|
814
|
+
onMouseOut: N,
|
|
800
815
|
children: [
|
|
801
816
|
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
802
|
-
|
|
817
|
+
_ ? /* @__PURE__ */ C("div", {
|
|
803
818
|
className: "cursor-time",
|
|
804
|
-
style: { left: `clamp(calc(3 * var(--mp-unit)), ${
|
|
805
|
-
children:
|
|
819
|
+
style: { left: `clamp(calc(3 * var(--mp-unit)), ${P(_)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
820
|
+
children: I
|
|
806
821
|
}) : void 0,
|
|
807
822
|
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
808
823
|
/* @__PURE__ */ C("div", {
|
|
809
824
|
className: "loaded",
|
|
810
|
-
children:
|
|
825
|
+
children: F
|
|
811
826
|
}),
|
|
812
827
|
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
813
828
|
/* @__PURE__ */ C("div", {
|
|
814
829
|
className: "play-container",
|
|
815
830
|
children: /* @__PURE__ */ C("div", {
|
|
816
831
|
className: "play",
|
|
817
|
-
style: { transform: `scaleX(${
|
|
832
|
+
style: { transform: `scaleX(${L})` }
|
|
818
833
|
})
|
|
819
834
|
}),
|
|
820
835
|
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
821
836
|
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
822
837
|
/* @__PURE__ */ C("div", {
|
|
823
838
|
className: "padding",
|
|
824
|
-
...
|
|
825
|
-
onPointerDown:
|
|
826
|
-
onPointerUp:
|
|
827
|
-
onPointerCancel:
|
|
839
|
+
...O,
|
|
840
|
+
onPointerDown: k,
|
|
841
|
+
onPointerUp: A,
|
|
842
|
+
onPointerCancel: A
|
|
828
843
|
}),
|
|
829
844
|
/* @__PURE__ */ C("div", {
|
|
830
845
|
className: "thumbnail",
|
|
831
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
832
|
-
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
|
|
833
848
|
})
|
|
834
849
|
]
|
|
835
850
|
});
|
|
836
|
-
},
|
|
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 = {
|
|
837
852
|
xmlns: "http://www.w3.org/2000/svg",
|
|
838
853
|
width: 24,
|
|
839
854
|
height: 24,
|
|
@@ -843,8 +858,8 @@ var ee = {
|
|
|
843
858
|
strokeWidth: 2,
|
|
844
859
|
strokeLinecap: "round",
|
|
845
860
|
strokeLinejoin: "round"
|
|
846
|
-
},
|
|
847
|
-
...
|
|
861
|
+
}, je = (e) => /* @__PURE__ */ w("svg", {
|
|
862
|
+
...X,
|
|
848
863
|
...e,
|
|
849
864
|
children: [/* @__PURE__ */ C("rect", {
|
|
850
865
|
x: "3",
|
|
@@ -854,8 +869,8 @@ var ee = {
|
|
|
854
869
|
rx: "2",
|
|
855
870
|
ry: "2"
|
|
856
871
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
857
|
-
}),
|
|
858
|
-
...
|
|
872
|
+
}), Me = (e) => /* @__PURE__ */ w("svg", {
|
|
873
|
+
...X,
|
|
859
874
|
...e,
|
|
860
875
|
children: [
|
|
861
876
|
/* @__PURE__ */ C("rect", {
|
|
@@ -874,8 +889,8 @@ var ee = {
|
|
|
874
889
|
y2: "22"
|
|
875
890
|
})
|
|
876
891
|
]
|
|
877
|
-
}),
|
|
878
|
-
...
|
|
892
|
+
}), Ne = (e) => /* @__PURE__ */ w("svg", {
|
|
893
|
+
...X,
|
|
879
894
|
...e,
|
|
880
895
|
children: [
|
|
881
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" }),
|
|
@@ -889,8 +904,8 @@ var ee = {
|
|
|
889
904
|
}),
|
|
890
905
|
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
891
906
|
]
|
|
892
|
-
}),
|
|
893
|
-
...
|
|
907
|
+
}), Pe = (e) => /* @__PURE__ */ w("svg", {
|
|
908
|
+
...X,
|
|
894
909
|
...e,
|
|
895
910
|
children: [
|
|
896
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" }),
|
|
@@ -904,7 +919,7 @@ var ee = {
|
|
|
904
919
|
}),
|
|
905
920
|
/* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
|
|
906
921
|
]
|
|
907
|
-
}),
|
|
922
|
+
}), Z = h`
|
|
908
923
|
.popover {
|
|
909
924
|
position: absolute;
|
|
910
925
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -943,7 +958,7 @@ var ee = {
|
|
|
943
958
|
|
|
944
959
|
border-radius: 8px;
|
|
945
960
|
background-color: rgba(28,28,28,0.95);
|
|
946
|
-
${
|
|
961
|
+
${U.bMedium.regular}
|
|
947
962
|
|
|
948
963
|
z-index: 4;
|
|
949
964
|
|
|
@@ -986,7 +1001,7 @@ var ee = {
|
|
|
986
1001
|
|
|
987
1002
|
.secondary {
|
|
988
1003
|
color: #eee;
|
|
989
|
-
${
|
|
1004
|
+
${U.bSmall.regular}
|
|
990
1005
|
}
|
|
991
1006
|
}
|
|
992
1007
|
}
|
|
@@ -1028,10 +1043,10 @@ var ee = {
|
|
|
1028
1043
|
.failed {
|
|
1029
1044
|
border-bottom: 1px solid #4D4D4E;
|
|
1030
1045
|
color: #f66;
|
|
1031
|
-
${
|
|
1046
|
+
${U.bSmall.regular}
|
|
1032
1047
|
}
|
|
1033
1048
|
}
|
|
1034
|
-
`,
|
|
1049
|
+
`, Fe = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1035
1050
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1036
1051
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1037
1052
|
return /* @__PURE__ */ w("div", {
|
|
@@ -1058,7 +1073,7 @@ var ee = {
|
|
|
1058
1073
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1059
1074
|
]
|
|
1060
1075
|
});
|
|
1061
|
-
},
|
|
1076
|
+
}, Ie = ({ onReset: e } = {}) => {
|
|
1062
1077
|
let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
|
|
1063
1078
|
c.current = e;
|
|
1064
1079
|
let l = () => {
|
|
@@ -1115,7 +1130,7 @@ position: static;
|
|
|
1115
1130
|
}
|
|
1116
1131
|
}
|
|
1117
1132
|
|
|
1118
|
-
${
|
|
1133
|
+
${Z}
|
|
1119
1134
|
|
|
1120
1135
|
.popover.error-list {
|
|
1121
1136
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1143,7 +1158,7 @@ ${X}
|
|
|
1143
1158
|
|
|
1144
1159
|
color: #fff;
|
|
1145
1160
|
cursor: pointer;
|
|
1146
|
-
${
|
|
1161
|
+
${U.bSmall.regular}
|
|
1147
1162
|
|
|
1148
1163
|
&:hover {
|
|
1149
1164
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1164,7 +1179,7 @@ ${X}
|
|
|
1164
1179
|
|
|
1165
1180
|
.when {
|
|
1166
1181
|
color: #bbb;
|
|
1167
|
-
${
|
|
1182
|
+
${U.bSmall.regular}
|
|
1168
1183
|
|
|
1169
1184
|
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1170
1185
|
.count {
|
|
@@ -1183,11 +1198,11 @@ ${X}
|
|
|
1183
1198
|
color: #ddd;
|
|
1184
1199
|
overflow-wrap: anywhere;
|
|
1185
1200
|
white-space: pre-wrap;
|
|
1186
|
-
${
|
|
1201
|
+
${U.bSmall.regular}
|
|
1187
1202
|
}
|
|
1188
1203
|
}
|
|
1189
1204
|
}
|
|
1190
|
-
`, 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) => {
|
|
1191
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();
|
|
1192
1207
|
return [
|
|
1193
1208
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
@@ -1195,7 +1210,7 @@ ${X}
|
|
|
1195
1210
|
e.detail
|
|
1196
1211
|
].filter(Boolean).join("\n");
|
|
1197
1212
|
}).join("\n\n"), Ve = () => {
|
|
1198
|
-
let e =
|
|
1213
|
+
let e = H((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Ie(), [i, a] = m(!1);
|
|
1199
1214
|
if (e.length === 0) return null;
|
|
1200
1215
|
let o = () => {
|
|
1201
1216
|
navigator.clipboard?.writeText(Be(e)).then(() => {
|
|
@@ -1205,7 +1220,7 @@ ${X}
|
|
|
1205
1220
|
return /* @__PURE__ */ w("div", {
|
|
1206
1221
|
css: Le,
|
|
1207
1222
|
ref: r,
|
|
1208
|
-
children: [/* @__PURE__ */ C(
|
|
1223
|
+
children: [/* @__PURE__ */ C(J, {
|
|
1209
1224
|
id: "errors",
|
|
1210
1225
|
disabled: t,
|
|
1211
1226
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1310,7 +1325,7 @@ width: 100%;
|
|
|
1310
1325
|
}
|
|
1311
1326
|
}
|
|
1312
1327
|
`, Ue = () => {
|
|
1313
|
-
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({
|
|
1314
1329
|
ref: r,
|
|
1315
1330
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1316
1331
|
}), f = (t) => {
|
|
@@ -1362,7 +1377,7 @@ position: static;
|
|
|
1362
1377
|
}
|
|
1363
1378
|
}
|
|
1364
1379
|
|
|
1365
|
-
${
|
|
1380
|
+
${Z}
|
|
1366
1381
|
|
|
1367
1382
|
.playback-rate {
|
|
1368
1383
|
.slider {
|
|
@@ -1404,7 +1419,7 @@ ${X}
|
|
|
1404
1419
|
}
|
|
1405
1420
|
|
|
1406
1421
|
`, Ge = () => {
|
|
1407
|
-
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) => {
|
|
1408
1423
|
e.setPlaybackRate(t), o(0);
|
|
1409
1424
|
}, h = (e) => {
|
|
1410
1425
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1415,7 +1430,7 @@ ${X}
|
|
|
1415
1430
|
css: We,
|
|
1416
1431
|
ref: l,
|
|
1417
1432
|
children: [
|
|
1418
|
-
/* @__PURE__ */ C(
|
|
1433
|
+
/* @__PURE__ */ C(J, {
|
|
1419
1434
|
id: "settings",
|
|
1420
1435
|
disabled: s,
|
|
1421
1436
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1476,7 +1491,7 @@ ${X}
|
|
|
1476
1491
|
})
|
|
1477
1492
|
]
|
|
1478
1493
|
}),
|
|
1479
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1494
|
+
s && a === 2 && /* @__PURE__ */ C(Fe, {
|
|
1480
1495
|
title: "Audio",
|
|
1481
1496
|
tracks: n,
|
|
1482
1497
|
selected: r,
|
|
@@ -1503,15 +1518,15 @@ position: static;
|
|
|
1503
1518
|
}
|
|
1504
1519
|
}
|
|
1505
1520
|
|
|
1506
|
-
${
|
|
1521
|
+
${Z}
|
|
1507
1522
|
`, qe = () => {
|
|
1508
|
-
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();
|
|
1509
1524
|
if (e.length === 0) return null;
|
|
1510
1525
|
let u = t !== void 0;
|
|
1511
1526
|
return /* @__PURE__ */ w("div", {
|
|
1512
1527
|
css: Ke,
|
|
1513
1528
|
ref: o,
|
|
1514
|
-
children: [/* @__PURE__ */ C(
|
|
1529
|
+
children: [/* @__PURE__ */ C(J, {
|
|
1515
1530
|
id: "subtitles",
|
|
1516
1531
|
disabled: i,
|
|
1517
1532
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1521,10 +1536,10 @@ ${X}
|
|
|
1521
1536
|
"aria-label": "Subtitles",
|
|
1522
1537
|
"aria-expanded": i,
|
|
1523
1538
|
"aria-pressed": u,
|
|
1524
|
-
children: u ? /* @__PURE__ */ C(
|
|
1539
|
+
children: u ? /* @__PURE__ */ C(je, { className: "captions" }) : /* @__PURE__ */ C(Me, { className: "captions-off" })
|
|
1525
1540
|
}),
|
|
1526
1541
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1527
|
-
}), i && /* @__PURE__ */ C(
|
|
1542
|
+
}), i && /* @__PURE__ */ C(Fe, {
|
|
1528
1543
|
title: "Subtitles",
|
|
1529
1544
|
tracks: e,
|
|
1530
1545
|
selected: t,
|
|
@@ -1584,7 +1599,7 @@ ${X}
|
|
|
1584
1599
|
height: 10px;
|
|
1585
1600
|
}
|
|
1586
1601
|
`, Xe = ({ value: e, onChange: t }) => {
|
|
1587
|
-
let n =
|
|
1602
|
+
let n = H((e) => e.volume), r = H((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Y({
|
|
1588
1603
|
ref: a,
|
|
1589
1604
|
onChange: t
|
|
1590
1605
|
}), s = (n) => {
|
|
@@ -1598,8 +1613,8 @@ ${X}
|
|
|
1598
1613
|
e && e.removeEventListener("wheel", s);
|
|
1599
1614
|
};
|
|
1600
1615
|
}, [e]);
|
|
1601
|
-
let c = e * 100, l = f(() => Math.round(r ? 0 :
|
|
1602
|
-
return /* @__PURE__ */ C(
|
|
1616
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
|
|
1617
|
+
return /* @__PURE__ */ C(J, {
|
|
1603
1618
|
id: "volume-slider",
|
|
1604
1619
|
text: /* @__PURE__ */ C("div", {
|
|
1605
1620
|
ref: i,
|
|
@@ -1647,7 +1662,7 @@ ${X}
|
|
|
1647
1662
|
border-radius: 4px;
|
|
1648
1663
|
|
|
1649
1664
|
.volume-value {
|
|
1650
|
-
${
|
|
1665
|
+
${U.bMedium.regular};
|
|
1651
1666
|
color: #ffffff;
|
|
1652
1667
|
}
|
|
1653
1668
|
}
|
|
@@ -1686,10 +1701,10 @@ ${X}
|
|
|
1686
1701
|
}
|
|
1687
1702
|
|
|
1688
1703
|
`, Qe = ({ ref: e }) => {
|
|
1689
|
-
let t =
|
|
1704
|
+
let t = H(), n = H((e) => e.volume), r = H((e) => e.muted), i = f(() => G(n), [n]);
|
|
1690
1705
|
return /* @__PURE__ */ w("div", {
|
|
1691
1706
|
css: Ze,
|
|
1692
|
-
children: [/* @__PURE__ */ C(
|
|
1707
|
+
children: [/* @__PURE__ */ C(J, {
|
|
1693
1708
|
id: "sound",
|
|
1694
1709
|
text: /* @__PURE__ */ C("button", {
|
|
1695
1710
|
className: "sound",
|
|
@@ -1711,7 +1726,7 @@ ${X}
|
|
|
1711
1726
|
children: /* @__PURE__ */ C(Xe, {
|
|
1712
1727
|
value: r ? 0 : i,
|
|
1713
1728
|
onChange: (e) => {
|
|
1714
|
-
t.setVolume(
|
|
1729
|
+
t.setVolume(Se(e));
|
|
1715
1730
|
}
|
|
1716
1731
|
})
|
|
1717
1732
|
})
|
|
@@ -1833,7 +1848,7 @@ ${X}
|
|
|
1833
1848
|
|
|
1834
1849
|
.left {
|
|
1835
1850
|
.time {
|
|
1836
|
-
${
|
|
1851
|
+
${U.bMedium.regular}
|
|
1837
1852
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1838
1853
|
}
|
|
1839
1854
|
}
|
|
@@ -1855,9 +1870,9 @@ ${X}
|
|
|
1855
1870
|
}
|
|
1856
1871
|
}
|
|
1857
1872
|
`, nt = () => {
|
|
1858
|
-
let e =
|
|
1859
|
-
let r =
|
|
1860
|
-
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();
|
|
1861
1876
|
}, [e]);
|
|
1862
1877
|
d(() => {
|
|
1863
1878
|
let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
|
|
@@ -1905,12 +1920,12 @@ ${X}
|
|
|
1905
1920
|
opacity: "0",
|
|
1906
1921
|
pointerEvents: "none"
|
|
1907
1922
|
} : {} },
|
|
1908
|
-
children: [/* @__PURE__ */ C(
|
|
1923
|
+
children: [/* @__PURE__ */ C(ke, {}), /* @__PURE__ */ w("div", {
|
|
1909
1924
|
className: "actions",
|
|
1910
1925
|
children: [/* @__PURE__ */ w("div", {
|
|
1911
1926
|
className: "left",
|
|
1912
1927
|
children: [
|
|
1913
|
-
/* @__PURE__ */ C(
|
|
1928
|
+
/* @__PURE__ */ C(J, {
|
|
1914
1929
|
id: "play",
|
|
1915
1930
|
tooltipPlace: "top-start",
|
|
1916
1931
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1925,7 +1940,7 @@ ${X}
|
|
|
1925
1940
|
/* @__PURE__ */ C(Qe, { ref: h }),
|
|
1926
1941
|
/* @__PURE__ */ C("div", {
|
|
1927
1942
|
className: "time",
|
|
1928
|
-
children:
|
|
1943
|
+
children: Ce(n, r)
|
|
1929
1944
|
})
|
|
1930
1945
|
]
|
|
1931
1946
|
}), /* @__PURE__ */ w("div", {
|
|
@@ -1934,7 +1949,7 @@ ${X}
|
|
|
1934
1949
|
/* @__PURE__ */ C(Ve, {}),
|
|
1935
1950
|
/* @__PURE__ */ C(qe, {}),
|
|
1936
1951
|
/* @__PURE__ */ C(Ge, {}),
|
|
1937
|
-
o ? /* @__PURE__ */ C(
|
|
1952
|
+
o ? /* @__PURE__ */ C(J, {
|
|
1938
1953
|
id: "picture-in-picture",
|
|
1939
1954
|
tooltipPlace: "top-end",
|
|
1940
1955
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1944,8 +1959,8 @@ ${X}
|
|
|
1944
1959
|
disabled: g && !_,
|
|
1945
1960
|
"aria-label": g ? "Put the subtitles in the video" : "Picture in picture",
|
|
1946
1961
|
"aria-pressed": g ? c : void 0,
|
|
1947
|
-
children: g ? C(c ?
|
|
1948
|
-
src:
|
|
1962
|
+
children: g ? C(c ? Ne : Pe, {}) : /* @__PURE__ */ C("img", {
|
|
1963
|
+
src: Ae,
|
|
1949
1964
|
alt: ""
|
|
1950
1965
|
})
|
|
1951
1966
|
}),
|
|
@@ -1960,7 +1975,7 @@ ${X}
|
|
|
1960
1975
|
}) : null]
|
|
1961
1976
|
})
|
|
1962
1977
|
}) : null,
|
|
1963
|
-
/* @__PURE__ */ C(
|
|
1978
|
+
/* @__PURE__ */ C(J, {
|
|
1964
1979
|
id: "full-screen",
|
|
1965
1980
|
tooltipPlace: "top-end",
|
|
1966
1981
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -2015,12 +2030,12 @@ ${X}
|
|
|
2015
2030
|
}
|
|
2016
2031
|
|
|
2017
2032
|
.title {
|
|
2018
|
-
${
|
|
2033
|
+
${U.bMedium.bold}
|
|
2019
2034
|
color: #fff;
|
|
2020
2035
|
}
|
|
2021
2036
|
|
|
2022
2037
|
.body {
|
|
2023
|
-
${
|
|
2038
|
+
${U.bSmall.regular}
|
|
2024
2039
|
color: rgba(255, 255, 255, 0.75);
|
|
2025
2040
|
}
|
|
2026
2041
|
|
|
@@ -2032,7 +2047,7 @@ ${X}
|
|
|
2032
2047
|
color: #fff;
|
|
2033
2048
|
}
|
|
2034
2049
|
`, at = () => {
|
|
2035
|
-
let e =
|
|
2050
|
+
let e = H((e) => e.burnedInSubtitles), t = H((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
2036
2051
|
return d(() => {
|
|
2037
2052
|
if (t !== "burn-in" || !e) {
|
|
2038
2053
|
r(!1);
|
|
@@ -2088,6 +2103,19 @@ ${X}
|
|
|
2088
2103
|
z-index: 2;
|
|
2089
2104
|
}
|
|
2090
2105
|
|
|
2106
|
+
/* The subtitle layer sits UNDER the title and the spinner, where the canvas itself used to sit.
|
|
2107
|
+
As a plain child div it is matched by the rule above and raised to the overlay items' level,
|
|
2108
|
+
which paints subtitles over the title's gradient, over the spinner and over the error text.
|
|
2109
|
+
Naming the type as well is what takes it back: :not() carries the specificity of its argument,
|
|
2110
|
+
so the rule above is (0,2,1) and a bare .subtitles at (0,2,0) loses to it whatever the source
|
|
2111
|
+
order, while div.subtitles ties at (0,2,1) and second place in the same block then wins.
|
|
2112
|
+
subtitle-layering.browser.test.tsx measures the computed value rather than trusting this. */
|
|
2113
|
+
& > div.subtitles {
|
|
2114
|
+
inset: 0;
|
|
2115
|
+
z-index: 1;
|
|
2116
|
+
pointer-events: none;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2091
2119
|
canvas {
|
|
2092
2120
|
height: 100%;
|
|
2093
2121
|
width: 100%;
|
|
@@ -2112,8 +2140,8 @@ ${X}
|
|
|
2112
2140
|
key: r,
|
|
2113
2141
|
item: e
|
|
2114
2142
|
}];
|
|
2115
|
-
}), ut = ({ ref: e, onVideoRef: t,
|
|
2116
|
-
let o =
|
|
2143
|
+
}), ut = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
|
|
2144
|
+
let o = H(), s = H((e) => e.hideUI), c = H((e) => e.setHideUI), l = p(void 0), u = p("mouse"), f = p({
|
|
2117
2145
|
x: -1,
|
|
2118
2146
|
y: -1
|
|
2119
2147
|
}), m = p(null);
|
|
@@ -2155,7 +2183,7 @@ ${X}
|
|
|
2155
2183
|
},
|
|
2156
2184
|
className: s ? "hide" : "",
|
|
2157
2185
|
children: [
|
|
2158
|
-
/* @__PURE__ */ C(
|
|
2186
|
+
/* @__PURE__ */ C(be, { onSubtitleRef: n }),
|
|
2159
2187
|
lt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2160
2188
|
css: st,
|
|
2161
2189
|
style: { ...s ? {
|
|
@@ -2203,69 +2231,71 @@ ${X}
|
|
|
2203
2231
|
O,
|
|
2204
2232
|
k,
|
|
2205
2233
|
A
|
|
2206
|
-
]),
|
|
2207
|
-
let j =
|
|
2234
|
+
]), ue(_, x, r);
|
|
2235
|
+
let { thumbnails: j, requestThumbnail: M } = pe({
|
|
2208
2236
|
publicPath: s,
|
|
2209
2237
|
workerUrl: c,
|
|
2210
2238
|
length: f === !1 ? void 0 : a,
|
|
2211
2239
|
read: u ?? l,
|
|
2212
2240
|
downloadedRanges: o
|
|
2213
|
-
}),
|
|
2241
|
+
}), N = n?.thumbnails?.all ?? j, { toggle: P, mode: F, burnedIn: I } = me(_, x), L = H((e) => e.setSourceState);
|
|
2214
2242
|
d(() => {
|
|
2215
|
-
|
|
2243
|
+
L({
|
|
2216
2244
|
title: i,
|
|
2217
2245
|
size: a,
|
|
2218
2246
|
downloadedRanges: o
|
|
2219
2247
|
});
|
|
2220
2248
|
}, [
|
|
2221
|
-
|
|
2249
|
+
L,
|
|
2222
2250
|
i,
|
|
2223
2251
|
a,
|
|
2224
2252
|
o
|
|
2225
2253
|
]);
|
|
2226
|
-
let
|
|
2254
|
+
let R = n?.thumbnails?.at;
|
|
2227
2255
|
d(() => {
|
|
2228
|
-
|
|
2229
|
-
thumbnails:
|
|
2230
|
-
thumbnailAt:
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2256
|
+
L({
|
|
2257
|
+
thumbnails: N,
|
|
2258
|
+
thumbnailAt: R,
|
|
2259
|
+
requestThumbnail: M,
|
|
2260
|
+
togglePictureInPicture: P,
|
|
2261
|
+
pictureInPictureMode: F,
|
|
2262
|
+
burnedInSubtitles: I
|
|
2234
2263
|
});
|
|
2235
2264
|
}, [
|
|
2236
|
-
I,
|
|
2237
|
-
M,
|
|
2238
2265
|
L,
|
|
2239
2266
|
N,
|
|
2267
|
+
R,
|
|
2268
|
+
M,
|
|
2240
2269
|
P,
|
|
2241
|
-
F
|
|
2270
|
+
F,
|
|
2271
|
+
I
|
|
2242
2272
|
]);
|
|
2243
|
-
let
|
|
2273
|
+
let z = n?.subtitles?.selection, B = n?.audioTracks?.selection;
|
|
2244
2274
|
return d(() => {
|
|
2245
|
-
|
|
2246
|
-
subtitleTracks:
|
|
2275
|
+
z && L({
|
|
2276
|
+
subtitleTracks: z.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2247
2277
|
id: e,
|
|
2248
2278
|
label: t,
|
|
2249
2279
|
disabled: n
|
|
2250
2280
|
})),
|
|
2251
|
-
selectedSubtitleTrack:
|
|
2252
|
-
selectSubtitleTrack: (e) =>
|
|
2253
|
-
subtitleOffLabel:
|
|
2281
|
+
selectedSubtitleTrack: z.selectedId ?? void 0,
|
|
2282
|
+
selectSubtitleTrack: (e) => z.select(e == null ? null : String(e)),
|
|
2283
|
+
subtitleOffLabel: z.offLabel
|
|
2254
2284
|
});
|
|
2255
|
-
}, [
|
|
2256
|
-
|
|
2257
|
-
audioTracks:
|
|
2285
|
+
}, [L, z]), d(() => {
|
|
2286
|
+
B && L({
|
|
2287
|
+
audioTracks: B.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2258
2288
|
id: e,
|
|
2259
2289
|
label: t,
|
|
2260
2290
|
disabled: n
|
|
2261
2291
|
})),
|
|
2262
|
-
selectedAudioTrack:
|
|
2263
|
-
selectAudioTrack: (e) =>
|
|
2292
|
+
selectedAudioTrack: B.selectedId ?? void 0,
|
|
2293
|
+
selectAudioTrack: (e) => B.select(String(e))
|
|
2264
2294
|
});
|
|
2265
|
-
}, [
|
|
2295
|
+
}, [L, B]), /* @__PURE__ */ C(ut, {
|
|
2266
2296
|
ref: g,
|
|
2267
2297
|
onVideoRef: n ? void 0 : b,
|
|
2268
|
-
|
|
2298
|
+
onSubtitleRef: S,
|
|
2269
2299
|
overlay: e.overlay,
|
|
2270
2300
|
controls: e.controls,
|
|
2271
2301
|
children: t
|
|
@@ -2342,7 +2372,7 @@ ${X}
|
|
|
2342
2372
|
overflow: hidden;
|
|
2343
2373
|
`, pt = (e) => /* @__PURE__ */ C("div", {
|
|
2344
2374
|
css: ft,
|
|
2345
|
-
children: /* @__PURE__ */ C(
|
|
2375
|
+
children: /* @__PURE__ */ C(V.Provider, { children: /* @__PURE__ */ C(dt, {
|
|
2346
2376
|
options: e,
|
|
2347
2377
|
children: e.children
|
|
2348
2378
|
}) })
|
|
@@ -2385,4 +2415,4 @@ ${X}
|
|
|
2385
2415
|
throw Error(`Unknown source type: ${e}`);
|
|
2386
2416
|
};
|
|
2387
2417
|
//#endregion
|
|
2388
|
-
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 };
|