@banou/media-player 0.8.12 → 0.8.15
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/dist/engine/index.js +1 -1
- package/dist/engine/playback.d.ts +9 -0
- package/dist/{engine-Cownv8gD.js → engine-CDdjRm_U.js} +130 -112
- package/dist/index.js +305 -259
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +24 -0
- package/dist/react/video-player.d.ts +8 -0
- package/package.json +1 -1
- package/src/lib/engine/playback.ts +136 -3
- package/src/lib/react/components/control-bar.tsx +7 -3
- package/src/lib/react/components/progress-bar.tsx +65 -3
- package/src/lib/react/hooks/use-drag-value.ts +5 -2
- package/src/lib/react/hooks/use-playback.ts +82 -2
- package/src/lib/react/source-feature.ts +13 -0
- package/src/lib/react/video-player.tsx +8 -0
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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-CDdjRm_U.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";
|
|
5
5
|
import { definePlayerFeature as b, videoFeatures as x } from "@videojs/core/dom";
|
|
6
6
|
import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
|
|
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
|
|
8
|
-
import { Tooltip as
|
|
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 ee, VolumeX as te } from "react-feather";
|
|
8
|
+
import { Tooltip as ne } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var re = {
|
|
11
11
|
indexes: [],
|
|
12
12
|
thumbnails: [],
|
|
13
13
|
subtitleTracks: [],
|
|
@@ -25,19 +25,19 @@ var ae = {
|
|
|
25
25
|
playbackErrors: [],
|
|
26
26
|
ready: !1,
|
|
27
27
|
setSourceState: () => {}
|
|
28
|
-
},
|
|
28
|
+
}, ie = b({
|
|
29
29
|
name: "source",
|
|
30
|
-
state: () => ({ ...
|
|
30
|
+
state: () => ({ ...re }),
|
|
31
31
|
attach({ set: e }) {
|
|
32
32
|
e({
|
|
33
33
|
setSourceState: (t) => e(t),
|
|
34
34
|
setHideUI: (t) => e({ hideUI: t })
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
38
|
-
features: [...x,
|
|
37
|
+
}), L = _({
|
|
38
|
+
features: [...x, ie],
|
|
39
39
|
displayName: "MediaPlayer"
|
|
40
|
-
}),
|
|
40
|
+
}), R = L.usePlayer, ae = (e) => {
|
|
41
41
|
if (!(!e || e === "und")) try {
|
|
42
42
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
43
43
|
type: "language",
|
|
@@ -46,69 +46,89 @@ var ae = {
|
|
|
46
46
|
} catch {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
},
|
|
50
|
-
let t = e.map((e) =>
|
|
49
|
+
}, oe = (e) => e?.replace(/_/g, " ").trim() || void 0, se = (e) => {
|
|
50
|
+
let t = e.map((e) => ae(e.language) ?? oe(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
51
51
|
...e,
|
|
52
52
|
[t]: (e[t] ?? 0) + 1
|
|
53
53
|
}), {});
|
|
54
54
|
return e.map((e, r) => {
|
|
55
|
-
let i = t[r], a =
|
|
55
|
+
let i = t[r], a = oe(e.title);
|
|
56
56
|
return {
|
|
57
57
|
track: e,
|
|
58
58
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
|
-
},
|
|
61
|
+
}, ce = (e) => se(e).map(({ track: e, label: t }) => ({
|
|
62
62
|
id: e.streamIndex,
|
|
63
63
|
label: t
|
|
64
|
-
})),
|
|
64
|
+
})), le = [
|
|
65
65
|
0,
|
|
66
66
|
250,
|
|
67
67
|
1e3,
|
|
68
68
|
3e3,
|
|
69
69
|
1e4
|
|
70
|
-
],
|
|
70
|
+
], ue = 6e4, de = 500, z = (e) => e instanceof Error ? e.message : String(e), fe = (e) => {
|
|
71
71
|
let t = [], n = e?.cause;
|
|
72
72
|
for (let e = 0; n != null && e < 8; e++) {
|
|
73
73
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
74
74
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
|
-
t.push(
|
|
77
|
+
t.push(z(n)), n = n?.cause;
|
|
78
78
|
}
|
|
79
79
|
return t.length ? t.join("\n") : void 0;
|
|
80
80
|
}, pe = (e, t, r) => {
|
|
81
|
-
let a =
|
|
81
|
+
let a = R(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, seekPrepareBudgetMs: b = de } = r ?? {}, [x, S] = m(void 0), [C, w] = m(0), T = p({
|
|
82
82
|
count: 0,
|
|
83
83
|
at: 0
|
|
84
|
-
}),
|
|
85
|
-
d(() => (
|
|
84
|
+
}), E = p(void 0);
|
|
85
|
+
d(() => (T.current = {
|
|
86
86
|
count: 0,
|
|
87
87
|
at: 0
|
|
88
88
|
}, a.setSourceState({ playbackErrors: [] }), () => {
|
|
89
|
-
|
|
89
|
+
E.current && clearTimeout(E.current);
|
|
90
90
|
}), [s]);
|
|
91
|
-
let
|
|
92
|
-
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
let
|
|
91
|
+
let D = p(null), O = p(null), k = p(!1), A = p(o);
|
|
92
|
+
A.current = o;
|
|
93
|
+
let j = p(r?.onSeek);
|
|
94
|
+
j.current = r?.onSeek;
|
|
95
|
+
let M = p(r?.onPlaybackError);
|
|
96
|
+
M.current = r?.onPlaybackError;
|
|
97
|
+
let N = u((e) => {
|
|
98
98
|
let t = typeof e == "number" ? e : void 0;
|
|
99
|
-
|
|
100
|
-
}, [a]),
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
k.current = !0, a.setSourceState({ selectedSubtitleTrack: t }), D.current?.selectSubtitleStream(t);
|
|
100
|
+
}, [a]), P = u((e) => {
|
|
101
|
+
let t = D.current;
|
|
102
|
+
if (!t || b <= 0) {
|
|
103
|
+
a.seek(e);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), i = !1, o = "prepared", s = () => {
|
|
107
|
+
if (!i && (i = !0, a.seek(e), n)) {
|
|
108
|
+
let n = t.videoElement, i = 0;
|
|
109
|
+
if (n) for (let t = 0; t < n.buffered.length; t++) n.buffered.start(t) <= e + 1 && e < n.buffered.end(t) && (i = n.buffered.end(t) - e);
|
|
110
|
+
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${o}, runway ${i.toFixed(1)}s${o === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
111
|
+
}
|
|
112
|
+
}, c = setTimeout(() => {
|
|
113
|
+
o = "deadline", s();
|
|
114
|
+
}, b);
|
|
115
|
+
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
116
|
+
clearTimeout(c), s();
|
|
117
|
+
});
|
|
118
|
+
}, [a, b]), F = u((e) => {
|
|
119
|
+
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), S(e));
|
|
120
|
+
}, [a]), I = R((e) => e.setSourceState);
|
|
103
121
|
d(() => {
|
|
104
|
-
|
|
105
|
-
selectSubtitleTrack:
|
|
106
|
-
selectAudioTrack:
|
|
122
|
+
I({
|
|
123
|
+
selectSubtitleTrack: N,
|
|
124
|
+
selectAudioTrack: F,
|
|
125
|
+
requestSeek: P
|
|
107
126
|
});
|
|
108
127
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
I,
|
|
129
|
+
N,
|
|
130
|
+
F,
|
|
131
|
+
P
|
|
112
132
|
]), d(() => {
|
|
113
133
|
if (!e || !t || !s || !o) return;
|
|
114
134
|
let r = !1;
|
|
@@ -117,7 +137,7 @@ var ae = {
|
|
|
117
137
|
ready: !1
|
|
118
138
|
});
|
|
119
139
|
let u = (t, n) => {
|
|
120
|
-
let r = Date.now(), i =
|
|
140
|
+
let r = Date.now(), i = z(t), o = fe(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
121
141
|
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
122
142
|
let e = {
|
|
123
143
|
...c,
|
|
@@ -142,25 +162,25 @@ var ae = {
|
|
|
142
162
|
let t = n(e);
|
|
143
163
|
if (u(e, t), t) {
|
|
144
164
|
let t = performance.now();
|
|
145
|
-
t -
|
|
165
|
+
t - T.current.at > ue && (T.current = {
|
|
146
166
|
count: 0,
|
|
147
167
|
at: t
|
|
148
168
|
});
|
|
149
|
-
let n =
|
|
150
|
-
|
|
151
|
-
count:
|
|
169
|
+
let n = le[Math.min(T.current.count, le.length - 1)];
|
|
170
|
+
T.current = {
|
|
171
|
+
count: T.current.count + 1,
|
|
152
172
|
at: t
|
|
153
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
173
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), E.current && clearTimeout(E.current), E.current = setTimeout(() => w((e) => e + 1), n);
|
|
154
174
|
return;
|
|
155
175
|
}
|
|
156
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
176
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), M.current?.(e);
|
|
157
177
|
};
|
|
158
178
|
return (async () => {
|
|
159
179
|
try {
|
|
160
180
|
let n = await i({
|
|
161
181
|
videoElement: e,
|
|
162
182
|
canvasElement: t,
|
|
163
|
-
read: (e, t) =>
|
|
183
|
+
read: (e, t) => A.current(e, t),
|
|
164
184
|
length: s,
|
|
165
185
|
publicPath: c,
|
|
166
186
|
libavWorkerUrl: l,
|
|
@@ -169,27 +189,27 @@ var ae = {
|
|
|
169
189
|
jassubLegacyWasmUrl: g,
|
|
170
190
|
defaultFontUrl: _,
|
|
171
191
|
bufferSize: v,
|
|
172
|
-
audioStreamIndex:
|
|
192
|
+
audioStreamIndex: x,
|
|
173
193
|
onReady: () => {
|
|
174
194
|
if (r) return;
|
|
175
195
|
a.setSourceState({ ready: !0 });
|
|
176
|
-
let t =
|
|
177
|
-
|
|
196
|
+
let t = O.current;
|
|
197
|
+
O.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
178
198
|
},
|
|
179
199
|
onError: d,
|
|
180
200
|
onRecovered: () => {
|
|
181
201
|
r || a.setSourceState({ playbackError: null });
|
|
182
202
|
},
|
|
183
|
-
onSeek: (e) =>
|
|
203
|
+
onSeek: (e) => j.current?.(e),
|
|
184
204
|
onSubtitleStreams: (e) => {
|
|
185
205
|
r || a.setSourceState({
|
|
186
|
-
subtitleTracks:
|
|
187
|
-
...
|
|
206
|
+
subtitleTracks: ce(e),
|
|
207
|
+
...k.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
188
208
|
});
|
|
189
209
|
},
|
|
190
210
|
onAudioStreams: (e, t) => {
|
|
191
211
|
r || a.setSourceState({
|
|
192
|
-
audioTracks:
|
|
212
|
+
audioTracks: ce(e),
|
|
193
213
|
selectedAudioTrack: t
|
|
194
214
|
});
|
|
195
215
|
}
|
|
@@ -198,17 +218,17 @@ var ae = {
|
|
|
198
218
|
n.destroy();
|
|
199
219
|
return;
|
|
200
220
|
}
|
|
201
|
-
|
|
221
|
+
D.current = n, a.setSourceState({ indexes: n.indexes });
|
|
202
222
|
let o = a.selectedSubtitleTrack;
|
|
203
223
|
typeof o == "number" && n.selectSubtitleStream(o);
|
|
204
224
|
} catch (e) {
|
|
205
225
|
d(e);
|
|
206
226
|
}
|
|
207
227
|
})(), () => {
|
|
208
|
-
r = !0,
|
|
228
|
+
r = !0, O.current = {
|
|
209
229
|
time: e.currentTime,
|
|
210
230
|
size: s
|
|
211
|
-
},
|
|
231
|
+
}, D.current?.destroy(), D.current = null, a.setSourceState({ ready: !1 });
|
|
212
232
|
};
|
|
213
233
|
}, [
|
|
214
234
|
a,
|
|
@@ -222,11 +242,11 @@ var ae = {
|
|
|
222
242
|
g,
|
|
223
243
|
_,
|
|
224
244
|
v,
|
|
225
|
-
|
|
245
|
+
x,
|
|
226
246
|
y,
|
|
227
|
-
|
|
247
|
+
C
|
|
228
248
|
]);
|
|
229
|
-
}, me = 5e3, he = 6e4,
|
|
249
|
+
}, me = 5e3, he = 6e4, B = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
230
250
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
231
251
|
l.current = i;
|
|
232
252
|
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
@@ -261,7 +281,7 @@ var ae = {
|
|
|
261
281
|
]), d(() => {
|
|
262
282
|
c.current?.update(u);
|
|
263
283
|
}, [u]), o;
|
|
264
|
-
},
|
|
284
|
+
}, V = (e, n) => {
|
|
265
285
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
266
286
|
d(() => {
|
|
267
287
|
if (!e || !n || !s) return;
|
|
@@ -289,7 +309,7 @@ var ae = {
|
|
|
289
309
|
mode: s,
|
|
290
310
|
burnedIn: i
|
|
291
311
|
};
|
|
292
|
-
},
|
|
312
|
+
}, H = {
|
|
293
313
|
headings: {
|
|
294
314
|
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 ",
|
|
295
315
|
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 ",
|
|
@@ -331,7 +351,7 @@ var ae = {
|
|
|
331
351
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
332
352
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
333
353
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
334
|
-
${
|
|
354
|
+
${H.headings.small}
|
|
335
355
|
color: white;
|
|
336
356
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
337
357
|
z-index: 2;
|
|
@@ -379,11 +399,11 @@ var ae = {
|
|
|
379
399
|
padding: 0 calc(2 * var(--mp-unit));
|
|
380
400
|
text-align: center;
|
|
381
401
|
color: #fff;
|
|
382
|
-
${
|
|
402
|
+
${H.bLarge.regular}
|
|
383
403
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
384
404
|
pointer-events: none;
|
|
385
405
|
`, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
|
|
386
|
-
let t =
|
|
406
|
+
let t = R((e) => e.title), n = R((e) => e.hideUI), r = R((e) => e.playbackError), i = R((e) => e.ready), a = R((e) => e.size), o = R((e) => e.waiting);
|
|
387
407
|
return /* @__PURE__ */ w(S, { children: [
|
|
388
408
|
t ? /* @__PURE__ */ C("div", {
|
|
389
409
|
className: "title",
|
|
@@ -404,11 +424,11 @@ var ae = {
|
|
|
404
424
|
css: ge
|
|
405
425
|
})
|
|
406
426
|
] });
|
|
407
|
-
},
|
|
427
|
+
}, U = 1e-4, W = 1, Se = (e) => Math.max(U, Math.min(W, e)) ** 2, G = (e) => Math.max(U, Math.min(W, e)) ** (W / 2), K = (e) => {
|
|
408
428
|
if (e === void 0) return "0:00";
|
|
409
429
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
410
430
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
411
|
-
},
|
|
431
|
+
}, Ce = (e, t) => `${K(e)} / ${K(t)}`, we = (e) => h`
|
|
412
432
|
display: flex;
|
|
413
433
|
justify-content: flex-end;
|
|
414
434
|
|
|
@@ -418,7 +438,7 @@ var ae = {
|
|
|
418
438
|
z-index: 3;
|
|
419
439
|
|
|
420
440
|
* {
|
|
421
|
-
${
|
|
441
|
+
${H.bMedium.regular}
|
|
422
442
|
}
|
|
423
443
|
|
|
424
444
|
${e === "sm" && h`
|
|
@@ -438,8 +458,8 @@ var ae = {
|
|
|
438
458
|
"data-tooltip-delay-hide": i,
|
|
439
459
|
"data-tooltip-place": o,
|
|
440
460
|
children: n
|
|
441
|
-
}), !s && /* @__PURE__ */ C(
|
|
442
|
-
css:
|
|
461
|
+
}), !s && /* @__PURE__ */ C(ne, {
|
|
462
|
+
css: we(c),
|
|
443
463
|
id: e,
|
|
444
464
|
noArrow: !0,
|
|
445
465
|
children: t
|
|
@@ -452,11 +472,23 @@ var ae = {
|
|
|
452
472
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
453
473
|
return Math.min(Math.max(l, 0), 1);
|
|
454
474
|
}, [e, n]), l = u((e) => {
|
|
455
|
-
r || e.button > 0
|
|
475
|
+
if (!(r || e.button > 0)) {
|
|
476
|
+
s.current = e.pointerId;
|
|
477
|
+
try {
|
|
478
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
479
|
+
} catch {}
|
|
480
|
+
a(!0), o.current(c(e.clientX, e.clientY));
|
|
481
|
+
}
|
|
456
482
|
}, [r, c]), f = u((e) => {
|
|
457
483
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
458
484
|
}, [c]), h = u((e) => {
|
|
459
|
-
|
|
485
|
+
if (s.current === e.pointerId) {
|
|
486
|
+
s.current = null;
|
|
487
|
+
try {
|
|
488
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
489
|
+
} catch {}
|
|
490
|
+
a(!1);
|
|
491
|
+
}
|
|
460
492
|
}, []);
|
|
461
493
|
return d(() => {
|
|
462
494
|
r && (s.current = null, a(!1));
|
|
@@ -470,7 +502,7 @@ var ae = {
|
|
|
470
502
|
style: { touchAction: "none" }
|
|
471
503
|
}
|
|
472
504
|
};
|
|
473
|
-
},
|
|
505
|
+
}, Te = h`
|
|
474
506
|
position: relative;
|
|
475
507
|
height: calc(.4 * var(--mp-unit));
|
|
476
508
|
|
|
@@ -524,7 +556,7 @@ var ae = {
|
|
|
524
556
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
525
557
|
|
|
526
558
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
527
|
-
${
|
|
559
|
+
${H.bMedium.bold}
|
|
528
560
|
|
|
529
561
|
position: absolute;
|
|
530
562
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -641,29 +673,40 @@ var ae = {
|
|
|
641
673
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
642
674
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
643
675
|
}
|
|
644
|
-
`,
|
|
645
|
-
let e =
|
|
646
|
-
ref:
|
|
676
|
+
`, Ee = 4, De = () => {
|
|
677
|
+
let e = R(), t = R((e) => e.currentTime), n = R((e) => e.requestSeek), r = R((e) => e.duration), i = R((e) => e.size), a = R((e) => e.downloadedRanges), o = R((e) => e.indexes), s = R((e) => e.thumbnails), c = R((e) => e.thumbnailAt), l = p(null), [u, h] = m(void 0), [g, _] = m(void 0), v = p(void 0), y = p(0), b = p(void 0), x = p(void 0), S = p(!1), { dragging: T, handlers: E } = J({
|
|
678
|
+
ref: l,
|
|
647
679
|
onChange: (e) => {
|
|
648
|
-
|
|
680
|
+
if (y.current += 1, b.current = e, x.current === void 0) x.current = e;
|
|
681
|
+
else if (!S.current) {
|
|
682
|
+
let t = l.current?.getBoundingClientRect().width ?? 0;
|
|
683
|
+
Math.abs(e - x.current) * t > Ee && (S.current = !0);
|
|
684
|
+
}
|
|
685
|
+
h(e), v.current !== "mouse" && _(e * r);
|
|
686
|
+
}
|
|
687
|
+
}), D = (e) => {
|
|
688
|
+
v.current = e.pointerType, y.current = 0, x.current = void 0, S.current = !1, E.onPointerDown(e);
|
|
689
|
+
}, O = (t) => {
|
|
690
|
+
E.onPointerUp(t);
|
|
691
|
+
let i = y.current > 0 ? b.current : void 0;
|
|
692
|
+
if (i !== void 0 && r) {
|
|
693
|
+
let t = i * r;
|
|
694
|
+
n ? n(t) : e.seek(t);
|
|
649
695
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
let i = a.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), o = i.at(0), s = i.at(-1);
|
|
665
|
-
if (!o || !s) return null;
|
|
666
|
-
let c = o.timestamp / n, l = s.timestamp / n, u = Number((l - c).toFixed(2)), d = c * 100;
|
|
696
|
+
y.current = 0, S.current = !1, x.current = void 0, t.pointerType !== "mouse" && _(void 0);
|
|
697
|
+
}, k = (e) => {
|
|
698
|
+
if (!l.current) return;
|
|
699
|
+
let { left: t, right: n } = l.current.getBoundingClientRect();
|
|
700
|
+
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
701
|
+
}, A = (e) => {
|
|
702
|
+
_(k(e.clientX));
|
|
703
|
+
}, j = () => {
|
|
704
|
+
l.current && _(void 0);
|
|
705
|
+
}, M = (e) => r ? e / r * 100 : 0, N = f(() => a?.map((e, t) => {
|
|
706
|
+
if (!i || !r) return null;
|
|
707
|
+
let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
|
|
708
|
+
if (!a || !s) return null;
|
|
709
|
+
let c = a.timestamp / r, l = s.timestamp / r, u = Number((l - c).toFixed(2)), d = c * 100;
|
|
667
710
|
return /* @__PURE__ */ C("div", {
|
|
668
711
|
className: "loaded-part",
|
|
669
712
|
style: {
|
|
@@ -672,76 +715,75 @@ var ae = {
|
|
|
672
715
|
}
|
|
673
716
|
}, t);
|
|
674
717
|
}) ?? [], [
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
]),
|
|
679
|
-
if (!
|
|
680
|
-
let e = Math.floor(
|
|
718
|
+
r,
|
|
719
|
+
o.length,
|
|
720
|
+
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
721
|
+
]), P = f(() => {
|
|
722
|
+
if (!g || g < 0) return;
|
|
723
|
+
let e = Math.floor(g / 3600), t = Math.floor((g - e * 3600) / 60), n = Math.floor(g - e * 3600 - t * 60);
|
|
681
724
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
682
|
-
}, [
|
|
725
|
+
}, [g]);
|
|
683
726
|
d(() => {
|
|
684
|
-
|
|
685
|
-
let t = l * n;
|
|
686
|
-
e.seek(t);
|
|
727
|
+
u === void 0 || !r || !T || !S.current || e.seek(u * r);
|
|
687
728
|
}, [
|
|
688
729
|
e,
|
|
689
|
-
|
|
690
|
-
|
|
730
|
+
T,
|
|
731
|
+
u,
|
|
732
|
+
r
|
|
691
733
|
]);
|
|
692
|
-
let
|
|
693
|
-
if (
|
|
694
|
-
if (
|
|
695
|
-
if (
|
|
734
|
+
let F = f(() => !r || typeof t != "number" ? 0 : t / r, [r, t]), I = f(() => {
|
|
735
|
+
if (g) {
|
|
736
|
+
if (c) return c(g);
|
|
737
|
+
if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= g && g < t);
|
|
696
738
|
}
|
|
697
739
|
}, [
|
|
698
|
-
o,
|
|
699
740
|
s,
|
|
700
|
-
|
|
741
|
+
c,
|
|
742
|
+
g
|
|
701
743
|
]);
|
|
702
744
|
return /* @__PURE__ */ w("div", {
|
|
703
|
-
css:
|
|
704
|
-
ref:
|
|
705
|
-
className:
|
|
706
|
-
onMouseMove:
|
|
707
|
-
onMouseOut:
|
|
745
|
+
css: Te,
|
|
746
|
+
ref: l,
|
|
747
|
+
className: T ? "progress-bar dragging" : "progress-bar",
|
|
748
|
+
onMouseMove: A,
|
|
749
|
+
onMouseOut: j,
|
|
708
750
|
children: [
|
|
709
751
|
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
710
|
-
|
|
752
|
+
g ? /* @__PURE__ */ C("div", {
|
|
711
753
|
className: "cursor-time",
|
|
712
|
-
style: { left: `clamp(calc(3 * var(--mp-unit)), ${
|
|
713
|
-
children:
|
|
754
|
+
style: { left: `clamp(calc(3 * var(--mp-unit)), ${M(g)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
755
|
+
children: P
|
|
714
756
|
}) : void 0,
|
|
715
757
|
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
716
758
|
/* @__PURE__ */ C("div", {
|
|
717
759
|
className: "loaded",
|
|
718
|
-
children:
|
|
760
|
+
children: N
|
|
719
761
|
}),
|
|
720
762
|
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
721
763
|
/* @__PURE__ */ C("div", {
|
|
722
764
|
className: "play-container",
|
|
723
765
|
children: /* @__PURE__ */ C("div", {
|
|
724
766
|
className: "play",
|
|
725
|
-
style: { transform: `scaleX(${
|
|
767
|
+
style: { transform: `scaleX(${F})` }
|
|
726
768
|
})
|
|
727
769
|
}),
|
|
728
770
|
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
729
771
|
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
730
772
|
/* @__PURE__ */ C("div", {
|
|
731
773
|
className: "padding",
|
|
732
|
-
...
|
|
733
|
-
onPointerDown:
|
|
734
|
-
onPointerUp:
|
|
735
|
-
onPointerCancel:
|
|
774
|
+
...E,
|
|
775
|
+
onPointerDown: D,
|
|
776
|
+
onPointerUp: O,
|
|
777
|
+
onPointerCancel: O
|
|
736
778
|
}),
|
|
737
779
|
/* @__PURE__ */ C("div", {
|
|
738
780
|
className: "thumbnail",
|
|
739
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
740
|
-
children:
|
|
781
|
+
style: { left: `clamp(var(--thumbnail-half), ${M(g ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
782
|
+
children: I?.url ? /* @__PURE__ */ C("img", { src: I.url }) : void 0
|
|
741
783
|
})
|
|
742
784
|
]
|
|
743
785
|
});
|
|
744
|
-
},
|
|
786
|
+
}, Oe = "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", Y = {
|
|
745
787
|
xmlns: "http://www.w3.org/2000/svg",
|
|
746
788
|
width: 24,
|
|
747
789
|
height: 24,
|
|
@@ -751,7 +793,7 @@ var ae = {
|
|
|
751
793
|
strokeWidth: 2,
|
|
752
794
|
strokeLinecap: "round",
|
|
753
795
|
strokeLinejoin: "round"
|
|
754
|
-
},
|
|
796
|
+
}, ke = (e) => /* @__PURE__ */ w("svg", {
|
|
755
797
|
...Y,
|
|
756
798
|
...e,
|
|
757
799
|
children: [/* @__PURE__ */ C("rect", {
|
|
@@ -762,7 +804,7 @@ var ae = {
|
|
|
762
804
|
rx: "2",
|
|
763
805
|
ry: "2"
|
|
764
806
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
765
|
-
}),
|
|
807
|
+
}), Ae = (e) => /* @__PURE__ */ w("svg", {
|
|
766
808
|
...Y,
|
|
767
809
|
...e,
|
|
768
810
|
children: [
|
|
@@ -782,7 +824,7 @@ var ae = {
|
|
|
782
824
|
y2: "22"
|
|
783
825
|
})
|
|
784
826
|
]
|
|
785
|
-
}),
|
|
827
|
+
}), je = (e) => /* @__PURE__ */ w("svg", {
|
|
786
828
|
...Y,
|
|
787
829
|
...e,
|
|
788
830
|
children: [
|
|
@@ -836,7 +878,7 @@ var ae = {
|
|
|
836
878
|
|
|
837
879
|
border-radius: 8px;
|
|
838
880
|
background-color: rgba(28,28,28,0.95);
|
|
839
|
-
${
|
|
881
|
+
${H.bMedium.regular}
|
|
840
882
|
|
|
841
883
|
z-index: 4;
|
|
842
884
|
|
|
@@ -879,7 +921,7 @@ var ae = {
|
|
|
879
921
|
|
|
880
922
|
.secondary {
|
|
881
923
|
color: #eee;
|
|
882
|
-
${
|
|
924
|
+
${H.bSmall.regular}
|
|
883
925
|
}
|
|
884
926
|
}
|
|
885
927
|
}
|
|
@@ -921,10 +963,10 @@ var ae = {
|
|
|
921
963
|
.failed {
|
|
922
964
|
border-bottom: 1px solid #4D4D4E;
|
|
923
965
|
color: #f66;
|
|
924
|
-
${
|
|
966
|
+
${H.bSmall.regular}
|
|
925
967
|
}
|
|
926
968
|
}
|
|
927
|
-
`,
|
|
969
|
+
`, Me = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
928
970
|
let c = o !== void 0, l = (e, i, a) => {
|
|
929
971
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
930
972
|
return /* @__PURE__ */ w("div", {
|
|
@@ -992,7 +1034,7 @@ var ae = {
|
|
|
992
1034
|
});
|
|
993
1035
|
}
|
|
994
1036
|
};
|
|
995
|
-
},
|
|
1037
|
+
}, Ne = h`
|
|
996
1038
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
997
1039
|
which is the width of the player box, so it can be clamped to it. */
|
|
998
1040
|
position: static;
|
|
@@ -1036,7 +1078,7 @@ ${X}
|
|
|
1036
1078
|
|
|
1037
1079
|
color: #fff;
|
|
1038
1080
|
cursor: pointer;
|
|
1039
|
-
${
|
|
1081
|
+
${H.bSmall.regular}
|
|
1040
1082
|
|
|
1041
1083
|
&:hover {
|
|
1042
1084
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1057,7 +1099,7 @@ ${X}
|
|
|
1057
1099
|
|
|
1058
1100
|
.when {
|
|
1059
1101
|
color: #bbb;
|
|
1060
|
-
${
|
|
1102
|
+
${H.bSmall.regular}
|
|
1061
1103
|
|
|
1062
1104
|
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1063
1105
|
.count {
|
|
@@ -1076,27 +1118,27 @@ ${X}
|
|
|
1076
1118
|
color: #ddd;
|
|
1077
1119
|
overflow-wrap: anywhere;
|
|
1078
1120
|
white-space: pre-wrap;
|
|
1079
|
-
${
|
|
1121
|
+
${H.bSmall.regular}
|
|
1080
1122
|
}
|
|
1081
1123
|
}
|
|
1082
1124
|
}
|
|
1083
|
-
`,
|
|
1125
|
+
`, Pe = (e) => new Date(e).toLocaleTimeString(), Q = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : K(Math.max(0, e)), Fe = (e) => e.reduce((e, t) => e + t.count, 0), Ie = (e) => e.map((e, t) => {
|
|
1084
1126
|
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();
|
|
1085
1127
|
return [
|
|
1086
1128
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1087
1129
|
e.message,
|
|
1088
1130
|
e.detail
|
|
1089
1131
|
].filter(Boolean).join("\n");
|
|
1090
|
-
}).join("\n\n"),
|
|
1091
|
-
let e =
|
|
1132
|
+
}).join("\n\n"), Le = () => {
|
|
1133
|
+
let e = R((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
|
|
1092
1134
|
if (e.length === 0) return null;
|
|
1093
1135
|
let o = () => {
|
|
1094
|
-
navigator.clipboard?.writeText(
|
|
1136
|
+
navigator.clipboard?.writeText(Ie(e)).then(() => {
|
|
1095
1137
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1096
1138
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1097
|
-
}, s = `Playback errors (${
|
|
1139
|
+
}, s = `Playback errors (${Fe(e)})`;
|
|
1098
1140
|
return /* @__PURE__ */ w("div", {
|
|
1099
|
-
css:
|
|
1141
|
+
css: Ne,
|
|
1100
1142
|
ref: r,
|
|
1101
1143
|
children: [/* @__PURE__ */ C(q, {
|
|
1102
1144
|
id: "errors",
|
|
@@ -1127,8 +1169,8 @@ ${X}
|
|
|
1127
1169
|
/* @__PURE__ */ w("span", {
|
|
1128
1170
|
className: "when",
|
|
1129
1171
|
children: [
|
|
1130
|
-
|
|
1131
|
-
e.count > 1 ? ` to ${
|
|
1172
|
+
Pe(e.at),
|
|
1173
|
+
e.count > 1 ? ` to ${Pe(e.lastAt)}` : "",
|
|
1132
1174
|
Q(e.atMediaTime) ? ` at ${Q(e.atMediaTime)}` : "",
|
|
1133
1175
|
e.recovered ? " recovered" : "",
|
|
1134
1176
|
e.count > 1 ? /* @__PURE__ */ C("span", {
|
|
@@ -1149,7 +1191,7 @@ ${X}
|
|
|
1149
1191
|
}, `${e.at}-${t}`))]
|
|
1150
1192
|
})]
|
|
1151
1193
|
});
|
|
1152
|
-
},
|
|
1194
|
+
}, Re = h`
|
|
1153
1195
|
display: flex;
|
|
1154
1196
|
align-items: center;
|
|
1155
1197
|
justify-content: center;
|
|
@@ -1202,8 +1244,8 @@ width: 100%;
|
|
|
1202
1244
|
}
|
|
1203
1245
|
}
|
|
1204
1246
|
}
|
|
1205
|
-
`,
|
|
1206
|
-
let e =
|
|
1247
|
+
`, ze = () => {
|
|
1248
|
+
let e = R(), t = R((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 } = J({
|
|
1207
1249
|
ref: r,
|
|
1208
1250
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1209
1251
|
}), f = (t) => {
|
|
@@ -1219,7 +1261,7 @@ width: 100%;
|
|
|
1219
1261
|
}, [t]);
|
|
1220
1262
|
let m = c(s);
|
|
1221
1263
|
return /* @__PURE__ */ w("div", {
|
|
1222
|
-
css:
|
|
1264
|
+
css: Re,
|
|
1223
1265
|
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1224
1266
|
className: "playback-slider",
|
|
1225
1267
|
ref: n,
|
|
@@ -1237,7 +1279,7 @@ width: 100%;
|
|
|
1237
1279
|
})
|
|
1238
1280
|
})]
|
|
1239
1281
|
});
|
|
1240
|
-
},
|
|
1282
|
+
}, Be = h`
|
|
1241
1283
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1242
1284
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1243
1285
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1296,8 +1338,8 @@ ${X}
|
|
|
1296
1338
|
}
|
|
1297
1339
|
}
|
|
1298
1340
|
|
|
1299
|
-
`,
|
|
1300
|
-
let e =
|
|
1341
|
+
`, Ve = () => {
|
|
1342
|
+
let e = R(), t = R((e) => e.playbackRate), n = R((e) => e.audioTracks), r = R((e) => e.selectedAudioTrack), i = R((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = Z({ onReset: () => o(0) }), p = (t) => {
|
|
1301
1343
|
e.setPlaybackRate(t), o(0);
|
|
1302
1344
|
}, h = (e) => {
|
|
1303
1345
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1305,7 +1347,7 @@ ${X}
|
|
|
1305
1347
|
o(e);
|
|
1306
1348
|
};
|
|
1307
1349
|
return /* @__PURE__ */ w("div", {
|
|
1308
|
-
css:
|
|
1350
|
+
css: Be,
|
|
1309
1351
|
ref: l,
|
|
1310
1352
|
children: [
|
|
1311
1353
|
/* @__PURE__ */ C(q, {
|
|
@@ -1317,7 +1359,7 @@ ${X}
|
|
|
1317
1359
|
onClick: c,
|
|
1318
1360
|
"aria-label": "Settings",
|
|
1319
1361
|
"aria-expanded": s,
|
|
1320
|
-
children: /* @__PURE__ */ C(
|
|
1362
|
+
children: /* @__PURE__ */ C(F, {})
|
|
1321
1363
|
}),
|
|
1322
1364
|
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1323
1365
|
}),
|
|
@@ -1344,7 +1386,7 @@ ${X}
|
|
|
1344
1386
|
}),
|
|
1345
1387
|
/* @__PURE__ */ C("div", {
|
|
1346
1388
|
className: "slider no-hover",
|
|
1347
|
-
children: /* @__PURE__ */ C(
|
|
1389
|
+
children: /* @__PURE__ */ C(ze, {})
|
|
1348
1390
|
}),
|
|
1349
1391
|
/* @__PURE__ */ w("div", {
|
|
1350
1392
|
className: "options no-hover",
|
|
@@ -1369,7 +1411,7 @@ ${X}
|
|
|
1369
1411
|
})
|
|
1370
1412
|
]
|
|
1371
1413
|
}),
|
|
1372
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1414
|
+
s && a === 2 && /* @__PURE__ */ C(Me, {
|
|
1373
1415
|
title: "Audio",
|
|
1374
1416
|
tracks: n,
|
|
1375
1417
|
selected: r,
|
|
@@ -1380,7 +1422,7 @@ ${X}
|
|
|
1380
1422
|
})
|
|
1381
1423
|
]
|
|
1382
1424
|
});
|
|
1383
|
-
},
|
|
1425
|
+
}, He = h`
|
|
1384
1426
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1385
1427
|
which is the width of the player box, so it can be clamped to it. */
|
|
1386
1428
|
position: static;
|
|
@@ -1397,12 +1439,12 @@ position: static;
|
|
|
1397
1439
|
}
|
|
1398
1440
|
|
|
1399
1441
|
${X}
|
|
1400
|
-
`,
|
|
1401
|
-
let e =
|
|
1442
|
+
`, Ue = () => {
|
|
1443
|
+
let e = R((e) => e.subtitleTracks), t = R((e) => e.selectedSubtitleTrack), n = R((e) => e.selectSubtitleTrack), r = R((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
|
|
1402
1444
|
if (e.length === 0) return null;
|
|
1403
1445
|
let u = t !== void 0;
|
|
1404
1446
|
return /* @__PURE__ */ w("div", {
|
|
1405
|
-
css:
|
|
1447
|
+
css: He,
|
|
1406
1448
|
ref: o,
|
|
1407
1449
|
children: [/* @__PURE__ */ C(q, {
|
|
1408
1450
|
id: "subtitles",
|
|
@@ -1414,10 +1456,10 @@ ${X}
|
|
|
1414
1456
|
"aria-label": "Subtitles",
|
|
1415
1457
|
"aria-expanded": i,
|
|
1416
1458
|
"aria-pressed": u,
|
|
1417
|
-
children: u ? /* @__PURE__ */ C(
|
|
1459
|
+
children: u ? /* @__PURE__ */ C(ke, { className: "captions" }) : /* @__PURE__ */ C(Ae, { className: "captions-off" })
|
|
1418
1460
|
}),
|
|
1419
1461
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1420
|
-
}), i && /* @__PURE__ */ C(
|
|
1462
|
+
}), i && /* @__PURE__ */ C(Me, {
|
|
1421
1463
|
title: "Subtitles",
|
|
1422
1464
|
tracks: e,
|
|
1423
1465
|
selected: t,
|
|
@@ -1427,14 +1469,14 @@ ${X}
|
|
|
1427
1469
|
failed: c
|
|
1428
1470
|
})]
|
|
1429
1471
|
});
|
|
1430
|
-
},
|
|
1472
|
+
}, We = {
|
|
1431
1473
|
primary: "#EAEBEE",
|
|
1432
1474
|
secondary: "#D0D0D9",
|
|
1433
1475
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1434
1476
|
accent: "#6EA8FE",
|
|
1435
1477
|
borderPrimary: "#384F70",
|
|
1436
1478
|
backgroundTooltip: "#222222"
|
|
1437
|
-
},
|
|
1479
|
+
}, Ge = h`
|
|
1438
1480
|
display: flex;
|
|
1439
1481
|
align-items: center;
|
|
1440
1482
|
|
|
@@ -1477,8 +1519,8 @@ ${X}
|
|
|
1477
1519
|
width: 10px;
|
|
1478
1520
|
height: 10px;
|
|
1479
1521
|
}
|
|
1480
|
-
`,
|
|
1481
|
-
let n =
|
|
1522
|
+
`, Ke = ({ value: e, onChange: t }) => {
|
|
1523
|
+
let n = R((e) => e.volume), r = R((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
|
|
1482
1524
|
ref: a,
|
|
1483
1525
|
onChange: t
|
|
1484
1526
|
}), s = (n) => {
|
|
@@ -1497,7 +1539,7 @@ ${X}
|
|
|
1497
1539
|
id: "volume-slider",
|
|
1498
1540
|
text: /* @__PURE__ */ C("div", {
|
|
1499
1541
|
ref: i,
|
|
1500
|
-
css:
|
|
1542
|
+
css: Ge,
|
|
1501
1543
|
...o,
|
|
1502
1544
|
children: /* @__PURE__ */ C("div", {
|
|
1503
1545
|
ref: a,
|
|
@@ -1516,7 +1558,7 @@ ${X}
|
|
|
1516
1558
|
children: [l, "%"]
|
|
1517
1559
|
})
|
|
1518
1560
|
});
|
|
1519
|
-
},
|
|
1561
|
+
}, qe = h`
|
|
1520
1562
|
position: relative;
|
|
1521
1563
|
display: flex;
|
|
1522
1564
|
align-items: center;
|
|
@@ -1541,7 +1583,7 @@ ${X}
|
|
|
1541
1583
|
border-radius: 4px;
|
|
1542
1584
|
|
|
1543
1585
|
.volume-value {
|
|
1544
|
-
${
|
|
1586
|
+
${H.bMedium.regular};
|
|
1545
1587
|
color: #ffffff;
|
|
1546
1588
|
}
|
|
1547
1589
|
}
|
|
@@ -1579,10 +1621,10 @@ ${X}
|
|
|
1579
1621
|
}
|
|
1580
1622
|
}
|
|
1581
1623
|
|
|
1582
|
-
`,
|
|
1583
|
-
let t =
|
|
1624
|
+
`, Je = ({ ref: e }) => {
|
|
1625
|
+
let t = R(), n = R((e) => e.volume), r = R((e) => e.muted), i = f(() => G(n), [n]);
|
|
1584
1626
|
return /* @__PURE__ */ w("div", {
|
|
1585
|
-
css:
|
|
1627
|
+
css: qe,
|
|
1586
1628
|
children: [/* @__PURE__ */ C(q, {
|
|
1587
1629
|
id: "sound",
|
|
1588
1630
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1592,7 +1634,7 @@ ${X}
|
|
|
1592
1634
|
ref: e,
|
|
1593
1635
|
"aria-label": "Mute",
|
|
1594
1636
|
"aria-pressed": r || n === 0,
|
|
1595
|
-
children: C(r || n === 0 ?
|
|
1637
|
+
children: C(r || n === 0 ? te : n <= .5 ? I : ee, {
|
|
1596
1638
|
size: 18,
|
|
1597
1639
|
color: "#fff"
|
|
1598
1640
|
})
|
|
@@ -1602,16 +1644,16 @@ ${X}
|
|
|
1602
1644
|
className: "volume-slider-container",
|
|
1603
1645
|
children: /* @__PURE__ */ C("div", {
|
|
1604
1646
|
className: "volume-slider-background",
|
|
1605
|
-
children: /* @__PURE__ */ C(
|
|
1647
|
+
children: /* @__PURE__ */ C(Ke, {
|
|
1606
1648
|
value: r ? 0 : i,
|
|
1607
1649
|
onChange: (e) => {
|
|
1608
|
-
t.setVolume(
|
|
1650
|
+
t.setVolume(Se(e));
|
|
1609
1651
|
}
|
|
1610
1652
|
})
|
|
1611
1653
|
})
|
|
1612
1654
|
})]
|
|
1613
1655
|
});
|
|
1614
|
-
}, $ = .05,
|
|
1656
|
+
}, $ = .05, Ye = 5, Xe = h`
|
|
1615
1657
|
display: flex;
|
|
1616
1658
|
flex-direction: column;
|
|
1617
1659
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1622,7 +1664,7 @@ ${X}
|
|
|
1622
1664
|
opacity: 0.72;
|
|
1623
1665
|
font-size: 0.9em;
|
|
1624
1666
|
}
|
|
1625
|
-
`,
|
|
1667
|
+
`, Ze = h`
|
|
1626
1668
|
position: absolute;
|
|
1627
1669
|
bottom: 0;
|
|
1628
1670
|
width: 100%;
|
|
@@ -1687,7 +1729,7 @@ ${X}
|
|
|
1687
1729
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1688
1730
|
*/
|
|
1689
1731
|
button[aria-pressed='true'] svg {
|
|
1690
|
-
stroke: ${
|
|
1732
|
+
stroke: ${We.accent};
|
|
1691
1733
|
}
|
|
1692
1734
|
|
|
1693
1735
|
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
@@ -1722,7 +1764,7 @@ ${X}
|
|
|
1722
1764
|
cursor: pointer;
|
|
1723
1765
|
|
|
1724
1766
|
:hover {
|
|
1725
|
-
background-color: ${
|
|
1767
|
+
background-color: ${We.hover};
|
|
1726
1768
|
}
|
|
1727
1769
|
|
|
1728
1770
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1739,7 +1781,7 @@ ${X}
|
|
|
1739
1781
|
|
|
1740
1782
|
.left {
|
|
1741
1783
|
.time {
|
|
1742
|
-
${
|
|
1784
|
+
${H.bMedium.regular}
|
|
1743
1785
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1744
1786
|
}
|
|
1745
1787
|
}
|
|
@@ -1760,54 +1802,58 @@ ${X}
|
|
|
1760
1802
|
}
|
|
1761
1803
|
}
|
|
1762
1804
|
}
|
|
1763
|
-
`,
|
|
1764
|
-
let e =
|
|
1805
|
+
`, Qe = () => {
|
|
1806
|
+
let e = R(), t = R((e) => e.paused), n = R((e) => e.currentTime), r = R((e) => e.duration), i = R((e) => e.fullscreen), a = R((e) => e.hideUI), o = R((e) => e.togglePictureInPicture), s = R((e) => e.pictureInPictureMode), c = R((e) => e.burnedInSubtitles), l = R((e) => e.subtitleTracks), f = R((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 }) => {
|
|
1765
1807
|
let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1766
|
-
e.setVolume(
|
|
1808
|
+
e.setVolume(Se(a)), o && !e.muted && e.toggleMuted();
|
|
1767
1809
|
}, [e]);
|
|
1768
1810
|
d(() => {
|
|
1769
|
-
let t = (t) => {
|
|
1770
|
-
let
|
|
1771
|
-
if (
|
|
1772
|
-
let
|
|
1773
|
-
if (
|
|
1774
|
-
else if (
|
|
1775
|
-
else if (
|
|
1776
|
-
else if (
|
|
1777
|
-
else if (
|
|
1811
|
+
let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
|
|
1812
|
+
let r = n.target;
|
|
1813
|
+
if (r?.isContentEditable || /^(input|textarea|select)$/i.test(r?.tagName ?? "")) return;
|
|
1814
|
+
let i = !0;
|
|
1815
|
+
if (n.key === "f") e.toggleFullscreen();
|
|
1816
|
+
else if (n.key === "k") e.togglePaused();
|
|
1817
|
+
else if (n.key === " ") e.togglePaused();
|
|
1818
|
+
else if (n.key === "m") e.toggleMuted();
|
|
1819
|
+
else if (n.key === "ArrowUp") y({
|
|
1778
1820
|
direction: "up",
|
|
1779
1821
|
stepSize: $
|
|
1780
1822
|
});
|
|
1781
|
-
else if (
|
|
1823
|
+
else if (n.key === "ArrowDown") y({
|
|
1782
1824
|
direction: "down",
|
|
1783
1825
|
stepSize: $
|
|
1784
1826
|
});
|
|
1785
|
-
else if (
|
|
1827
|
+
else if (n.key === "ArrowRight") {
|
|
1786
1828
|
if (!e.duration) return;
|
|
1787
|
-
|
|
1788
|
-
} else
|
|
1789
|
-
|
|
1829
|
+
t(Math.min(e.currentTime + Ye, e.duration));
|
|
1830
|
+
} else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - Ye, 0)) : i = !1;
|
|
1831
|
+
i && n.preventDefault();
|
|
1790
1832
|
};
|
|
1791
|
-
return window.addEventListener("keydown",
|
|
1792
|
-
}, [
|
|
1793
|
-
|
|
1794
|
-
|
|
1833
|
+
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
1834
|
+
}, [
|
|
1835
|
+
e,
|
|
1836
|
+
y,
|
|
1837
|
+
f
|
|
1838
|
+
]);
|
|
1839
|
+
let b = u((e) => {
|
|
1840
|
+
e.preventDefault(), e.deltaY < 0 ? y({
|
|
1795
1841
|
direction: "up",
|
|
1796
1842
|
stepSize: $
|
|
1797
|
-
}) :
|
|
1843
|
+
}) : y({
|
|
1798
1844
|
direction: "down",
|
|
1799
1845
|
stepSize: $
|
|
1800
1846
|
});
|
|
1801
|
-
}, [
|
|
1847
|
+
}, [y]);
|
|
1802
1848
|
return d(() => {
|
|
1803
|
-
if (
|
|
1804
|
-
}, [
|
|
1805
|
-
css:
|
|
1849
|
+
if (p) return p.addEventListener("wheel", b, { passive: !1 }), () => p.removeEventListener("wheel", b);
|
|
1850
|
+
}, [p, b]), /* @__PURE__ */ w("div", {
|
|
1851
|
+
css: Ze,
|
|
1806
1852
|
style: { ...a ? {
|
|
1807
1853
|
opacity: "0",
|
|
1808
1854
|
pointerEvents: "none"
|
|
1809
1855
|
} : {} },
|
|
1810
|
-
children: [/* @__PURE__ */ C(
|
|
1856
|
+
children: [/* @__PURE__ */ C(De, {}), /* @__PURE__ */ w("div", {
|
|
1811
1857
|
className: "actions",
|
|
1812
1858
|
children: [/* @__PURE__ */ w("div", {
|
|
1813
1859
|
className: "left",
|
|
@@ -1819,23 +1865,23 @@ ${X}
|
|
|
1819
1865
|
className: "play",
|
|
1820
1866
|
type: "button",
|
|
1821
1867
|
onClick: () => e.togglePaused(),
|
|
1822
|
-
"aria-label":
|
|
1823
|
-
children: C(
|
|
1868
|
+
"aria-label": v ? "Replay" : t ? "Play" : "Pause",
|
|
1869
|
+
children: C(v ? P : t ? N : M, {})
|
|
1824
1870
|
}),
|
|
1825
|
-
toolTipText: /* @__PURE__ */ C("span", { children:
|
|
1871
|
+
toolTipText: /* @__PURE__ */ C("span", { children: v ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1826
1872
|
}),
|
|
1827
|
-
/* @__PURE__ */ C(
|
|
1873
|
+
/* @__PURE__ */ C(Je, { ref: h }),
|
|
1828
1874
|
/* @__PURE__ */ C("div", {
|
|
1829
1875
|
className: "time",
|
|
1830
|
-
children:
|
|
1876
|
+
children: Ce(n, r)
|
|
1831
1877
|
})
|
|
1832
1878
|
]
|
|
1833
1879
|
}), /* @__PURE__ */ w("div", {
|
|
1834
1880
|
className: "right",
|
|
1835
1881
|
children: [
|
|
1836
|
-
/* @__PURE__ */ C(
|
|
1882
|
+
/* @__PURE__ */ C(Le, {}),
|
|
1883
|
+
/* @__PURE__ */ C(Ue, {}),
|
|
1837
1884
|
/* @__PURE__ */ C(Ve, {}),
|
|
1838
|
-
/* @__PURE__ */ C(ze, {}),
|
|
1839
1885
|
o ? /* @__PURE__ */ C(q, {
|
|
1840
1886
|
id: "picture-in-picture",
|
|
1841
1887
|
tooltipPlace: "top-end",
|
|
@@ -1843,20 +1889,20 @@ ${X}
|
|
|
1843
1889
|
className: "picture-in-picture",
|
|
1844
1890
|
type: "button",
|
|
1845
1891
|
onClick: o,
|
|
1846
|
-
disabled:
|
|
1847
|
-
"aria-label":
|
|
1848
|
-
"aria-pressed":
|
|
1849
|
-
children:
|
|
1850
|
-
src:
|
|
1892
|
+
disabled: g && !_,
|
|
1893
|
+
"aria-label": g ? "Put the subtitles in the video" : "Picture in picture",
|
|
1894
|
+
"aria-pressed": g ? c : void 0,
|
|
1895
|
+
children: g ? /* @__PURE__ */ C(je, {}) : /* @__PURE__ */ C("img", {
|
|
1896
|
+
src: Oe,
|
|
1851
1897
|
alt: ""
|
|
1852
1898
|
})
|
|
1853
1899
|
}),
|
|
1854
1900
|
toolTipText: /* @__PURE__ */ w("span", {
|
|
1855
|
-
css:
|
|
1901
|
+
css: Xe,
|
|
1856
1902
|
children: [/* @__PURE__ */ C("span", {
|
|
1857
1903
|
className: "lead",
|
|
1858
|
-
children:
|
|
1859
|
-
}),
|
|
1904
|
+
children: g ? _ ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
|
|
1905
|
+
}), g && _ ? /* @__PURE__ */ C("span", {
|
|
1860
1906
|
className: "hint",
|
|
1861
1907
|
children: "Then hover the video and click your browser's own pop out button"
|
|
1862
1908
|
}) : null]
|
|
@@ -1879,7 +1925,7 @@ ${X}
|
|
|
1879
1925
|
})]
|
|
1880
1926
|
})]
|
|
1881
1927
|
});
|
|
1882
|
-
},
|
|
1928
|
+
}, $e = 9e3, et = h`
|
|
1883
1929
|
position: absolute;
|
|
1884
1930
|
inset: 0;
|
|
1885
1931
|
z-index: 2;
|
|
@@ -1917,12 +1963,12 @@ ${X}
|
|
|
1917
1963
|
}
|
|
1918
1964
|
|
|
1919
1965
|
.title {
|
|
1920
|
-
${
|
|
1966
|
+
${H.bMedium.bold}
|
|
1921
1967
|
color: #fff;
|
|
1922
1968
|
}
|
|
1923
1969
|
|
|
1924
1970
|
.body {
|
|
1925
|
-
${
|
|
1971
|
+
${H.bSmall.regular}
|
|
1926
1972
|
color: rgba(255, 255, 255, 0.75);
|
|
1927
1973
|
}
|
|
1928
1974
|
|
|
@@ -1933,18 +1979,18 @@ ${X}
|
|
|
1933
1979
|
line-height: 1;
|
|
1934
1980
|
color: #6EA8FE;
|
|
1935
1981
|
}
|
|
1936
|
-
`,
|
|
1937
|
-
let e =
|
|
1982
|
+
`, tt = () => {
|
|
1983
|
+
let e = R((e) => e.burnedInSubtitles), t = R((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1938
1984
|
return d(() => {
|
|
1939
1985
|
if (t !== "burn-in" || !e) {
|
|
1940
1986
|
r(!1);
|
|
1941
1987
|
return;
|
|
1942
1988
|
}
|
|
1943
1989
|
r(!0);
|
|
1944
|
-
let n = setTimeout(() => r(!1),
|
|
1990
|
+
let n = setTimeout(() => r(!1), $e);
|
|
1945
1991
|
return () => clearTimeout(n);
|
|
1946
1992
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1947
|
-
css:
|
|
1993
|
+
css: et,
|
|
1948
1994
|
className: n ? "show" : "",
|
|
1949
1995
|
role: "status",
|
|
1950
1996
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -1965,7 +2011,7 @@ ${X}
|
|
|
1965
2011
|
})]
|
|
1966
2012
|
})
|
|
1967
2013
|
});
|
|
1968
|
-
},
|
|
2014
|
+
}, nt = 3e3, rt = h`
|
|
1969
2015
|
position: absolute;
|
|
1970
2016
|
inset: 0;
|
|
1971
2017
|
z-index: 2;
|
|
@@ -1976,7 +2022,7 @@ ${X}
|
|
|
1976
2022
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1977
2023
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1978
2024
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1979
|
-
`,
|
|
2025
|
+
`, it = h`
|
|
1980
2026
|
position: relative;
|
|
1981
2027
|
background-color: black;
|
|
1982
2028
|
display: flex;
|
|
@@ -2008,20 +2054,20 @@ ${X}
|
|
|
2008
2054
|
&.hide {
|
|
2009
2055
|
cursor: none;
|
|
2010
2056
|
}
|
|
2011
|
-
`,
|
|
2057
|
+
`, at = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
2012
2058
|
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
2013
|
-
return l(e) && e.type === c ?
|
|
2059
|
+
return l(e) && e.type === c ? at(e.props.children, `${r}/`) : [{
|
|
2014
2060
|
key: r,
|
|
2015
2061
|
item: e
|
|
2016
2062
|
}];
|
|
2017
|
-
}),
|
|
2018
|
-
let o =
|
|
2063
|
+
}), ot = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
2064
|
+
let o = R(), s = R((e) => e.hideUI), c = R((e) => e.setHideUI), l = p(void 0), u = p("mouse");
|
|
2019
2065
|
d(() => () => clearTimeout(l.current), []);
|
|
2020
2066
|
let f = () => {
|
|
2021
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
2067
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), nt);
|
|
2022
2068
|
};
|
|
2023
2069
|
return /* @__PURE__ */ w("div", {
|
|
2024
|
-
css:
|
|
2070
|
+
css: it,
|
|
2025
2071
|
ref: e,
|
|
2026
2072
|
onPointerMove: (e) => {
|
|
2027
2073
|
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
@@ -2038,8 +2084,8 @@ ${X}
|
|
|
2038
2084
|
className: s ? "hide" : "",
|
|
2039
2085
|
children: [
|
|
2040
2086
|
/* @__PURE__ */ C(xe, { onCanvasRef: n }),
|
|
2041
|
-
|
|
2042
|
-
css:
|
|
2087
|
+
at(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2088
|
+
css: rt,
|
|
2043
2089
|
style: { ...s ? {
|
|
2044
2090
|
opacity: "0",
|
|
2045
2091
|
visibility: "hidden",
|
|
@@ -2047,8 +2093,8 @@ ${X}
|
|
|
2047
2093
|
} : {} },
|
|
2048
2094
|
children: t
|
|
2049
2095
|
}, e)),
|
|
2050
|
-
i === !1 ? null : /* @__PURE__ */ C(
|
|
2051
|
-
/* @__PURE__ */ C(
|
|
2096
|
+
i === !1 ? null : /* @__PURE__ */ C(Qe, {}),
|
|
2097
|
+
/* @__PURE__ */ C(tt, {}),
|
|
2052
2098
|
/* @__PURE__ */ w("div", {
|
|
2053
2099
|
className: "video",
|
|
2054
2100
|
onClick: () => {
|
|
@@ -2065,16 +2111,16 @@ ${X}
|
|
|
2065
2111
|
})
|
|
2066
2112
|
]
|
|
2067
2113
|
});
|
|
2068
|
-
},
|
|
2114
|
+
}, st = ({ options: e, children: t }) => {
|
|
2069
2115
|
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: l, thumbnailRead: u, thumbnailsEnabled: f } = r ?? {}, p = y(), h = v(), [g, _] = m(null), [b, x] = m(null), S = n?.media ?? g;
|
|
2070
2116
|
d(() => (p?.(S), () => p?.(null)), [S, p]), pe(g, b, r);
|
|
2071
|
-
let w =
|
|
2117
|
+
let w = B({
|
|
2072
2118
|
publicPath: s,
|
|
2073
2119
|
workerUrl: c,
|
|
2074
2120
|
length: f === !1 ? void 0 : a,
|
|
2075
2121
|
read: u ?? l,
|
|
2076
2122
|
downloadedRanges: o
|
|
2077
|
-
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } =
|
|
2123
|
+
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = V(g, b), k = R((e) => e.setSourceState);
|
|
2078
2124
|
d(() => {
|
|
2079
2125
|
k({
|
|
2080
2126
|
title: i,
|
|
@@ -2126,7 +2172,7 @@ ${X}
|
|
|
2126
2172
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
2127
2173
|
selectAudioTrack: (e) => M.select(String(e))
|
|
2128
2174
|
});
|
|
2129
|
-
}, [k, M]), /* @__PURE__ */ C(
|
|
2175
|
+
}, [k, M]), /* @__PURE__ */ C(ot, {
|
|
2130
2176
|
ref: h,
|
|
2131
2177
|
onVideoRef: n ? void 0 : _,
|
|
2132
2178
|
onCanvasRef: x,
|
|
@@ -2134,7 +2180,7 @@ ${X}
|
|
|
2134
2180
|
controls: e.controls,
|
|
2135
2181
|
children: t
|
|
2136
2182
|
});
|
|
2137
|
-
},
|
|
2183
|
+
}, ct = h`
|
|
2138
2184
|
/**
|
|
2139
2185
|
* The chrome's whole scale, in one place.
|
|
2140
2186
|
*
|
|
@@ -2204,17 +2250,17 @@ ${X}
|
|
|
2204
2250
|
height: 100%;
|
|
2205
2251
|
width: 100%;
|
|
2206
2252
|
overflow: hidden;
|
|
2207
|
-
`,
|
|
2208
|
-
css:
|
|
2209
|
-
children: /* @__PURE__ */ C(
|
|
2253
|
+
`, lt = (e) => /* @__PURE__ */ C("div", {
|
|
2254
|
+
css: ct,
|
|
2255
|
+
children: /* @__PURE__ */ C(L.Provider, { children: /* @__PURE__ */ C(st, {
|
|
2210
2256
|
options: e,
|
|
2211
2257
|
children: e.children
|
|
2212
2258
|
}) })
|
|
2213
|
-
}),
|
|
2259
|
+
}), ut = (e) => !!e && typeof e == "object" && "at" in e, dt = (e) => !!e && typeof e == "object" && "selection" in e, ft = ({ blob: e, name: t }) => ({
|
|
2214
2260
|
length: e.size,
|
|
2215
2261
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2216
2262
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2217
|
-
}),
|
|
2263
|
+
}), pt = async (e, t) => {
|
|
2218
2264
|
let n = await fetch(e, {
|
|
2219
2265
|
headers: { Range: "bytes=0-1" },
|
|
2220
2266
|
credentials: t
|
|
@@ -2224,8 +2270,8 @@ ${X}
|
|
|
2224
2270
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2225
2271
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2226
2272
|
return i;
|
|
2227
|
-
},
|
|
2228
|
-
let i = t ?? await
|
|
2273
|
+
}, mt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2274
|
+
let i = t ?? await pt(e, r);
|
|
2229
2275
|
return {
|
|
2230
2276
|
length: i,
|
|
2231
2277
|
name: n,
|
|
@@ -2238,9 +2284,9 @@ ${X}
|
|
|
2238
2284
|
return a.arrayBuffer();
|
|
2239
2285
|
}
|
|
2240
2286
|
};
|
|
2241
|
-
},
|
|
2242
|
-
if ("blob" in e) return
|
|
2243
|
-
if ("url" in e) return
|
|
2287
|
+
}, ht = async (e) => {
|
|
2288
|
+
if ("blob" in e) return ft(e);
|
|
2289
|
+
if ("url" in e) return mt(e);
|
|
2244
2290
|
if ("read" in e) return {
|
|
2245
2291
|
length: e.length,
|
|
2246
2292
|
name: e.name,
|
|
@@ -2249,4 +2295,4 @@ ${X}
|
|
|
2249
2295
|
throw Error(`Unknown source type: ${e}`);
|
|
2250
2296
|
};
|
|
2251
2297
|
//#endregion
|
|
2252
|
-
export {
|
|
2298
|
+
export { lt as MediaPlayer, lt as default, L as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, ht as inputToRemuxerInput, dt as isDelegatedTracks, ut as isExternalThumbnails, ie as sourceFeature, i as startPlayback, V as usePictureInPicture, R as usePlayer, B as useSeekThumbnails };
|