@banou/media-player 0.8.12 → 0.8.13
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 +7 -0
- package/dist/{engine-Cownv8gD.js → engine-BUcS6UrE.js} +127 -116
- package/dist/index.js +282 -258
- 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 +63 -0
- package/src/lib/react/components/control-bar.tsx +7 -3
- package/src/lib/react/components/progress-bar.tsx +7 -2
- package/src/lib/react/hooks/use-playback.ts +68 -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-BUcS6UrE.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 L, VolumeX as ee } from "react-feather";
|
|
8
|
+
import { Tooltip as te } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var ne = {
|
|
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
|
+
}, re = b({
|
|
29
29
|
name: "source",
|
|
30
|
-
state: () => ({ ...
|
|
30
|
+
state: () => ({ ...ne }),
|
|
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
|
+
}), R = _({
|
|
38
|
+
features: [...x, re],
|
|
39
39
|
displayName: "MediaPlayer"
|
|
40
|
-
}),
|
|
40
|
+
}), z = R.usePlayer, ie = (e) => {
|
|
41
41
|
if (!(!e || e === "und")) try {
|
|
42
42
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
43
43
|
type: "language",
|
|
@@ -46,69 +46,88 @@ var ae = {
|
|
|
46
46
|
} catch {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
},
|
|
50
|
-
let t = e.map((e) =>
|
|
49
|
+
}, B = (e) => e?.replace(/_/g, " ").trim() || void 0, ae = (e) => {
|
|
50
|
+
let t = e.map((e) => ie(e.language) ?? B(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 = B(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
|
+
}, V = (e) => ae(e).map(({ track: e, label: t }) => ({
|
|
62
62
|
id: e.streamIndex,
|
|
63
63
|
label: t
|
|
64
|
-
})),
|
|
64
|
+
})), H = [
|
|
65
65
|
0,
|
|
66
66
|
250,
|
|
67
67
|
1e3,
|
|
68
68
|
3e3,
|
|
69
69
|
1e4
|
|
70
|
-
],
|
|
70
|
+
], oe = 6e4, se = 500, ce = 250, le = (e) => e instanceof Error ? e.message : String(e), ue = (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(le(n)), n = n?.cause;
|
|
78
78
|
}
|
|
79
79
|
return t.length ? t.join("\n") : void 0;
|
|
80
|
-
},
|
|
81
|
-
let a =
|
|
80
|
+
}, de = (e, t, r) => {
|
|
81
|
+
let a = z(), { 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
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(0), A = p(!1), j = p(o);
|
|
92
|
+
j.current = o;
|
|
93
|
+
let M = p(r?.onSeek);
|
|
94
|
+
M.current = r?.onSeek;
|
|
95
|
+
let N = p(r?.onPlaybackError);
|
|
96
|
+
N.current = r?.onPlaybackError;
|
|
97
|
+
let P = u((e) => {
|
|
98
98
|
let t = typeof e == "number" ? e : void 0;
|
|
99
|
-
|
|
100
|
-
}, [a]),
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
A.current = !0, a.setSourceState({ selectedSubtitleTrack: t }), D.current?.selectSubtitleStream(t);
|
|
100
|
+
}, [a]), F = u((e) => {
|
|
101
|
+
let t = D.current;
|
|
102
|
+
if (!t || b <= 0) {
|
|
103
|
+
a.seek(e);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let n = performance.now(), r = n - k.current < ce;
|
|
107
|
+
if (k.current = n, r) {
|
|
108
|
+
a.seek(e);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
let i = !1, o = () => {
|
|
112
|
+
i || (i = !0, a.seek(e));
|
|
113
|
+
}, s = setTimeout(o, b);
|
|
114
|
+
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
115
|
+
clearTimeout(s), o();
|
|
116
|
+
});
|
|
117
|
+
}, [a, b]), I = u((e) => {
|
|
118
|
+
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), S(e));
|
|
119
|
+
}, [a]), L = z((e) => e.setSourceState);
|
|
103
120
|
d(() => {
|
|
104
|
-
|
|
105
|
-
selectSubtitleTrack:
|
|
106
|
-
selectAudioTrack:
|
|
121
|
+
L({
|
|
122
|
+
selectSubtitleTrack: P,
|
|
123
|
+
selectAudioTrack: I,
|
|
124
|
+
requestSeek: F
|
|
107
125
|
});
|
|
108
126
|
}, [
|
|
127
|
+
L,
|
|
109
128
|
P,
|
|
110
|
-
|
|
111
|
-
|
|
129
|
+
I,
|
|
130
|
+
F
|
|
112
131
|
]), d(() => {
|
|
113
132
|
if (!e || !t || !s || !o) return;
|
|
114
133
|
let r = !1;
|
|
@@ -117,7 +136,7 @@ var ae = {
|
|
|
117
136
|
ready: !1
|
|
118
137
|
});
|
|
119
138
|
let u = (t, n) => {
|
|
120
|
-
let r = Date.now(), i =
|
|
139
|
+
let r = Date.now(), i = le(t), o = ue(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
121
140
|
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
122
141
|
let e = {
|
|
123
142
|
...c,
|
|
@@ -142,25 +161,25 @@ var ae = {
|
|
|
142
161
|
let t = n(e);
|
|
143
162
|
if (u(e, t), t) {
|
|
144
163
|
let t = performance.now();
|
|
145
|
-
t -
|
|
164
|
+
t - T.current.at > oe && (T.current = {
|
|
146
165
|
count: 0,
|
|
147
166
|
at: t
|
|
148
167
|
});
|
|
149
|
-
let n =
|
|
150
|
-
|
|
151
|
-
count:
|
|
168
|
+
let n = H[Math.min(T.current.count, H.length - 1)];
|
|
169
|
+
T.current = {
|
|
170
|
+
count: T.current.count + 1,
|
|
152
171
|
at: t
|
|
153
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
172
|
+
}, 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
173
|
return;
|
|
155
174
|
}
|
|
156
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
175
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), N.current?.(e);
|
|
157
176
|
};
|
|
158
177
|
return (async () => {
|
|
159
178
|
try {
|
|
160
179
|
let n = await i({
|
|
161
180
|
videoElement: e,
|
|
162
181
|
canvasElement: t,
|
|
163
|
-
read: (e, t) =>
|
|
182
|
+
read: (e, t) => j.current(e, t),
|
|
164
183
|
length: s,
|
|
165
184
|
publicPath: c,
|
|
166
185
|
libavWorkerUrl: l,
|
|
@@ -169,27 +188,27 @@ var ae = {
|
|
|
169
188
|
jassubLegacyWasmUrl: g,
|
|
170
189
|
defaultFontUrl: _,
|
|
171
190
|
bufferSize: v,
|
|
172
|
-
audioStreamIndex:
|
|
191
|
+
audioStreamIndex: x,
|
|
173
192
|
onReady: () => {
|
|
174
193
|
if (r) return;
|
|
175
194
|
a.setSourceState({ ready: !0 });
|
|
176
|
-
let t =
|
|
177
|
-
|
|
195
|
+
let t = O.current;
|
|
196
|
+
O.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
178
197
|
},
|
|
179
198
|
onError: d,
|
|
180
199
|
onRecovered: () => {
|
|
181
200
|
r || a.setSourceState({ playbackError: null });
|
|
182
201
|
},
|
|
183
|
-
onSeek: (e) =>
|
|
202
|
+
onSeek: (e) => M.current?.(e),
|
|
184
203
|
onSubtitleStreams: (e) => {
|
|
185
204
|
r || a.setSourceState({
|
|
186
|
-
subtitleTracks:
|
|
187
|
-
...
|
|
205
|
+
subtitleTracks: V(e),
|
|
206
|
+
...A.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
188
207
|
});
|
|
189
208
|
},
|
|
190
209
|
onAudioStreams: (e, t) => {
|
|
191
210
|
r || a.setSourceState({
|
|
192
|
-
audioTracks:
|
|
211
|
+
audioTracks: V(e),
|
|
193
212
|
selectedAudioTrack: t
|
|
194
213
|
});
|
|
195
214
|
}
|
|
@@ -198,17 +217,17 @@ var ae = {
|
|
|
198
217
|
n.destroy();
|
|
199
218
|
return;
|
|
200
219
|
}
|
|
201
|
-
|
|
220
|
+
D.current = n, a.setSourceState({ indexes: n.indexes });
|
|
202
221
|
let o = a.selectedSubtitleTrack;
|
|
203
222
|
typeof o == "number" && n.selectSubtitleStream(o);
|
|
204
223
|
} catch (e) {
|
|
205
224
|
d(e);
|
|
206
225
|
}
|
|
207
226
|
})(), () => {
|
|
208
|
-
r = !0,
|
|
227
|
+
r = !0, O.current = {
|
|
209
228
|
time: e.currentTime,
|
|
210
229
|
size: s
|
|
211
|
-
},
|
|
230
|
+
}, D.current?.destroy(), D.current = null, a.setSourceState({ ready: !1 });
|
|
212
231
|
};
|
|
213
232
|
}, [
|
|
214
233
|
a,
|
|
@@ -222,17 +241,17 @@ var ae = {
|
|
|
222
241
|
g,
|
|
223
242
|
_,
|
|
224
243
|
v,
|
|
225
|
-
|
|
244
|
+
x,
|
|
226
245
|
y,
|
|
227
|
-
|
|
246
|
+
C
|
|
228
247
|
]);
|
|
229
|
-
},
|
|
248
|
+
}, fe = 5e3, pe = 6e4, me = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
230
249
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
231
250
|
l.current = i;
|
|
232
251
|
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
233
252
|
return h.current = u, d(() => {
|
|
234
253
|
if (!n || !i || !e || !t) return;
|
|
235
|
-
let a = !1, o = null, u, d =
|
|
254
|
+
let a = !1, o = null, u, d = fe, f = () => {
|
|
236
255
|
r({
|
|
237
256
|
publicPath: e,
|
|
238
257
|
workerUrl: t,
|
|
@@ -248,7 +267,7 @@ var ae = {
|
|
|
248
267
|
}
|
|
249
268
|
o = e, c.current = e, e.update(h.current);
|
|
250
269
|
}, () => {
|
|
251
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
270
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, pe));
|
|
252
271
|
});
|
|
253
272
|
};
|
|
254
273
|
return f(), () => {
|
|
@@ -261,7 +280,7 @@ var ae = {
|
|
|
261
280
|
]), d(() => {
|
|
262
281
|
c.current?.update(u);
|
|
263
282
|
}, [u]), o;
|
|
264
|
-
},
|
|
283
|
+
}, he = (e, n) => {
|
|
265
284
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
266
285
|
d(() => {
|
|
267
286
|
if (!e || !n || !s) return;
|
|
@@ -289,7 +308,7 @@ var ae = {
|
|
|
289
308
|
mode: s,
|
|
290
309
|
burnedIn: i
|
|
291
310
|
};
|
|
292
|
-
},
|
|
311
|
+
}, U = {
|
|
293
312
|
headings: {
|
|
294
313
|
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
314
|
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 +350,7 @@ var ae = {
|
|
|
331
350
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
332
351
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
333
352
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
334
|
-
${
|
|
353
|
+
${U.headings.small}
|
|
335
354
|
color: white;
|
|
336
355
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
337
356
|
z-index: 2;
|
|
@@ -379,11 +398,11 @@ var ae = {
|
|
|
379
398
|
padding: 0 calc(2 * var(--mp-unit));
|
|
380
399
|
text-align: center;
|
|
381
400
|
color: #fff;
|
|
382
|
-
${
|
|
401
|
+
${U.bLarge.regular}
|
|
383
402
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
384
403
|
pointer-events: none;
|
|
385
404
|
`, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
|
|
386
|
-
let t =
|
|
405
|
+
let t = z((e) => e.title), n = z((e) => e.hideUI), r = z((e) => e.playbackError), i = z((e) => e.ready), a = z((e) => e.size), o = z((e) => e.waiting);
|
|
387
406
|
return /* @__PURE__ */ w(S, { children: [
|
|
388
407
|
t ? /* @__PURE__ */ C("div", {
|
|
389
408
|
className: "title",
|
|
@@ -404,11 +423,11 @@ var ae = {
|
|
|
404
423
|
css: ge
|
|
405
424
|
})
|
|
406
425
|
] });
|
|
407
|
-
},
|
|
426
|
+
}, Se = 1e-4, W = 1, Ce = (e) => Math.max(Se, Math.min(W, e)) ** 2, G = (e) => Math.max(Se, Math.min(W, e)) ** (W / 2), K = (e) => {
|
|
408
427
|
if (e === void 0) return "0:00";
|
|
409
428
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
410
429
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
411
|
-
},
|
|
430
|
+
}, we = (e, t) => `${K(e)} / ${K(t)}`, Te = (e) => h`
|
|
412
431
|
display: flex;
|
|
413
432
|
justify-content: flex-end;
|
|
414
433
|
|
|
@@ -418,7 +437,7 @@ var ae = {
|
|
|
418
437
|
z-index: 3;
|
|
419
438
|
|
|
420
439
|
* {
|
|
421
|
-
${
|
|
440
|
+
${U.bMedium.regular}
|
|
422
441
|
}
|
|
423
442
|
|
|
424
443
|
${e === "sm" && h`
|
|
@@ -438,8 +457,8 @@ var ae = {
|
|
|
438
457
|
"data-tooltip-delay-hide": i,
|
|
439
458
|
"data-tooltip-place": o,
|
|
440
459
|
children: n
|
|
441
|
-
}), !s && /* @__PURE__ */ C(
|
|
442
|
-
css:
|
|
460
|
+
}), !s && /* @__PURE__ */ C(te, {
|
|
461
|
+
css: Te(c),
|
|
443
462
|
id: e,
|
|
444
463
|
noArrow: !0,
|
|
445
464
|
children: t
|
|
@@ -470,7 +489,7 @@ var ae = {
|
|
|
470
489
|
style: { touchAction: "none" }
|
|
471
490
|
}
|
|
472
491
|
};
|
|
473
|
-
},
|
|
492
|
+
}, Ee = h`
|
|
474
493
|
position: relative;
|
|
475
494
|
height: calc(.4 * var(--mp-unit));
|
|
476
495
|
|
|
@@ -524,7 +543,7 @@ var ae = {
|
|
|
524
543
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
525
544
|
|
|
526
545
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
527
|
-
${
|
|
546
|
+
${U.bMedium.bold}
|
|
528
547
|
|
|
529
548
|
position: absolute;
|
|
530
549
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -641,29 +660,29 @@ var ae = {
|
|
|
641
660
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
642
661
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
643
662
|
}
|
|
644
|
-
`,
|
|
645
|
-
let e =
|
|
646
|
-
ref:
|
|
663
|
+
`, De = () => {
|
|
664
|
+
let e = z(), t = z((e) => e.currentTime), n = z((e) => e.requestSeek), r = z((e) => e.duration), i = z((e) => e.size), a = z((e) => e.downloadedRanges), o = z((e) => e.indexes), s = z((e) => e.thumbnails), c = z((e) => e.thumbnailAt), l = p(null), [u, h] = m(void 0), [g, _] = m(void 0), v = p(void 0), { dragging: y, handlers: b } = J({
|
|
665
|
+
ref: l,
|
|
647
666
|
onChange: (e) => {
|
|
648
|
-
|
|
667
|
+
h(e), v.current !== "mouse" && _(e * r);
|
|
649
668
|
}
|
|
650
|
-
}),
|
|
651
|
-
|
|
652
|
-
}, x = (e) => {
|
|
653
|
-
y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
|
|
669
|
+
}), x = (e) => {
|
|
670
|
+
v.current = e.pointerType, b.onPointerDown(e);
|
|
654
671
|
}, S = (e) => {
|
|
655
|
-
|
|
656
|
-
let { left: t, right: r } = c.current.getBoundingClientRect();
|
|
657
|
-
return Math.min(Math.max((e - t) / (r - t), 0), 1) * n;
|
|
672
|
+
b.onPointerUp(e), e.pointerType !== "mouse" && _(void 0);
|
|
658
673
|
}, T = (e) => {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
},
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
674
|
+
if (!l.current) return;
|
|
675
|
+
let { left: t, right: n } = l.current.getBoundingClientRect();
|
|
676
|
+
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
677
|
+
}, E = (e) => {
|
|
678
|
+
_(T(e.clientX));
|
|
679
|
+
}, D = () => {
|
|
680
|
+
l.current && _(void 0);
|
|
681
|
+
}, O = (e) => r ? e / r * 100 : 0, k = f(() => a?.map((e, t) => {
|
|
682
|
+
if (!i || !r) return null;
|
|
683
|
+
let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
|
|
684
|
+
if (!a || !s) return null;
|
|
685
|
+
let c = a.timestamp / r, l = s.timestamp / r, u = Number((l - c).toFixed(2)), d = c * 100;
|
|
667
686
|
return /* @__PURE__ */ C("div", {
|
|
668
687
|
className: "loaded-part",
|
|
669
688
|
style: {
|
|
@@ -672,76 +691,77 @@ var ae = {
|
|
|
672
691
|
}
|
|
673
692
|
}, t);
|
|
674
693
|
}) ?? [], [
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
]),
|
|
679
|
-
if (!
|
|
680
|
-
let e = Math.floor(
|
|
694
|
+
r,
|
|
695
|
+
o.length,
|
|
696
|
+
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
697
|
+
]), A = f(() => {
|
|
698
|
+
if (!g || g < 0) return;
|
|
699
|
+
let e = Math.floor(g / 3600), t = Math.floor((g - e * 3600) / 60), n = Math.floor(g - e * 3600 - t * 60);
|
|
681
700
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
682
|
-
}, [
|
|
701
|
+
}, [g]);
|
|
683
702
|
d(() => {
|
|
684
|
-
if (
|
|
685
|
-
let t =
|
|
686
|
-
e.seek(t);
|
|
703
|
+
if (u === void 0 || !r) return;
|
|
704
|
+
let t = u * r;
|
|
705
|
+
n ? n(t) : e.seek(t);
|
|
687
706
|
}, [
|
|
688
707
|
e,
|
|
689
|
-
|
|
690
|
-
|
|
708
|
+
n,
|
|
709
|
+
u,
|
|
710
|
+
r
|
|
691
711
|
]);
|
|
692
|
-
let
|
|
693
|
-
if (
|
|
694
|
-
if (
|
|
695
|
-
if (
|
|
712
|
+
let j = f(() => !r || typeof t != "number" ? 0 : t / r, [r, t]), M = f(() => {
|
|
713
|
+
if (g) {
|
|
714
|
+
if (c) return c(g);
|
|
715
|
+
if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= g && g < t);
|
|
696
716
|
}
|
|
697
717
|
}, [
|
|
698
|
-
o,
|
|
699
718
|
s,
|
|
700
|
-
|
|
719
|
+
c,
|
|
720
|
+
g
|
|
701
721
|
]);
|
|
702
722
|
return /* @__PURE__ */ w("div", {
|
|
703
|
-
css:
|
|
704
|
-
ref:
|
|
705
|
-
className:
|
|
706
|
-
onMouseMove:
|
|
707
|
-
onMouseOut:
|
|
723
|
+
css: Ee,
|
|
724
|
+
ref: l,
|
|
725
|
+
className: y ? "progress-bar dragging" : "progress-bar",
|
|
726
|
+
onMouseMove: E,
|
|
727
|
+
onMouseOut: D,
|
|
708
728
|
children: [
|
|
709
729
|
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
710
|
-
|
|
730
|
+
g ? /* @__PURE__ */ C("div", {
|
|
711
731
|
className: "cursor-time",
|
|
712
|
-
style: { left: `clamp(calc(3 * var(--mp-unit)), ${
|
|
713
|
-
children:
|
|
732
|
+
style: { left: `clamp(calc(3 * var(--mp-unit)), ${O(g)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
733
|
+
children: A
|
|
714
734
|
}) : void 0,
|
|
715
735
|
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
716
736
|
/* @__PURE__ */ C("div", {
|
|
717
737
|
className: "loaded",
|
|
718
|
-
children:
|
|
738
|
+
children: k
|
|
719
739
|
}),
|
|
720
740
|
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
721
741
|
/* @__PURE__ */ C("div", {
|
|
722
742
|
className: "play-container",
|
|
723
743
|
children: /* @__PURE__ */ C("div", {
|
|
724
744
|
className: "play",
|
|
725
|
-
style: { transform: `scaleX(${
|
|
745
|
+
style: { transform: `scaleX(${j})` }
|
|
726
746
|
})
|
|
727
747
|
}),
|
|
728
748
|
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
729
749
|
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
730
750
|
/* @__PURE__ */ C("div", {
|
|
731
751
|
className: "padding",
|
|
732
|
-
...
|
|
733
|
-
onPointerDown:
|
|
734
|
-
onPointerUp:
|
|
735
|
-
onPointerCancel:
|
|
752
|
+
...b,
|
|
753
|
+
onPointerDown: x,
|
|
754
|
+
onPointerUp: S,
|
|
755
|
+
onPointerCancel: S
|
|
736
756
|
}),
|
|
737
757
|
/* @__PURE__ */ C("div", {
|
|
738
758
|
className: "thumbnail",
|
|
739
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
740
|
-
children:
|
|
759
|
+
style: { left: `clamp(var(--thumbnail-half), ${O(g ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
760
|
+
children: M?.url ? /* @__PURE__ */ C("img", { src: M.url }) : void 0
|
|
741
761
|
})
|
|
742
762
|
]
|
|
743
763
|
});
|
|
744
|
-
},
|
|
764
|
+
}, 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
765
|
xmlns: "http://www.w3.org/2000/svg",
|
|
746
766
|
width: 24,
|
|
747
767
|
height: 24,
|
|
@@ -751,7 +771,7 @@ var ae = {
|
|
|
751
771
|
strokeWidth: 2,
|
|
752
772
|
strokeLinecap: "round",
|
|
753
773
|
strokeLinejoin: "round"
|
|
754
|
-
},
|
|
774
|
+
}, ke = (e) => /* @__PURE__ */ w("svg", {
|
|
755
775
|
...Y,
|
|
756
776
|
...e,
|
|
757
777
|
children: [/* @__PURE__ */ C("rect", {
|
|
@@ -762,7 +782,7 @@ var ae = {
|
|
|
762
782
|
rx: "2",
|
|
763
783
|
ry: "2"
|
|
764
784
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
765
|
-
}),
|
|
785
|
+
}), Ae = (e) => /* @__PURE__ */ w("svg", {
|
|
766
786
|
...Y,
|
|
767
787
|
...e,
|
|
768
788
|
children: [
|
|
@@ -782,7 +802,7 @@ var ae = {
|
|
|
782
802
|
y2: "22"
|
|
783
803
|
})
|
|
784
804
|
]
|
|
785
|
-
}),
|
|
805
|
+
}), je = (e) => /* @__PURE__ */ w("svg", {
|
|
786
806
|
...Y,
|
|
787
807
|
...e,
|
|
788
808
|
children: [
|
|
@@ -836,7 +856,7 @@ var ae = {
|
|
|
836
856
|
|
|
837
857
|
border-radius: 8px;
|
|
838
858
|
background-color: rgba(28,28,28,0.95);
|
|
839
|
-
${
|
|
859
|
+
${U.bMedium.regular}
|
|
840
860
|
|
|
841
861
|
z-index: 4;
|
|
842
862
|
|
|
@@ -879,7 +899,7 @@ var ae = {
|
|
|
879
899
|
|
|
880
900
|
.secondary {
|
|
881
901
|
color: #eee;
|
|
882
|
-
${
|
|
902
|
+
${U.bSmall.regular}
|
|
883
903
|
}
|
|
884
904
|
}
|
|
885
905
|
}
|
|
@@ -921,10 +941,10 @@ var ae = {
|
|
|
921
941
|
.failed {
|
|
922
942
|
border-bottom: 1px solid #4D4D4E;
|
|
923
943
|
color: #f66;
|
|
924
|
-
${
|
|
944
|
+
${U.bSmall.regular}
|
|
925
945
|
}
|
|
926
946
|
}
|
|
927
|
-
`,
|
|
947
|
+
`, Me = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
928
948
|
let c = o !== void 0, l = (e, i, a) => {
|
|
929
949
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
930
950
|
return /* @__PURE__ */ w("div", {
|
|
@@ -992,7 +1012,7 @@ var ae = {
|
|
|
992
1012
|
});
|
|
993
1013
|
}
|
|
994
1014
|
};
|
|
995
|
-
},
|
|
1015
|
+
}, Ne = h`
|
|
996
1016
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
997
1017
|
which is the width of the player box, so it can be clamped to it. */
|
|
998
1018
|
position: static;
|
|
@@ -1036,7 +1056,7 @@ ${X}
|
|
|
1036
1056
|
|
|
1037
1057
|
color: #fff;
|
|
1038
1058
|
cursor: pointer;
|
|
1039
|
-
${
|
|
1059
|
+
${U.bSmall.regular}
|
|
1040
1060
|
|
|
1041
1061
|
&:hover {
|
|
1042
1062
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1057,7 +1077,7 @@ ${X}
|
|
|
1057
1077
|
|
|
1058
1078
|
.when {
|
|
1059
1079
|
color: #bbb;
|
|
1060
|
-
${
|
|
1080
|
+
${U.bSmall.regular}
|
|
1061
1081
|
|
|
1062
1082
|
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1063
1083
|
.count {
|
|
@@ -1076,27 +1096,27 @@ ${X}
|
|
|
1076
1096
|
color: #ddd;
|
|
1077
1097
|
overflow-wrap: anywhere;
|
|
1078
1098
|
white-space: pre-wrap;
|
|
1079
|
-
${
|
|
1099
|
+
${U.bSmall.regular}
|
|
1080
1100
|
}
|
|
1081
1101
|
}
|
|
1082
1102
|
}
|
|
1083
|
-
`,
|
|
1103
|
+
`, 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
1104
|
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
1105
|
return [
|
|
1086
1106
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1087
1107
|
e.message,
|
|
1088
1108
|
e.detail
|
|
1089
1109
|
].filter(Boolean).join("\n");
|
|
1090
|
-
}).join("\n\n"),
|
|
1091
|
-
let e =
|
|
1110
|
+
}).join("\n\n"), Le = () => {
|
|
1111
|
+
let e = z((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
|
|
1092
1112
|
if (e.length === 0) return null;
|
|
1093
1113
|
let o = () => {
|
|
1094
|
-
navigator.clipboard?.writeText(
|
|
1114
|
+
navigator.clipboard?.writeText(Ie(e)).then(() => {
|
|
1095
1115
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1096
1116
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1097
|
-
}, s = `Playback errors (${
|
|
1117
|
+
}, s = `Playback errors (${Fe(e)})`;
|
|
1098
1118
|
return /* @__PURE__ */ w("div", {
|
|
1099
|
-
css:
|
|
1119
|
+
css: Ne,
|
|
1100
1120
|
ref: r,
|
|
1101
1121
|
children: [/* @__PURE__ */ C(q, {
|
|
1102
1122
|
id: "errors",
|
|
@@ -1127,8 +1147,8 @@ ${X}
|
|
|
1127
1147
|
/* @__PURE__ */ w("span", {
|
|
1128
1148
|
className: "when",
|
|
1129
1149
|
children: [
|
|
1130
|
-
|
|
1131
|
-
e.count > 1 ? ` to ${
|
|
1150
|
+
Pe(e.at),
|
|
1151
|
+
e.count > 1 ? ` to ${Pe(e.lastAt)}` : "",
|
|
1132
1152
|
Q(e.atMediaTime) ? ` at ${Q(e.atMediaTime)}` : "",
|
|
1133
1153
|
e.recovered ? " recovered" : "",
|
|
1134
1154
|
e.count > 1 ? /* @__PURE__ */ C("span", {
|
|
@@ -1149,7 +1169,7 @@ ${X}
|
|
|
1149
1169
|
}, `${e.at}-${t}`))]
|
|
1150
1170
|
})]
|
|
1151
1171
|
});
|
|
1152
|
-
},
|
|
1172
|
+
}, Re = h`
|
|
1153
1173
|
display: flex;
|
|
1154
1174
|
align-items: center;
|
|
1155
1175
|
justify-content: center;
|
|
@@ -1202,8 +1222,8 @@ width: 100%;
|
|
|
1202
1222
|
}
|
|
1203
1223
|
}
|
|
1204
1224
|
}
|
|
1205
|
-
`,
|
|
1206
|
-
let e =
|
|
1225
|
+
`, ze = () => {
|
|
1226
|
+
let e = z(), t = z((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
1227
|
ref: r,
|
|
1208
1228
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1209
1229
|
}), f = (t) => {
|
|
@@ -1219,7 +1239,7 @@ width: 100%;
|
|
|
1219
1239
|
}, [t]);
|
|
1220
1240
|
let m = c(s);
|
|
1221
1241
|
return /* @__PURE__ */ w("div", {
|
|
1222
|
-
css:
|
|
1242
|
+
css: Re,
|
|
1223
1243
|
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1224
1244
|
className: "playback-slider",
|
|
1225
1245
|
ref: n,
|
|
@@ -1237,7 +1257,7 @@ width: 100%;
|
|
|
1237
1257
|
})
|
|
1238
1258
|
})]
|
|
1239
1259
|
});
|
|
1240
|
-
},
|
|
1260
|
+
}, Be = h`
|
|
1241
1261
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1242
1262
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1243
1263
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1296,8 +1316,8 @@ ${X}
|
|
|
1296
1316
|
}
|
|
1297
1317
|
}
|
|
1298
1318
|
|
|
1299
|
-
`,
|
|
1300
|
-
let e =
|
|
1319
|
+
`, Ve = () => {
|
|
1320
|
+
let e = z(), t = z((e) => e.playbackRate), n = z((e) => e.audioTracks), r = z((e) => e.selectedAudioTrack), i = z((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
1321
|
e.setPlaybackRate(t), o(0);
|
|
1302
1322
|
}, h = (e) => {
|
|
1303
1323
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1305,7 +1325,7 @@ ${X}
|
|
|
1305
1325
|
o(e);
|
|
1306
1326
|
};
|
|
1307
1327
|
return /* @__PURE__ */ w("div", {
|
|
1308
|
-
css:
|
|
1328
|
+
css: Be,
|
|
1309
1329
|
ref: l,
|
|
1310
1330
|
children: [
|
|
1311
1331
|
/* @__PURE__ */ C(q, {
|
|
@@ -1317,7 +1337,7 @@ ${X}
|
|
|
1317
1337
|
onClick: c,
|
|
1318
1338
|
"aria-label": "Settings",
|
|
1319
1339
|
"aria-expanded": s,
|
|
1320
|
-
children: /* @__PURE__ */ C(
|
|
1340
|
+
children: /* @__PURE__ */ C(F, {})
|
|
1321
1341
|
}),
|
|
1322
1342
|
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1323
1343
|
}),
|
|
@@ -1344,7 +1364,7 @@ ${X}
|
|
|
1344
1364
|
}),
|
|
1345
1365
|
/* @__PURE__ */ C("div", {
|
|
1346
1366
|
className: "slider no-hover",
|
|
1347
|
-
children: /* @__PURE__ */ C(
|
|
1367
|
+
children: /* @__PURE__ */ C(ze, {})
|
|
1348
1368
|
}),
|
|
1349
1369
|
/* @__PURE__ */ w("div", {
|
|
1350
1370
|
className: "options no-hover",
|
|
@@ -1369,7 +1389,7 @@ ${X}
|
|
|
1369
1389
|
})
|
|
1370
1390
|
]
|
|
1371
1391
|
}),
|
|
1372
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1392
|
+
s && a === 2 && /* @__PURE__ */ C(Me, {
|
|
1373
1393
|
title: "Audio",
|
|
1374
1394
|
tracks: n,
|
|
1375
1395
|
selected: r,
|
|
@@ -1380,7 +1400,7 @@ ${X}
|
|
|
1380
1400
|
})
|
|
1381
1401
|
]
|
|
1382
1402
|
});
|
|
1383
|
-
},
|
|
1403
|
+
}, He = h`
|
|
1384
1404
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1385
1405
|
which is the width of the player box, so it can be clamped to it. */
|
|
1386
1406
|
position: static;
|
|
@@ -1397,12 +1417,12 @@ position: static;
|
|
|
1397
1417
|
}
|
|
1398
1418
|
|
|
1399
1419
|
${X}
|
|
1400
|
-
`,
|
|
1401
|
-
let e =
|
|
1420
|
+
`, Ue = () => {
|
|
1421
|
+
let e = z((e) => e.subtitleTracks), t = z((e) => e.selectedSubtitleTrack), n = z((e) => e.selectSubtitleTrack), r = z((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
|
|
1402
1422
|
if (e.length === 0) return null;
|
|
1403
1423
|
let u = t !== void 0;
|
|
1404
1424
|
return /* @__PURE__ */ w("div", {
|
|
1405
|
-
css:
|
|
1425
|
+
css: He,
|
|
1406
1426
|
ref: o,
|
|
1407
1427
|
children: [/* @__PURE__ */ C(q, {
|
|
1408
1428
|
id: "subtitles",
|
|
@@ -1414,10 +1434,10 @@ ${X}
|
|
|
1414
1434
|
"aria-label": "Subtitles",
|
|
1415
1435
|
"aria-expanded": i,
|
|
1416
1436
|
"aria-pressed": u,
|
|
1417
|
-
children: u ? /* @__PURE__ */ C(
|
|
1437
|
+
children: u ? /* @__PURE__ */ C(ke, { className: "captions" }) : /* @__PURE__ */ C(Ae, { className: "captions-off" })
|
|
1418
1438
|
}),
|
|
1419
1439
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1420
|
-
}), i && /* @__PURE__ */ C(
|
|
1440
|
+
}), i && /* @__PURE__ */ C(Me, {
|
|
1421
1441
|
title: "Subtitles",
|
|
1422
1442
|
tracks: e,
|
|
1423
1443
|
selected: t,
|
|
@@ -1427,14 +1447,14 @@ ${X}
|
|
|
1427
1447
|
failed: c
|
|
1428
1448
|
})]
|
|
1429
1449
|
});
|
|
1430
|
-
},
|
|
1450
|
+
}, We = {
|
|
1431
1451
|
primary: "#EAEBEE",
|
|
1432
1452
|
secondary: "#D0D0D9",
|
|
1433
1453
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1434
1454
|
accent: "#6EA8FE",
|
|
1435
1455
|
borderPrimary: "#384F70",
|
|
1436
1456
|
backgroundTooltip: "#222222"
|
|
1437
|
-
},
|
|
1457
|
+
}, Ge = h`
|
|
1438
1458
|
display: flex;
|
|
1439
1459
|
align-items: center;
|
|
1440
1460
|
|
|
@@ -1477,8 +1497,8 @@ ${X}
|
|
|
1477
1497
|
width: 10px;
|
|
1478
1498
|
height: 10px;
|
|
1479
1499
|
}
|
|
1480
|
-
`,
|
|
1481
|
-
let n =
|
|
1500
|
+
`, Ke = ({ value: e, onChange: t }) => {
|
|
1501
|
+
let n = z((e) => e.volume), r = z((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
|
|
1482
1502
|
ref: a,
|
|
1483
1503
|
onChange: t
|
|
1484
1504
|
}), s = (n) => {
|
|
@@ -1497,7 +1517,7 @@ ${X}
|
|
|
1497
1517
|
id: "volume-slider",
|
|
1498
1518
|
text: /* @__PURE__ */ C("div", {
|
|
1499
1519
|
ref: i,
|
|
1500
|
-
css:
|
|
1520
|
+
css: Ge,
|
|
1501
1521
|
...o,
|
|
1502
1522
|
children: /* @__PURE__ */ C("div", {
|
|
1503
1523
|
ref: a,
|
|
@@ -1516,7 +1536,7 @@ ${X}
|
|
|
1516
1536
|
children: [l, "%"]
|
|
1517
1537
|
})
|
|
1518
1538
|
});
|
|
1519
|
-
},
|
|
1539
|
+
}, qe = h`
|
|
1520
1540
|
position: relative;
|
|
1521
1541
|
display: flex;
|
|
1522
1542
|
align-items: center;
|
|
@@ -1541,7 +1561,7 @@ ${X}
|
|
|
1541
1561
|
border-radius: 4px;
|
|
1542
1562
|
|
|
1543
1563
|
.volume-value {
|
|
1544
|
-
${
|
|
1564
|
+
${U.bMedium.regular};
|
|
1545
1565
|
color: #ffffff;
|
|
1546
1566
|
}
|
|
1547
1567
|
}
|
|
@@ -1579,10 +1599,10 @@ ${X}
|
|
|
1579
1599
|
}
|
|
1580
1600
|
}
|
|
1581
1601
|
|
|
1582
|
-
`,
|
|
1583
|
-
let t =
|
|
1602
|
+
`, Je = ({ ref: e }) => {
|
|
1603
|
+
let t = z(), n = z((e) => e.volume), r = z((e) => e.muted), i = f(() => G(n), [n]);
|
|
1584
1604
|
return /* @__PURE__ */ w("div", {
|
|
1585
|
-
css:
|
|
1605
|
+
css: qe,
|
|
1586
1606
|
children: [/* @__PURE__ */ C(q, {
|
|
1587
1607
|
id: "sound",
|
|
1588
1608
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1592,7 +1612,7 @@ ${X}
|
|
|
1592
1612
|
ref: e,
|
|
1593
1613
|
"aria-label": "Mute",
|
|
1594
1614
|
"aria-pressed": r || n === 0,
|
|
1595
|
-
children: C(r || n === 0 ?
|
|
1615
|
+
children: C(r || n === 0 ? ee : n <= .5 ? I : L, {
|
|
1596
1616
|
size: 18,
|
|
1597
1617
|
color: "#fff"
|
|
1598
1618
|
})
|
|
@@ -1602,16 +1622,16 @@ ${X}
|
|
|
1602
1622
|
className: "volume-slider-container",
|
|
1603
1623
|
children: /* @__PURE__ */ C("div", {
|
|
1604
1624
|
className: "volume-slider-background",
|
|
1605
|
-
children: /* @__PURE__ */ C(
|
|
1625
|
+
children: /* @__PURE__ */ C(Ke, {
|
|
1606
1626
|
value: r ? 0 : i,
|
|
1607
1627
|
onChange: (e) => {
|
|
1608
|
-
t.setVolume(
|
|
1628
|
+
t.setVolume(Ce(e));
|
|
1609
1629
|
}
|
|
1610
1630
|
})
|
|
1611
1631
|
})
|
|
1612
1632
|
})]
|
|
1613
1633
|
});
|
|
1614
|
-
}, $ = .05,
|
|
1634
|
+
}, $ = .05, Ye = 5, Xe = h`
|
|
1615
1635
|
display: flex;
|
|
1616
1636
|
flex-direction: column;
|
|
1617
1637
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1622,7 +1642,7 @@ ${X}
|
|
|
1622
1642
|
opacity: 0.72;
|
|
1623
1643
|
font-size: 0.9em;
|
|
1624
1644
|
}
|
|
1625
|
-
`,
|
|
1645
|
+
`, Ze = h`
|
|
1626
1646
|
position: absolute;
|
|
1627
1647
|
bottom: 0;
|
|
1628
1648
|
width: 100%;
|
|
@@ -1687,7 +1707,7 @@ ${X}
|
|
|
1687
1707
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1688
1708
|
*/
|
|
1689
1709
|
button[aria-pressed='true'] svg {
|
|
1690
|
-
stroke: ${
|
|
1710
|
+
stroke: ${We.accent};
|
|
1691
1711
|
}
|
|
1692
1712
|
|
|
1693
1713
|
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
@@ -1722,7 +1742,7 @@ ${X}
|
|
|
1722
1742
|
cursor: pointer;
|
|
1723
1743
|
|
|
1724
1744
|
:hover {
|
|
1725
|
-
background-color: ${
|
|
1745
|
+
background-color: ${We.hover};
|
|
1726
1746
|
}
|
|
1727
1747
|
|
|
1728
1748
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1739,7 +1759,7 @@ ${X}
|
|
|
1739
1759
|
|
|
1740
1760
|
.left {
|
|
1741
1761
|
.time {
|
|
1742
|
-
${
|
|
1762
|
+
${U.bMedium.regular}
|
|
1743
1763
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1744
1764
|
}
|
|
1745
1765
|
}
|
|
@@ -1760,54 +1780,58 @@ ${X}
|
|
|
1760
1780
|
}
|
|
1761
1781
|
}
|
|
1762
1782
|
}
|
|
1763
|
-
`,
|
|
1764
|
-
let e =
|
|
1783
|
+
`, Qe = () => {
|
|
1784
|
+
let e = z(), t = z((e) => e.paused), n = z((e) => e.currentTime), r = z((e) => e.duration), i = z((e) => e.fullscreen), a = z((e) => e.hideUI), o = z((e) => e.togglePictureInPicture), s = z((e) => e.pictureInPictureMode), c = z((e) => e.burnedInSubtitles), l = z((e) => e.subtitleTracks), f = z((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
1785
|
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(
|
|
1786
|
+
e.setVolume(Ce(a)), o && !e.muted && e.toggleMuted();
|
|
1767
1787
|
}, [e]);
|
|
1768
1788
|
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 (
|
|
1789
|
+
let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
|
|
1790
|
+
let r = n.target;
|
|
1791
|
+
if (r?.isContentEditable || /^(input|textarea|select)$/i.test(r?.tagName ?? "")) return;
|
|
1792
|
+
let i = !0;
|
|
1793
|
+
if (n.key === "f") e.toggleFullscreen();
|
|
1794
|
+
else if (n.key === "k") e.togglePaused();
|
|
1795
|
+
else if (n.key === " ") e.togglePaused();
|
|
1796
|
+
else if (n.key === "m") e.toggleMuted();
|
|
1797
|
+
else if (n.key === "ArrowUp") y({
|
|
1778
1798
|
direction: "up",
|
|
1779
1799
|
stepSize: $
|
|
1780
1800
|
});
|
|
1781
|
-
else if (
|
|
1801
|
+
else if (n.key === "ArrowDown") y({
|
|
1782
1802
|
direction: "down",
|
|
1783
1803
|
stepSize: $
|
|
1784
1804
|
});
|
|
1785
|
-
else if (
|
|
1805
|
+
else if (n.key === "ArrowRight") {
|
|
1786
1806
|
if (!e.duration) return;
|
|
1787
|
-
|
|
1788
|
-
} else
|
|
1789
|
-
|
|
1807
|
+
t(Math.min(e.currentTime + Ye, e.duration));
|
|
1808
|
+
} else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - Ye, 0)) : i = !1;
|
|
1809
|
+
i && n.preventDefault();
|
|
1790
1810
|
};
|
|
1791
|
-
return window.addEventListener("keydown",
|
|
1792
|
-
}, [
|
|
1793
|
-
|
|
1794
|
-
|
|
1811
|
+
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
1812
|
+
}, [
|
|
1813
|
+
e,
|
|
1814
|
+
y,
|
|
1815
|
+
f
|
|
1816
|
+
]);
|
|
1817
|
+
let b = u((e) => {
|
|
1818
|
+
e.preventDefault(), e.deltaY < 0 ? y({
|
|
1795
1819
|
direction: "up",
|
|
1796
1820
|
stepSize: $
|
|
1797
|
-
}) :
|
|
1821
|
+
}) : y({
|
|
1798
1822
|
direction: "down",
|
|
1799
1823
|
stepSize: $
|
|
1800
1824
|
});
|
|
1801
|
-
}, [
|
|
1825
|
+
}, [y]);
|
|
1802
1826
|
return d(() => {
|
|
1803
|
-
if (
|
|
1804
|
-
}, [
|
|
1805
|
-
css:
|
|
1827
|
+
if (p) return p.addEventListener("wheel", b, { passive: !1 }), () => p.removeEventListener("wheel", b);
|
|
1828
|
+
}, [p, b]), /* @__PURE__ */ w("div", {
|
|
1829
|
+
css: Ze,
|
|
1806
1830
|
style: { ...a ? {
|
|
1807
1831
|
opacity: "0",
|
|
1808
1832
|
pointerEvents: "none"
|
|
1809
1833
|
} : {} },
|
|
1810
|
-
children: [/* @__PURE__ */ C(
|
|
1834
|
+
children: [/* @__PURE__ */ C(De, {}), /* @__PURE__ */ w("div", {
|
|
1811
1835
|
className: "actions",
|
|
1812
1836
|
children: [/* @__PURE__ */ w("div", {
|
|
1813
1837
|
className: "left",
|
|
@@ -1819,23 +1843,23 @@ ${X}
|
|
|
1819
1843
|
className: "play",
|
|
1820
1844
|
type: "button",
|
|
1821
1845
|
onClick: () => e.togglePaused(),
|
|
1822
|
-
"aria-label":
|
|
1823
|
-
children: C(
|
|
1846
|
+
"aria-label": v ? "Replay" : t ? "Play" : "Pause",
|
|
1847
|
+
children: C(v ? P : t ? N : M, {})
|
|
1824
1848
|
}),
|
|
1825
|
-
toolTipText: /* @__PURE__ */ C("span", { children:
|
|
1849
|
+
toolTipText: /* @__PURE__ */ C("span", { children: v ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1826
1850
|
}),
|
|
1827
|
-
/* @__PURE__ */ C(
|
|
1851
|
+
/* @__PURE__ */ C(Je, { ref: h }),
|
|
1828
1852
|
/* @__PURE__ */ C("div", {
|
|
1829
1853
|
className: "time",
|
|
1830
|
-
children:
|
|
1854
|
+
children: we(n, r)
|
|
1831
1855
|
})
|
|
1832
1856
|
]
|
|
1833
1857
|
}), /* @__PURE__ */ w("div", {
|
|
1834
1858
|
className: "right",
|
|
1835
1859
|
children: [
|
|
1836
|
-
/* @__PURE__ */ C(
|
|
1860
|
+
/* @__PURE__ */ C(Le, {}),
|
|
1861
|
+
/* @__PURE__ */ C(Ue, {}),
|
|
1837
1862
|
/* @__PURE__ */ C(Ve, {}),
|
|
1838
|
-
/* @__PURE__ */ C(ze, {}),
|
|
1839
1863
|
o ? /* @__PURE__ */ C(q, {
|
|
1840
1864
|
id: "picture-in-picture",
|
|
1841
1865
|
tooltipPlace: "top-end",
|
|
@@ -1843,20 +1867,20 @@ ${X}
|
|
|
1843
1867
|
className: "picture-in-picture",
|
|
1844
1868
|
type: "button",
|
|
1845
1869
|
onClick: o,
|
|
1846
|
-
disabled:
|
|
1847
|
-
"aria-label":
|
|
1848
|
-
"aria-pressed":
|
|
1849
|
-
children:
|
|
1850
|
-
src:
|
|
1870
|
+
disabled: g && !_,
|
|
1871
|
+
"aria-label": g ? "Put the subtitles in the video" : "Picture in picture",
|
|
1872
|
+
"aria-pressed": g ? c : void 0,
|
|
1873
|
+
children: g ? /* @__PURE__ */ C(je, {}) : /* @__PURE__ */ C("img", {
|
|
1874
|
+
src: Oe,
|
|
1851
1875
|
alt: ""
|
|
1852
1876
|
})
|
|
1853
1877
|
}),
|
|
1854
1878
|
toolTipText: /* @__PURE__ */ w("span", {
|
|
1855
|
-
css:
|
|
1879
|
+
css: Xe,
|
|
1856
1880
|
children: [/* @__PURE__ */ C("span", {
|
|
1857
1881
|
className: "lead",
|
|
1858
|
-
children:
|
|
1859
|
-
}),
|
|
1882
|
+
children: g ? _ ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
|
|
1883
|
+
}), g && _ ? /* @__PURE__ */ C("span", {
|
|
1860
1884
|
className: "hint",
|
|
1861
1885
|
children: "Then hover the video and click your browser's own pop out button"
|
|
1862
1886
|
}) : null]
|
|
@@ -1879,7 +1903,7 @@ ${X}
|
|
|
1879
1903
|
})]
|
|
1880
1904
|
})]
|
|
1881
1905
|
});
|
|
1882
|
-
},
|
|
1906
|
+
}, $e = 9e3, et = h`
|
|
1883
1907
|
position: absolute;
|
|
1884
1908
|
inset: 0;
|
|
1885
1909
|
z-index: 2;
|
|
@@ -1917,12 +1941,12 @@ ${X}
|
|
|
1917
1941
|
}
|
|
1918
1942
|
|
|
1919
1943
|
.title {
|
|
1920
|
-
${
|
|
1944
|
+
${U.bMedium.bold}
|
|
1921
1945
|
color: #fff;
|
|
1922
1946
|
}
|
|
1923
1947
|
|
|
1924
1948
|
.body {
|
|
1925
|
-
${
|
|
1949
|
+
${U.bSmall.regular}
|
|
1926
1950
|
color: rgba(255, 255, 255, 0.75);
|
|
1927
1951
|
}
|
|
1928
1952
|
|
|
@@ -1933,18 +1957,18 @@ ${X}
|
|
|
1933
1957
|
line-height: 1;
|
|
1934
1958
|
color: #6EA8FE;
|
|
1935
1959
|
}
|
|
1936
|
-
`,
|
|
1937
|
-
let e =
|
|
1960
|
+
`, tt = () => {
|
|
1961
|
+
let e = z((e) => e.burnedInSubtitles), t = z((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1938
1962
|
return d(() => {
|
|
1939
1963
|
if (t !== "burn-in" || !e) {
|
|
1940
1964
|
r(!1);
|
|
1941
1965
|
return;
|
|
1942
1966
|
}
|
|
1943
1967
|
r(!0);
|
|
1944
|
-
let n = setTimeout(() => r(!1),
|
|
1968
|
+
let n = setTimeout(() => r(!1), $e);
|
|
1945
1969
|
return () => clearTimeout(n);
|
|
1946
1970
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1947
|
-
css:
|
|
1971
|
+
css: et,
|
|
1948
1972
|
className: n ? "show" : "",
|
|
1949
1973
|
role: "status",
|
|
1950
1974
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -1965,7 +1989,7 @@ ${X}
|
|
|
1965
1989
|
})]
|
|
1966
1990
|
})
|
|
1967
1991
|
});
|
|
1968
|
-
},
|
|
1992
|
+
}, nt = 3e3, rt = h`
|
|
1969
1993
|
position: absolute;
|
|
1970
1994
|
inset: 0;
|
|
1971
1995
|
z-index: 2;
|
|
@@ -1976,7 +2000,7 @@ ${X}
|
|
|
1976
2000
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1977
2001
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1978
2002
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1979
|
-
`,
|
|
2003
|
+
`, it = h`
|
|
1980
2004
|
position: relative;
|
|
1981
2005
|
background-color: black;
|
|
1982
2006
|
display: flex;
|
|
@@ -2008,20 +2032,20 @@ ${X}
|
|
|
2008
2032
|
&.hide {
|
|
2009
2033
|
cursor: none;
|
|
2010
2034
|
}
|
|
2011
|
-
`,
|
|
2035
|
+
`, at = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
2012
2036
|
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
2013
|
-
return l(e) && e.type === c ?
|
|
2037
|
+
return l(e) && e.type === c ? at(e.props.children, `${r}/`) : [{
|
|
2014
2038
|
key: r,
|
|
2015
2039
|
item: e
|
|
2016
2040
|
}];
|
|
2017
|
-
}),
|
|
2018
|
-
let o =
|
|
2041
|
+
}), ot = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
2042
|
+
let o = z(), s = z((e) => e.hideUI), c = z((e) => e.setHideUI), l = p(void 0), u = p("mouse");
|
|
2019
2043
|
d(() => () => clearTimeout(l.current), []);
|
|
2020
2044
|
let f = () => {
|
|
2021
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
2045
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), nt);
|
|
2022
2046
|
};
|
|
2023
2047
|
return /* @__PURE__ */ w("div", {
|
|
2024
|
-
css:
|
|
2048
|
+
css: it,
|
|
2025
2049
|
ref: e,
|
|
2026
2050
|
onPointerMove: (e) => {
|
|
2027
2051
|
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
@@ -2038,8 +2062,8 @@ ${X}
|
|
|
2038
2062
|
className: s ? "hide" : "",
|
|
2039
2063
|
children: [
|
|
2040
2064
|
/* @__PURE__ */ C(xe, { onCanvasRef: n }),
|
|
2041
|
-
|
|
2042
|
-
css:
|
|
2065
|
+
at(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2066
|
+
css: rt,
|
|
2043
2067
|
style: { ...s ? {
|
|
2044
2068
|
opacity: "0",
|
|
2045
2069
|
visibility: "hidden",
|
|
@@ -2047,8 +2071,8 @@ ${X}
|
|
|
2047
2071
|
} : {} },
|
|
2048
2072
|
children: t
|
|
2049
2073
|
}, e)),
|
|
2050
|
-
i === !1 ? null : /* @__PURE__ */ C(
|
|
2051
|
-
/* @__PURE__ */ C(
|
|
2074
|
+
i === !1 ? null : /* @__PURE__ */ C(Qe, {}),
|
|
2075
|
+
/* @__PURE__ */ C(tt, {}),
|
|
2052
2076
|
/* @__PURE__ */ w("div", {
|
|
2053
2077
|
className: "video",
|
|
2054
2078
|
onClick: () => {
|
|
@@ -2065,16 +2089,16 @@ ${X}
|
|
|
2065
2089
|
})
|
|
2066
2090
|
]
|
|
2067
2091
|
});
|
|
2068
|
-
},
|
|
2092
|
+
}, st = ({ options: e, children: t }) => {
|
|
2069
2093
|
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
|
-
d(() => (p?.(S), () => p?.(null)), [S, p]),
|
|
2071
|
-
let w =
|
|
2094
|
+
d(() => (p?.(S), () => p?.(null)), [S, p]), de(g, b, r);
|
|
2095
|
+
let w = me({
|
|
2072
2096
|
publicPath: s,
|
|
2073
2097
|
workerUrl: c,
|
|
2074
2098
|
length: f === !1 ? void 0 : a,
|
|
2075
2099
|
read: u ?? l,
|
|
2076
2100
|
downloadedRanges: o
|
|
2077
|
-
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } =
|
|
2101
|
+
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = he(g, b), k = z((e) => e.setSourceState);
|
|
2078
2102
|
d(() => {
|
|
2079
2103
|
k({
|
|
2080
2104
|
title: i,
|
|
@@ -2126,7 +2150,7 @@ ${X}
|
|
|
2126
2150
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
2127
2151
|
selectAudioTrack: (e) => M.select(String(e))
|
|
2128
2152
|
});
|
|
2129
|
-
}, [k, M]), /* @__PURE__ */ C(
|
|
2153
|
+
}, [k, M]), /* @__PURE__ */ C(ot, {
|
|
2130
2154
|
ref: h,
|
|
2131
2155
|
onVideoRef: n ? void 0 : _,
|
|
2132
2156
|
onCanvasRef: x,
|
|
@@ -2134,7 +2158,7 @@ ${X}
|
|
|
2134
2158
|
controls: e.controls,
|
|
2135
2159
|
children: t
|
|
2136
2160
|
});
|
|
2137
|
-
},
|
|
2161
|
+
}, ct = h`
|
|
2138
2162
|
/**
|
|
2139
2163
|
* The chrome's whole scale, in one place.
|
|
2140
2164
|
*
|
|
@@ -2204,17 +2228,17 @@ ${X}
|
|
|
2204
2228
|
height: 100%;
|
|
2205
2229
|
width: 100%;
|
|
2206
2230
|
overflow: hidden;
|
|
2207
|
-
`,
|
|
2208
|
-
css:
|
|
2209
|
-
children: /* @__PURE__ */ C(
|
|
2231
|
+
`, lt = (e) => /* @__PURE__ */ C("div", {
|
|
2232
|
+
css: ct,
|
|
2233
|
+
children: /* @__PURE__ */ C(R.Provider, { children: /* @__PURE__ */ C(st, {
|
|
2210
2234
|
options: e,
|
|
2211
2235
|
children: e.children
|
|
2212
2236
|
}) })
|
|
2213
|
-
}),
|
|
2237
|
+
}), ut = (e) => !!e && typeof e == "object" && "at" in e, dt = (e) => !!e && typeof e == "object" && "selection" in e, ft = ({ blob: e, name: t }) => ({
|
|
2214
2238
|
length: e.size,
|
|
2215
2239
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2216
2240
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2217
|
-
}),
|
|
2241
|
+
}), pt = async (e, t) => {
|
|
2218
2242
|
let n = await fetch(e, {
|
|
2219
2243
|
headers: { Range: "bytes=0-1" },
|
|
2220
2244
|
credentials: t
|
|
@@ -2224,8 +2248,8 @@ ${X}
|
|
|
2224
2248
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2225
2249
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2226
2250
|
return i;
|
|
2227
|
-
},
|
|
2228
|
-
let i = t ?? await
|
|
2251
|
+
}, mt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2252
|
+
let i = t ?? await pt(e, r);
|
|
2229
2253
|
return {
|
|
2230
2254
|
length: i,
|
|
2231
2255
|
name: n,
|
|
@@ -2238,9 +2262,9 @@ ${X}
|
|
|
2238
2262
|
return a.arrayBuffer();
|
|
2239
2263
|
}
|
|
2240
2264
|
};
|
|
2241
|
-
},
|
|
2242
|
-
if ("blob" in e) return
|
|
2243
|
-
if ("url" in e) return
|
|
2265
|
+
}, ht = async (e) => {
|
|
2266
|
+
if ("blob" in e) return ft(e);
|
|
2267
|
+
if ("url" in e) return mt(e);
|
|
2244
2268
|
if ("read" in e) return {
|
|
2245
2269
|
length: e.length,
|
|
2246
2270
|
name: e.name,
|
|
@@ -2249,4 +2273,4 @@ ${X}
|
|
|
2249
2273
|
throw Error(`Unknown source type: ${e}`);
|
|
2250
2274
|
};
|
|
2251
2275
|
//#endregion
|
|
2252
|
-
export {
|
|
2276
|
+
export { lt as MediaPlayer, lt as default, R as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, ht as inputToRemuxerInput, dt as isDelegatedTracks, ut as isExternalThumbnails, re as sourceFeature, i as startPlayback, he as usePictureInPicture, z as usePlayer, me as useSeekThumbnails };
|