@banou/media-player 0.8.11 → 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 +312 -265
- package/dist/react/components/errors.d.ts +2 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +37 -2
- 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/errors.tsx +21 -2
- package/src/lib/react/components/progress-bar.tsx +7 -2
- package/src/lib/react/hooks/use-playback.ts +91 -6
- package/src/lib/react/source-feature.ts +26 -2
- 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,38 +136,50 @@ var ae = {
|
|
|
117
136
|
ready: !1
|
|
118
137
|
});
|
|
119
138
|
let u = (t, n) => {
|
|
120
|
-
let r =
|
|
121
|
-
|
|
139
|
+
let r = Date.now(), i = le(t), o = ue(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
140
|
+
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
141
|
+
let e = {
|
|
142
|
+
...c,
|
|
143
|
+
count: c.count + 1,
|
|
144
|
+
lastAt: r
|
|
145
|
+
};
|
|
146
|
+
a.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
let l = {
|
|
150
|
+
at: r,
|
|
151
|
+
lastAt: r,
|
|
152
|
+
count: 1,
|
|
122
153
|
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
123
|
-
message:
|
|
124
|
-
detail:
|
|
154
|
+
message: i,
|
|
155
|
+
detail: o,
|
|
125
156
|
recovered: n
|
|
126
157
|
};
|
|
127
|
-
a.setSourceState({ playbackErrors: [...
|
|
158
|
+
a.setSourceState({ playbackErrors: [...s, l] });
|
|
128
159
|
}, d = (e) => {
|
|
129
160
|
if (r) return;
|
|
130
161
|
let t = n(e);
|
|
131
162
|
if (u(e, t), t) {
|
|
132
163
|
let t = performance.now();
|
|
133
|
-
t -
|
|
164
|
+
t - T.current.at > oe && (T.current = {
|
|
134
165
|
count: 0,
|
|
135
166
|
at: t
|
|
136
167
|
});
|
|
137
|
-
let n =
|
|
138
|
-
|
|
139
|
-
count:
|
|
168
|
+
let n = H[Math.min(T.current.count, H.length - 1)];
|
|
169
|
+
T.current = {
|
|
170
|
+
count: T.current.count + 1,
|
|
140
171
|
at: t
|
|
141
|
-
}, 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);
|
|
142
173
|
return;
|
|
143
174
|
}
|
|
144
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
175
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), N.current?.(e);
|
|
145
176
|
};
|
|
146
177
|
return (async () => {
|
|
147
178
|
try {
|
|
148
179
|
let n = await i({
|
|
149
180
|
videoElement: e,
|
|
150
181
|
canvasElement: t,
|
|
151
|
-
read: (e, t) =>
|
|
182
|
+
read: (e, t) => j.current(e, t),
|
|
152
183
|
length: s,
|
|
153
184
|
publicPath: c,
|
|
154
185
|
libavWorkerUrl: l,
|
|
@@ -157,27 +188,27 @@ var ae = {
|
|
|
157
188
|
jassubLegacyWasmUrl: g,
|
|
158
189
|
defaultFontUrl: _,
|
|
159
190
|
bufferSize: v,
|
|
160
|
-
audioStreamIndex:
|
|
191
|
+
audioStreamIndex: x,
|
|
161
192
|
onReady: () => {
|
|
162
193
|
if (r) return;
|
|
163
194
|
a.setSourceState({ ready: !0 });
|
|
164
|
-
let t =
|
|
165
|
-
|
|
195
|
+
let t = O.current;
|
|
196
|
+
O.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
166
197
|
},
|
|
167
198
|
onError: d,
|
|
168
199
|
onRecovered: () => {
|
|
169
200
|
r || a.setSourceState({ playbackError: null });
|
|
170
201
|
},
|
|
171
|
-
onSeek: (e) =>
|
|
202
|
+
onSeek: (e) => M.current?.(e),
|
|
172
203
|
onSubtitleStreams: (e) => {
|
|
173
204
|
r || a.setSourceState({
|
|
174
|
-
subtitleTracks:
|
|
175
|
-
...
|
|
205
|
+
subtitleTracks: V(e),
|
|
206
|
+
...A.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
176
207
|
});
|
|
177
208
|
},
|
|
178
209
|
onAudioStreams: (e, t) => {
|
|
179
210
|
r || a.setSourceState({
|
|
180
|
-
audioTracks:
|
|
211
|
+
audioTracks: V(e),
|
|
181
212
|
selectedAudioTrack: t
|
|
182
213
|
});
|
|
183
214
|
}
|
|
@@ -186,17 +217,17 @@ var ae = {
|
|
|
186
217
|
n.destroy();
|
|
187
218
|
return;
|
|
188
219
|
}
|
|
189
|
-
|
|
220
|
+
D.current = n, a.setSourceState({ indexes: n.indexes });
|
|
190
221
|
let o = a.selectedSubtitleTrack;
|
|
191
222
|
typeof o == "number" && n.selectSubtitleStream(o);
|
|
192
223
|
} catch (e) {
|
|
193
224
|
d(e);
|
|
194
225
|
}
|
|
195
226
|
})(), () => {
|
|
196
|
-
r = !0,
|
|
227
|
+
r = !0, O.current = {
|
|
197
228
|
time: e.currentTime,
|
|
198
229
|
size: s
|
|
199
|
-
},
|
|
230
|
+
}, D.current?.destroy(), D.current = null, a.setSourceState({ ready: !1 });
|
|
200
231
|
};
|
|
201
232
|
}, [
|
|
202
233
|
a,
|
|
@@ -210,17 +241,17 @@ var ae = {
|
|
|
210
241
|
g,
|
|
211
242
|
_,
|
|
212
243
|
v,
|
|
213
|
-
|
|
244
|
+
x,
|
|
214
245
|
y,
|
|
215
|
-
|
|
246
|
+
C
|
|
216
247
|
]);
|
|
217
|
-
},
|
|
248
|
+
}, fe = 5e3, pe = 6e4, me = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
218
249
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
219
250
|
l.current = i;
|
|
220
251
|
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
221
252
|
return h.current = u, d(() => {
|
|
222
253
|
if (!n || !i || !e || !t) return;
|
|
223
|
-
let a = !1, o = null, u, d =
|
|
254
|
+
let a = !1, o = null, u, d = fe, f = () => {
|
|
224
255
|
r({
|
|
225
256
|
publicPath: e,
|
|
226
257
|
workerUrl: t,
|
|
@@ -236,7 +267,7 @@ var ae = {
|
|
|
236
267
|
}
|
|
237
268
|
o = e, c.current = e, e.update(h.current);
|
|
238
269
|
}, () => {
|
|
239
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
270
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, pe));
|
|
240
271
|
});
|
|
241
272
|
};
|
|
242
273
|
return f(), () => {
|
|
@@ -249,7 +280,7 @@ var ae = {
|
|
|
249
280
|
]), d(() => {
|
|
250
281
|
c.current?.update(u);
|
|
251
282
|
}, [u]), o;
|
|
252
|
-
},
|
|
283
|
+
}, he = (e, n) => {
|
|
253
284
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
254
285
|
d(() => {
|
|
255
286
|
if (!e || !n || !s) return;
|
|
@@ -277,7 +308,7 @@ var ae = {
|
|
|
277
308
|
mode: s,
|
|
278
309
|
burnedIn: i
|
|
279
310
|
};
|
|
280
|
-
},
|
|
311
|
+
}, U = {
|
|
281
312
|
headings: {
|
|
282
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 ",
|
|
283
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 ",
|
|
@@ -319,7 +350,7 @@ var ae = {
|
|
|
319
350
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
320
351
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
321
352
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
322
|
-
${
|
|
353
|
+
${U.headings.small}
|
|
323
354
|
color: white;
|
|
324
355
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
325
356
|
z-index: 2;
|
|
@@ -367,11 +398,11 @@ var ae = {
|
|
|
367
398
|
padding: 0 calc(2 * var(--mp-unit));
|
|
368
399
|
text-align: center;
|
|
369
400
|
color: #fff;
|
|
370
|
-
${
|
|
401
|
+
${U.bLarge.regular}
|
|
371
402
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
372
403
|
pointer-events: none;
|
|
373
404
|
`, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
|
|
374
|
-
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);
|
|
375
406
|
return /* @__PURE__ */ w(S, { children: [
|
|
376
407
|
t ? /* @__PURE__ */ C("div", {
|
|
377
408
|
className: "title",
|
|
@@ -392,11 +423,11 @@ var ae = {
|
|
|
392
423
|
css: ge
|
|
393
424
|
})
|
|
394
425
|
] });
|
|
395
|
-
},
|
|
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) => {
|
|
396
427
|
if (e === void 0) return "0:00";
|
|
397
428
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
398
429
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
399
|
-
},
|
|
430
|
+
}, we = (e, t) => `${K(e)} / ${K(t)}`, Te = (e) => h`
|
|
400
431
|
display: flex;
|
|
401
432
|
justify-content: flex-end;
|
|
402
433
|
|
|
@@ -406,7 +437,7 @@ var ae = {
|
|
|
406
437
|
z-index: 3;
|
|
407
438
|
|
|
408
439
|
* {
|
|
409
|
-
${
|
|
440
|
+
${U.bMedium.regular}
|
|
410
441
|
}
|
|
411
442
|
|
|
412
443
|
${e === "sm" && h`
|
|
@@ -426,8 +457,8 @@ var ae = {
|
|
|
426
457
|
"data-tooltip-delay-hide": i,
|
|
427
458
|
"data-tooltip-place": o,
|
|
428
459
|
children: n
|
|
429
|
-
}), !s && /* @__PURE__ */ C(
|
|
430
|
-
css:
|
|
460
|
+
}), !s && /* @__PURE__ */ C(te, {
|
|
461
|
+
css: Te(c),
|
|
431
462
|
id: e,
|
|
432
463
|
noArrow: !0,
|
|
433
464
|
children: t
|
|
@@ -458,7 +489,7 @@ var ae = {
|
|
|
458
489
|
style: { touchAction: "none" }
|
|
459
490
|
}
|
|
460
491
|
};
|
|
461
|
-
},
|
|
492
|
+
}, Ee = h`
|
|
462
493
|
position: relative;
|
|
463
494
|
height: calc(.4 * var(--mp-unit));
|
|
464
495
|
|
|
@@ -512,7 +543,7 @@ var ae = {
|
|
|
512
543
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
513
544
|
|
|
514
545
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
515
|
-
${
|
|
546
|
+
${U.bMedium.bold}
|
|
516
547
|
|
|
517
548
|
position: absolute;
|
|
518
549
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -629,29 +660,29 @@ var ae = {
|
|
|
629
660
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
630
661
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
631
662
|
}
|
|
632
|
-
`,
|
|
633
|
-
let e =
|
|
634
|
-
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,
|
|
635
666
|
onChange: (e) => {
|
|
636
|
-
|
|
667
|
+
h(e), v.current !== "mouse" && _(e * r);
|
|
637
668
|
}
|
|
638
|
-
}),
|
|
639
|
-
|
|
640
|
-
}, x = (e) => {
|
|
641
|
-
y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
|
|
669
|
+
}), x = (e) => {
|
|
670
|
+
v.current = e.pointerType, b.onPointerDown(e);
|
|
642
671
|
}, S = (e) => {
|
|
643
|
-
|
|
644
|
-
let { left: t, right: r } = c.current.getBoundingClientRect();
|
|
645
|
-
return Math.min(Math.max((e - t) / (r - t), 0), 1) * n;
|
|
672
|
+
b.onPointerUp(e), e.pointerType !== "mouse" && _(void 0);
|
|
646
673
|
}, T = (e) => {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
},
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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;
|
|
655
686
|
return /* @__PURE__ */ C("div", {
|
|
656
687
|
className: "loaded-part",
|
|
657
688
|
style: {
|
|
@@ -660,76 +691,77 @@ var ae = {
|
|
|
660
691
|
}
|
|
661
692
|
}, t);
|
|
662
693
|
}) ?? [], [
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
]),
|
|
667
|
-
if (!
|
|
668
|
-
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);
|
|
669
700
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
670
|
-
}, [
|
|
701
|
+
}, [g]);
|
|
671
702
|
d(() => {
|
|
672
|
-
if (
|
|
673
|
-
let t =
|
|
674
|
-
e.seek(t);
|
|
703
|
+
if (u === void 0 || !r) return;
|
|
704
|
+
let t = u * r;
|
|
705
|
+
n ? n(t) : e.seek(t);
|
|
675
706
|
}, [
|
|
676
707
|
e,
|
|
677
|
-
|
|
678
|
-
|
|
708
|
+
n,
|
|
709
|
+
u,
|
|
710
|
+
r
|
|
679
711
|
]);
|
|
680
|
-
let
|
|
681
|
-
if (
|
|
682
|
-
if (
|
|
683
|
-
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);
|
|
684
716
|
}
|
|
685
717
|
}, [
|
|
686
|
-
o,
|
|
687
718
|
s,
|
|
688
|
-
|
|
719
|
+
c,
|
|
720
|
+
g
|
|
689
721
|
]);
|
|
690
722
|
return /* @__PURE__ */ w("div", {
|
|
691
|
-
css:
|
|
692
|
-
ref:
|
|
693
|
-
className:
|
|
694
|
-
onMouseMove:
|
|
695
|
-
onMouseOut:
|
|
723
|
+
css: Ee,
|
|
724
|
+
ref: l,
|
|
725
|
+
className: y ? "progress-bar dragging" : "progress-bar",
|
|
726
|
+
onMouseMove: E,
|
|
727
|
+
onMouseOut: D,
|
|
696
728
|
children: [
|
|
697
729
|
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
698
|
-
|
|
730
|
+
g ? /* @__PURE__ */ C("div", {
|
|
699
731
|
className: "cursor-time",
|
|
700
|
-
style: { left: `clamp(calc(3 * var(--mp-unit)), ${
|
|
701
|
-
children:
|
|
732
|
+
style: { left: `clamp(calc(3 * var(--mp-unit)), ${O(g)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
733
|
+
children: A
|
|
702
734
|
}) : void 0,
|
|
703
735
|
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
704
736
|
/* @__PURE__ */ C("div", {
|
|
705
737
|
className: "loaded",
|
|
706
|
-
children:
|
|
738
|
+
children: k
|
|
707
739
|
}),
|
|
708
740
|
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
709
741
|
/* @__PURE__ */ C("div", {
|
|
710
742
|
className: "play-container",
|
|
711
743
|
children: /* @__PURE__ */ C("div", {
|
|
712
744
|
className: "play",
|
|
713
|
-
style: { transform: `scaleX(${
|
|
745
|
+
style: { transform: `scaleX(${j})` }
|
|
714
746
|
})
|
|
715
747
|
}),
|
|
716
748
|
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
717
749
|
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
718
750
|
/* @__PURE__ */ C("div", {
|
|
719
751
|
className: "padding",
|
|
720
|
-
...
|
|
721
|
-
onPointerDown:
|
|
722
|
-
onPointerUp:
|
|
723
|
-
onPointerCancel:
|
|
752
|
+
...b,
|
|
753
|
+
onPointerDown: x,
|
|
754
|
+
onPointerUp: S,
|
|
755
|
+
onPointerCancel: S
|
|
724
756
|
}),
|
|
725
757
|
/* @__PURE__ */ C("div", {
|
|
726
758
|
className: "thumbnail",
|
|
727
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
728
|
-
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
|
|
729
761
|
})
|
|
730
762
|
]
|
|
731
763
|
});
|
|
732
|
-
},
|
|
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 = {
|
|
733
765
|
xmlns: "http://www.w3.org/2000/svg",
|
|
734
766
|
width: 24,
|
|
735
767
|
height: 24,
|
|
@@ -739,7 +771,7 @@ var ae = {
|
|
|
739
771
|
strokeWidth: 2,
|
|
740
772
|
strokeLinecap: "round",
|
|
741
773
|
strokeLinejoin: "round"
|
|
742
|
-
},
|
|
774
|
+
}, ke = (e) => /* @__PURE__ */ w("svg", {
|
|
743
775
|
...Y,
|
|
744
776
|
...e,
|
|
745
777
|
children: [/* @__PURE__ */ C("rect", {
|
|
@@ -750,7 +782,7 @@ var ae = {
|
|
|
750
782
|
rx: "2",
|
|
751
783
|
ry: "2"
|
|
752
784
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
753
|
-
}),
|
|
785
|
+
}), Ae = (e) => /* @__PURE__ */ w("svg", {
|
|
754
786
|
...Y,
|
|
755
787
|
...e,
|
|
756
788
|
children: [
|
|
@@ -770,7 +802,7 @@ var ae = {
|
|
|
770
802
|
y2: "22"
|
|
771
803
|
})
|
|
772
804
|
]
|
|
773
|
-
}),
|
|
805
|
+
}), je = (e) => /* @__PURE__ */ w("svg", {
|
|
774
806
|
...Y,
|
|
775
807
|
...e,
|
|
776
808
|
children: [
|
|
@@ -824,7 +856,7 @@ var ae = {
|
|
|
824
856
|
|
|
825
857
|
border-radius: 8px;
|
|
826
858
|
background-color: rgba(28,28,28,0.95);
|
|
827
|
-
${
|
|
859
|
+
${U.bMedium.regular}
|
|
828
860
|
|
|
829
861
|
z-index: 4;
|
|
830
862
|
|
|
@@ -867,7 +899,7 @@ var ae = {
|
|
|
867
899
|
|
|
868
900
|
.secondary {
|
|
869
901
|
color: #eee;
|
|
870
|
-
${
|
|
902
|
+
${U.bSmall.regular}
|
|
871
903
|
}
|
|
872
904
|
}
|
|
873
905
|
}
|
|
@@ -909,10 +941,10 @@ var ae = {
|
|
|
909
941
|
.failed {
|
|
910
942
|
border-bottom: 1px solid #4D4D4E;
|
|
911
943
|
color: #f66;
|
|
912
|
-
${
|
|
944
|
+
${U.bSmall.regular}
|
|
913
945
|
}
|
|
914
946
|
}
|
|
915
|
-
`,
|
|
947
|
+
`, Me = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
916
948
|
let c = o !== void 0, l = (e, i, a) => {
|
|
917
949
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
918
950
|
return /* @__PURE__ */ w("div", {
|
|
@@ -980,7 +1012,7 @@ var ae = {
|
|
|
980
1012
|
});
|
|
981
1013
|
}
|
|
982
1014
|
};
|
|
983
|
-
},
|
|
1015
|
+
}, Ne = h`
|
|
984
1016
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
985
1017
|
which is the width of the player box, so it can be clamped to it. */
|
|
986
1018
|
position: static;
|
|
@@ -1024,7 +1056,7 @@ ${X}
|
|
|
1024
1056
|
|
|
1025
1057
|
color: #fff;
|
|
1026
1058
|
cursor: pointer;
|
|
1027
|
-
${
|
|
1059
|
+
${U.bSmall.regular}
|
|
1028
1060
|
|
|
1029
1061
|
&:hover {
|
|
1030
1062
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1045,7 +1077,13 @@ ${X}
|
|
|
1045
1077
|
|
|
1046
1078
|
.when {
|
|
1047
1079
|
color: #bbb;
|
|
1048
|
-
${
|
|
1080
|
+
${U.bSmall.regular}
|
|
1081
|
+
|
|
1082
|
+
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1083
|
+
.count {
|
|
1084
|
+
margin-left: 6px;
|
|
1085
|
+
color: #fff;
|
|
1086
|
+
}
|
|
1049
1087
|
}
|
|
1050
1088
|
|
|
1051
1089
|
.what {
|
|
@@ -1058,27 +1096,27 @@ ${X}
|
|
|
1058
1096
|
color: #ddd;
|
|
1059
1097
|
overflow-wrap: anywhere;
|
|
1060
1098
|
white-space: pre-wrap;
|
|
1061
|
-
${
|
|
1099
|
+
${U.bSmall.regular}
|
|
1062
1100
|
}
|
|
1063
1101
|
}
|
|
1064
1102
|
}
|
|
1065
|
-
`,
|
|
1066
|
-
let n = Q(e.atMediaTime);
|
|
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) => {
|
|
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();
|
|
1067
1105
|
return [
|
|
1068
|
-
`${t + 1}. ${
|
|
1106
|
+
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1069
1107
|
e.message,
|
|
1070
1108
|
e.detail
|
|
1071
1109
|
].filter(Boolean).join("\n");
|
|
1072
|
-
}).join("\n\n"),
|
|
1073
|
-
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);
|
|
1074
1112
|
if (e.length === 0) return null;
|
|
1075
1113
|
let o = () => {
|
|
1076
|
-
navigator.clipboard?.writeText(
|
|
1114
|
+
navigator.clipboard?.writeText(Ie(e)).then(() => {
|
|
1077
1115
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1078
1116
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1079
|
-
}, s = `Playback errors (${e
|
|
1117
|
+
}, s = `Playback errors (${Fe(e)})`;
|
|
1080
1118
|
return /* @__PURE__ */ w("div", {
|
|
1081
|
-
css:
|
|
1119
|
+
css: Ne,
|
|
1082
1120
|
ref: r,
|
|
1083
1121
|
children: [/* @__PURE__ */ C(q, {
|
|
1084
1122
|
id: "errors",
|
|
@@ -1109,9 +1147,14 @@ ${X}
|
|
|
1109
1147
|
/* @__PURE__ */ w("span", {
|
|
1110
1148
|
className: "when",
|
|
1111
1149
|
children: [
|
|
1112
|
-
|
|
1150
|
+
Pe(e.at),
|
|
1151
|
+
e.count > 1 ? ` to ${Pe(e.lastAt)}` : "",
|
|
1113
1152
|
Q(e.atMediaTime) ? ` at ${Q(e.atMediaTime)}` : "",
|
|
1114
|
-
e.recovered ? " recovered" : ""
|
|
1153
|
+
e.recovered ? " recovered" : "",
|
|
1154
|
+
e.count > 1 ? /* @__PURE__ */ C("span", {
|
|
1155
|
+
className: "count",
|
|
1156
|
+
children: `×${e.count}`
|
|
1157
|
+
}) : null
|
|
1115
1158
|
]
|
|
1116
1159
|
}),
|
|
1117
1160
|
/* @__PURE__ */ C("span", {
|
|
@@ -1126,7 +1169,7 @@ ${X}
|
|
|
1126
1169
|
}, `${e.at}-${t}`))]
|
|
1127
1170
|
})]
|
|
1128
1171
|
});
|
|
1129
|
-
},
|
|
1172
|
+
}, Re = h`
|
|
1130
1173
|
display: flex;
|
|
1131
1174
|
align-items: center;
|
|
1132
1175
|
justify-content: center;
|
|
@@ -1179,8 +1222,8 @@ width: 100%;
|
|
|
1179
1222
|
}
|
|
1180
1223
|
}
|
|
1181
1224
|
}
|
|
1182
|
-
`,
|
|
1183
|
-
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({
|
|
1184
1227
|
ref: r,
|
|
1185
1228
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1186
1229
|
}), f = (t) => {
|
|
@@ -1196,7 +1239,7 @@ width: 100%;
|
|
|
1196
1239
|
}, [t]);
|
|
1197
1240
|
let m = c(s);
|
|
1198
1241
|
return /* @__PURE__ */ w("div", {
|
|
1199
|
-
css:
|
|
1242
|
+
css: Re,
|
|
1200
1243
|
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1201
1244
|
className: "playback-slider",
|
|
1202
1245
|
ref: n,
|
|
@@ -1214,7 +1257,7 @@ width: 100%;
|
|
|
1214
1257
|
})
|
|
1215
1258
|
})]
|
|
1216
1259
|
});
|
|
1217
|
-
},
|
|
1260
|
+
}, Be = h`
|
|
1218
1261
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1219
1262
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1220
1263
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1273,8 +1316,8 @@ ${X}
|
|
|
1273
1316
|
}
|
|
1274
1317
|
}
|
|
1275
1318
|
|
|
1276
|
-
`,
|
|
1277
|
-
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) => {
|
|
1278
1321
|
e.setPlaybackRate(t), o(0);
|
|
1279
1322
|
}, h = (e) => {
|
|
1280
1323
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1282,7 +1325,7 @@ ${X}
|
|
|
1282
1325
|
o(e);
|
|
1283
1326
|
};
|
|
1284
1327
|
return /* @__PURE__ */ w("div", {
|
|
1285
|
-
css:
|
|
1328
|
+
css: Be,
|
|
1286
1329
|
ref: l,
|
|
1287
1330
|
children: [
|
|
1288
1331
|
/* @__PURE__ */ C(q, {
|
|
@@ -1294,7 +1337,7 @@ ${X}
|
|
|
1294
1337
|
onClick: c,
|
|
1295
1338
|
"aria-label": "Settings",
|
|
1296
1339
|
"aria-expanded": s,
|
|
1297
|
-
children: /* @__PURE__ */ C(
|
|
1340
|
+
children: /* @__PURE__ */ C(F, {})
|
|
1298
1341
|
}),
|
|
1299
1342
|
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1300
1343
|
}),
|
|
@@ -1321,7 +1364,7 @@ ${X}
|
|
|
1321
1364
|
}),
|
|
1322
1365
|
/* @__PURE__ */ C("div", {
|
|
1323
1366
|
className: "slider no-hover",
|
|
1324
|
-
children: /* @__PURE__ */ C(
|
|
1367
|
+
children: /* @__PURE__ */ C(ze, {})
|
|
1325
1368
|
}),
|
|
1326
1369
|
/* @__PURE__ */ w("div", {
|
|
1327
1370
|
className: "options no-hover",
|
|
@@ -1346,7 +1389,7 @@ ${X}
|
|
|
1346
1389
|
})
|
|
1347
1390
|
]
|
|
1348
1391
|
}),
|
|
1349
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1392
|
+
s && a === 2 && /* @__PURE__ */ C(Me, {
|
|
1350
1393
|
title: "Audio",
|
|
1351
1394
|
tracks: n,
|
|
1352
1395
|
selected: r,
|
|
@@ -1357,7 +1400,7 @@ ${X}
|
|
|
1357
1400
|
})
|
|
1358
1401
|
]
|
|
1359
1402
|
});
|
|
1360
|
-
},
|
|
1403
|
+
}, He = h`
|
|
1361
1404
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1362
1405
|
which is the width of the player box, so it can be clamped to it. */
|
|
1363
1406
|
position: static;
|
|
@@ -1374,12 +1417,12 @@ position: static;
|
|
|
1374
1417
|
}
|
|
1375
1418
|
|
|
1376
1419
|
${X}
|
|
1377
|
-
`,
|
|
1378
|
-
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();
|
|
1379
1422
|
if (e.length === 0) return null;
|
|
1380
1423
|
let u = t !== void 0;
|
|
1381
1424
|
return /* @__PURE__ */ w("div", {
|
|
1382
|
-
css:
|
|
1425
|
+
css: He,
|
|
1383
1426
|
ref: o,
|
|
1384
1427
|
children: [/* @__PURE__ */ C(q, {
|
|
1385
1428
|
id: "subtitles",
|
|
@@ -1391,10 +1434,10 @@ ${X}
|
|
|
1391
1434
|
"aria-label": "Subtitles",
|
|
1392
1435
|
"aria-expanded": i,
|
|
1393
1436
|
"aria-pressed": u,
|
|
1394
|
-
children: u ? /* @__PURE__ */ C(
|
|
1437
|
+
children: u ? /* @__PURE__ */ C(ke, { className: "captions" }) : /* @__PURE__ */ C(Ae, { className: "captions-off" })
|
|
1395
1438
|
}),
|
|
1396
1439
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1397
|
-
}), i && /* @__PURE__ */ C(
|
|
1440
|
+
}), i && /* @__PURE__ */ C(Me, {
|
|
1398
1441
|
title: "Subtitles",
|
|
1399
1442
|
tracks: e,
|
|
1400
1443
|
selected: t,
|
|
@@ -1404,14 +1447,14 @@ ${X}
|
|
|
1404
1447
|
failed: c
|
|
1405
1448
|
})]
|
|
1406
1449
|
});
|
|
1407
|
-
},
|
|
1450
|
+
}, We = {
|
|
1408
1451
|
primary: "#EAEBEE",
|
|
1409
1452
|
secondary: "#D0D0D9",
|
|
1410
1453
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1411
1454
|
accent: "#6EA8FE",
|
|
1412
1455
|
borderPrimary: "#384F70",
|
|
1413
1456
|
backgroundTooltip: "#222222"
|
|
1414
|
-
},
|
|
1457
|
+
}, Ge = h`
|
|
1415
1458
|
display: flex;
|
|
1416
1459
|
align-items: center;
|
|
1417
1460
|
|
|
@@ -1454,8 +1497,8 @@ ${X}
|
|
|
1454
1497
|
width: 10px;
|
|
1455
1498
|
height: 10px;
|
|
1456
1499
|
}
|
|
1457
|
-
`,
|
|
1458
|
-
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({
|
|
1459
1502
|
ref: a,
|
|
1460
1503
|
onChange: t
|
|
1461
1504
|
}), s = (n) => {
|
|
@@ -1474,7 +1517,7 @@ ${X}
|
|
|
1474
1517
|
id: "volume-slider",
|
|
1475
1518
|
text: /* @__PURE__ */ C("div", {
|
|
1476
1519
|
ref: i,
|
|
1477
|
-
css:
|
|
1520
|
+
css: Ge,
|
|
1478
1521
|
...o,
|
|
1479
1522
|
children: /* @__PURE__ */ C("div", {
|
|
1480
1523
|
ref: a,
|
|
@@ -1493,7 +1536,7 @@ ${X}
|
|
|
1493
1536
|
children: [l, "%"]
|
|
1494
1537
|
})
|
|
1495
1538
|
});
|
|
1496
|
-
},
|
|
1539
|
+
}, qe = h`
|
|
1497
1540
|
position: relative;
|
|
1498
1541
|
display: flex;
|
|
1499
1542
|
align-items: center;
|
|
@@ -1518,7 +1561,7 @@ ${X}
|
|
|
1518
1561
|
border-radius: 4px;
|
|
1519
1562
|
|
|
1520
1563
|
.volume-value {
|
|
1521
|
-
${
|
|
1564
|
+
${U.bMedium.regular};
|
|
1522
1565
|
color: #ffffff;
|
|
1523
1566
|
}
|
|
1524
1567
|
}
|
|
@@ -1556,10 +1599,10 @@ ${X}
|
|
|
1556
1599
|
}
|
|
1557
1600
|
}
|
|
1558
1601
|
|
|
1559
|
-
`,
|
|
1560
|
-
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]);
|
|
1561
1604
|
return /* @__PURE__ */ w("div", {
|
|
1562
|
-
css:
|
|
1605
|
+
css: qe,
|
|
1563
1606
|
children: [/* @__PURE__ */ C(q, {
|
|
1564
1607
|
id: "sound",
|
|
1565
1608
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1569,7 +1612,7 @@ ${X}
|
|
|
1569
1612
|
ref: e,
|
|
1570
1613
|
"aria-label": "Mute",
|
|
1571
1614
|
"aria-pressed": r || n === 0,
|
|
1572
|
-
children: C(r || n === 0 ?
|
|
1615
|
+
children: C(r || n === 0 ? ee : n <= .5 ? I : L, {
|
|
1573
1616
|
size: 18,
|
|
1574
1617
|
color: "#fff"
|
|
1575
1618
|
})
|
|
@@ -1579,16 +1622,16 @@ ${X}
|
|
|
1579
1622
|
className: "volume-slider-container",
|
|
1580
1623
|
children: /* @__PURE__ */ C("div", {
|
|
1581
1624
|
className: "volume-slider-background",
|
|
1582
|
-
children: /* @__PURE__ */ C(
|
|
1625
|
+
children: /* @__PURE__ */ C(Ke, {
|
|
1583
1626
|
value: r ? 0 : i,
|
|
1584
1627
|
onChange: (e) => {
|
|
1585
|
-
t.setVolume(
|
|
1628
|
+
t.setVolume(Ce(e));
|
|
1586
1629
|
}
|
|
1587
1630
|
})
|
|
1588
1631
|
})
|
|
1589
1632
|
})]
|
|
1590
1633
|
});
|
|
1591
|
-
}, $ = .05,
|
|
1634
|
+
}, $ = .05, Ye = 5, Xe = h`
|
|
1592
1635
|
display: flex;
|
|
1593
1636
|
flex-direction: column;
|
|
1594
1637
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1599,7 +1642,7 @@ ${X}
|
|
|
1599
1642
|
opacity: 0.72;
|
|
1600
1643
|
font-size: 0.9em;
|
|
1601
1644
|
}
|
|
1602
|
-
`,
|
|
1645
|
+
`, Ze = h`
|
|
1603
1646
|
position: absolute;
|
|
1604
1647
|
bottom: 0;
|
|
1605
1648
|
width: 100%;
|
|
@@ -1664,7 +1707,7 @@ ${X}
|
|
|
1664
1707
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1665
1708
|
*/
|
|
1666
1709
|
button[aria-pressed='true'] svg {
|
|
1667
|
-
stroke: ${
|
|
1710
|
+
stroke: ${We.accent};
|
|
1668
1711
|
}
|
|
1669
1712
|
|
|
1670
1713
|
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
@@ -1699,7 +1742,7 @@ ${X}
|
|
|
1699
1742
|
cursor: pointer;
|
|
1700
1743
|
|
|
1701
1744
|
:hover {
|
|
1702
|
-
background-color: ${
|
|
1745
|
+
background-color: ${We.hover};
|
|
1703
1746
|
}
|
|
1704
1747
|
|
|
1705
1748
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1716,7 +1759,7 @@ ${X}
|
|
|
1716
1759
|
|
|
1717
1760
|
.left {
|
|
1718
1761
|
.time {
|
|
1719
|
-
${
|
|
1762
|
+
${U.bMedium.regular}
|
|
1720
1763
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1721
1764
|
}
|
|
1722
1765
|
}
|
|
@@ -1737,54 +1780,58 @@ ${X}
|
|
|
1737
1780
|
}
|
|
1738
1781
|
}
|
|
1739
1782
|
}
|
|
1740
|
-
`,
|
|
1741
|
-
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 }) => {
|
|
1742
1785
|
let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1743
|
-
e.setVolume(
|
|
1786
|
+
e.setVolume(Ce(a)), o && !e.muted && e.toggleMuted();
|
|
1744
1787
|
}, [e]);
|
|
1745
1788
|
d(() => {
|
|
1746
|
-
let t = (t) => {
|
|
1747
|
-
let
|
|
1748
|
-
if (
|
|
1749
|
-
let
|
|
1750
|
-
if (
|
|
1751
|
-
else if (
|
|
1752
|
-
else if (
|
|
1753
|
-
else if (
|
|
1754
|
-
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({
|
|
1755
1798
|
direction: "up",
|
|
1756
1799
|
stepSize: $
|
|
1757
1800
|
});
|
|
1758
|
-
else if (
|
|
1801
|
+
else if (n.key === "ArrowDown") y({
|
|
1759
1802
|
direction: "down",
|
|
1760
1803
|
stepSize: $
|
|
1761
1804
|
});
|
|
1762
|
-
else if (
|
|
1805
|
+
else if (n.key === "ArrowRight") {
|
|
1763
1806
|
if (!e.duration) return;
|
|
1764
|
-
|
|
1765
|
-
} else
|
|
1766
|
-
|
|
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();
|
|
1767
1810
|
};
|
|
1768
|
-
return window.addEventListener("keydown",
|
|
1769
|
-
}, [
|
|
1770
|
-
|
|
1771
|
-
|
|
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({
|
|
1772
1819
|
direction: "up",
|
|
1773
1820
|
stepSize: $
|
|
1774
|
-
}) :
|
|
1821
|
+
}) : y({
|
|
1775
1822
|
direction: "down",
|
|
1776
1823
|
stepSize: $
|
|
1777
1824
|
});
|
|
1778
|
-
}, [
|
|
1825
|
+
}, [y]);
|
|
1779
1826
|
return d(() => {
|
|
1780
|
-
if (
|
|
1781
|
-
}, [
|
|
1782
|
-
css:
|
|
1827
|
+
if (p) return p.addEventListener("wheel", b, { passive: !1 }), () => p.removeEventListener("wheel", b);
|
|
1828
|
+
}, [p, b]), /* @__PURE__ */ w("div", {
|
|
1829
|
+
css: Ze,
|
|
1783
1830
|
style: { ...a ? {
|
|
1784
1831
|
opacity: "0",
|
|
1785
1832
|
pointerEvents: "none"
|
|
1786
1833
|
} : {} },
|
|
1787
|
-
children: [/* @__PURE__ */ C(
|
|
1834
|
+
children: [/* @__PURE__ */ C(De, {}), /* @__PURE__ */ w("div", {
|
|
1788
1835
|
className: "actions",
|
|
1789
1836
|
children: [/* @__PURE__ */ w("div", {
|
|
1790
1837
|
className: "left",
|
|
@@ -1796,23 +1843,23 @@ ${X}
|
|
|
1796
1843
|
className: "play",
|
|
1797
1844
|
type: "button",
|
|
1798
1845
|
onClick: () => e.togglePaused(),
|
|
1799
|
-
"aria-label":
|
|
1800
|
-
children: C(
|
|
1846
|
+
"aria-label": v ? "Replay" : t ? "Play" : "Pause",
|
|
1847
|
+
children: C(v ? P : t ? N : M, {})
|
|
1801
1848
|
}),
|
|
1802
|
-
toolTipText: /* @__PURE__ */ C("span", { children:
|
|
1849
|
+
toolTipText: /* @__PURE__ */ C("span", { children: v ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1803
1850
|
}),
|
|
1804
|
-
/* @__PURE__ */ C(
|
|
1851
|
+
/* @__PURE__ */ C(Je, { ref: h }),
|
|
1805
1852
|
/* @__PURE__ */ C("div", {
|
|
1806
1853
|
className: "time",
|
|
1807
|
-
children:
|
|
1854
|
+
children: we(n, r)
|
|
1808
1855
|
})
|
|
1809
1856
|
]
|
|
1810
1857
|
}), /* @__PURE__ */ w("div", {
|
|
1811
1858
|
className: "right",
|
|
1812
1859
|
children: [
|
|
1813
|
-
/* @__PURE__ */ C(
|
|
1814
|
-
/* @__PURE__ */ C(
|
|
1815
|
-
/* @__PURE__ */ C(
|
|
1860
|
+
/* @__PURE__ */ C(Le, {}),
|
|
1861
|
+
/* @__PURE__ */ C(Ue, {}),
|
|
1862
|
+
/* @__PURE__ */ C(Ve, {}),
|
|
1816
1863
|
o ? /* @__PURE__ */ C(q, {
|
|
1817
1864
|
id: "picture-in-picture",
|
|
1818
1865
|
tooltipPlace: "top-end",
|
|
@@ -1820,20 +1867,20 @@ ${X}
|
|
|
1820
1867
|
className: "picture-in-picture",
|
|
1821
1868
|
type: "button",
|
|
1822
1869
|
onClick: o,
|
|
1823
|
-
disabled:
|
|
1824
|
-
"aria-label":
|
|
1825
|
-
"aria-pressed":
|
|
1826
|
-
children:
|
|
1827
|
-
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,
|
|
1828
1875
|
alt: ""
|
|
1829
1876
|
})
|
|
1830
1877
|
}),
|
|
1831
1878
|
toolTipText: /* @__PURE__ */ w("span", {
|
|
1832
|
-
css:
|
|
1879
|
+
css: Xe,
|
|
1833
1880
|
children: [/* @__PURE__ */ C("span", {
|
|
1834
1881
|
className: "lead",
|
|
1835
|
-
children:
|
|
1836
|
-
}),
|
|
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", {
|
|
1837
1884
|
className: "hint",
|
|
1838
1885
|
children: "Then hover the video and click your browser's own pop out button"
|
|
1839
1886
|
}) : null]
|
|
@@ -1856,7 +1903,7 @@ ${X}
|
|
|
1856
1903
|
})]
|
|
1857
1904
|
})]
|
|
1858
1905
|
});
|
|
1859
|
-
},
|
|
1906
|
+
}, $e = 9e3, et = h`
|
|
1860
1907
|
position: absolute;
|
|
1861
1908
|
inset: 0;
|
|
1862
1909
|
z-index: 2;
|
|
@@ -1894,12 +1941,12 @@ ${X}
|
|
|
1894
1941
|
}
|
|
1895
1942
|
|
|
1896
1943
|
.title {
|
|
1897
|
-
${
|
|
1944
|
+
${U.bMedium.bold}
|
|
1898
1945
|
color: #fff;
|
|
1899
1946
|
}
|
|
1900
1947
|
|
|
1901
1948
|
.body {
|
|
1902
|
-
${
|
|
1949
|
+
${U.bSmall.regular}
|
|
1903
1950
|
color: rgba(255, 255, 255, 0.75);
|
|
1904
1951
|
}
|
|
1905
1952
|
|
|
@@ -1910,18 +1957,18 @@ ${X}
|
|
|
1910
1957
|
line-height: 1;
|
|
1911
1958
|
color: #6EA8FE;
|
|
1912
1959
|
}
|
|
1913
|
-
`,
|
|
1914
|
-
let e =
|
|
1960
|
+
`, tt = () => {
|
|
1961
|
+
let e = z((e) => e.burnedInSubtitles), t = z((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1915
1962
|
return d(() => {
|
|
1916
1963
|
if (t !== "burn-in" || !e) {
|
|
1917
1964
|
r(!1);
|
|
1918
1965
|
return;
|
|
1919
1966
|
}
|
|
1920
1967
|
r(!0);
|
|
1921
|
-
let n = setTimeout(() => r(!1),
|
|
1968
|
+
let n = setTimeout(() => r(!1), $e);
|
|
1922
1969
|
return () => clearTimeout(n);
|
|
1923
1970
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1924
|
-
css:
|
|
1971
|
+
css: et,
|
|
1925
1972
|
className: n ? "show" : "",
|
|
1926
1973
|
role: "status",
|
|
1927
1974
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -1942,7 +1989,7 @@ ${X}
|
|
|
1942
1989
|
})]
|
|
1943
1990
|
})
|
|
1944
1991
|
});
|
|
1945
|
-
},
|
|
1992
|
+
}, nt = 3e3, rt = h`
|
|
1946
1993
|
position: absolute;
|
|
1947
1994
|
inset: 0;
|
|
1948
1995
|
z-index: 2;
|
|
@@ -1953,7 +2000,7 @@ ${X}
|
|
|
1953
2000
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1954
2001
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1955
2002
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1956
|
-
`,
|
|
2003
|
+
`, it = h`
|
|
1957
2004
|
position: relative;
|
|
1958
2005
|
background-color: black;
|
|
1959
2006
|
display: flex;
|
|
@@ -1985,20 +2032,20 @@ ${X}
|
|
|
1985
2032
|
&.hide {
|
|
1986
2033
|
cursor: none;
|
|
1987
2034
|
}
|
|
1988
|
-
`,
|
|
2035
|
+
`, at = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
1989
2036
|
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
1990
|
-
return l(e) && e.type === c ?
|
|
2037
|
+
return l(e) && e.type === c ? at(e.props.children, `${r}/`) : [{
|
|
1991
2038
|
key: r,
|
|
1992
2039
|
item: e
|
|
1993
2040
|
}];
|
|
1994
|
-
}),
|
|
1995
|
-
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");
|
|
1996
2043
|
d(() => () => clearTimeout(l.current), []);
|
|
1997
2044
|
let f = () => {
|
|
1998
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
2045
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), nt);
|
|
1999
2046
|
};
|
|
2000
2047
|
return /* @__PURE__ */ w("div", {
|
|
2001
|
-
css:
|
|
2048
|
+
css: it,
|
|
2002
2049
|
ref: e,
|
|
2003
2050
|
onPointerMove: (e) => {
|
|
2004
2051
|
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
@@ -2015,8 +2062,8 @@ ${X}
|
|
|
2015
2062
|
className: s ? "hide" : "",
|
|
2016
2063
|
children: [
|
|
2017
2064
|
/* @__PURE__ */ C(xe, { onCanvasRef: n }),
|
|
2018
|
-
|
|
2019
|
-
css:
|
|
2065
|
+
at(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2066
|
+
css: rt,
|
|
2020
2067
|
style: { ...s ? {
|
|
2021
2068
|
opacity: "0",
|
|
2022
2069
|
visibility: "hidden",
|
|
@@ -2024,8 +2071,8 @@ ${X}
|
|
|
2024
2071
|
} : {} },
|
|
2025
2072
|
children: t
|
|
2026
2073
|
}, e)),
|
|
2027
|
-
i === !1 ? null : /* @__PURE__ */ C(
|
|
2028
|
-
/* @__PURE__ */ C(
|
|
2074
|
+
i === !1 ? null : /* @__PURE__ */ C(Qe, {}),
|
|
2075
|
+
/* @__PURE__ */ C(tt, {}),
|
|
2029
2076
|
/* @__PURE__ */ w("div", {
|
|
2030
2077
|
className: "video",
|
|
2031
2078
|
onClick: () => {
|
|
@@ -2042,16 +2089,16 @@ ${X}
|
|
|
2042
2089
|
})
|
|
2043
2090
|
]
|
|
2044
2091
|
});
|
|
2045
|
-
},
|
|
2092
|
+
}, st = ({ options: e, children: t }) => {
|
|
2046
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;
|
|
2047
|
-
d(() => (p?.(S), () => p?.(null)), [S, p]),
|
|
2048
|
-
let w =
|
|
2094
|
+
d(() => (p?.(S), () => p?.(null)), [S, p]), de(g, b, r);
|
|
2095
|
+
let w = me({
|
|
2049
2096
|
publicPath: s,
|
|
2050
2097
|
workerUrl: c,
|
|
2051
2098
|
length: f === !1 ? void 0 : a,
|
|
2052
2099
|
read: u ?? l,
|
|
2053
2100
|
downloadedRanges: o
|
|
2054
|
-
}), 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);
|
|
2055
2102
|
d(() => {
|
|
2056
2103
|
k({
|
|
2057
2104
|
title: i,
|
|
@@ -2103,7 +2150,7 @@ ${X}
|
|
|
2103
2150
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
2104
2151
|
selectAudioTrack: (e) => M.select(String(e))
|
|
2105
2152
|
});
|
|
2106
|
-
}, [k, M]), /* @__PURE__ */ C(
|
|
2153
|
+
}, [k, M]), /* @__PURE__ */ C(ot, {
|
|
2107
2154
|
ref: h,
|
|
2108
2155
|
onVideoRef: n ? void 0 : _,
|
|
2109
2156
|
onCanvasRef: x,
|
|
@@ -2111,7 +2158,7 @@ ${X}
|
|
|
2111
2158
|
controls: e.controls,
|
|
2112
2159
|
children: t
|
|
2113
2160
|
});
|
|
2114
|
-
},
|
|
2161
|
+
}, ct = h`
|
|
2115
2162
|
/**
|
|
2116
2163
|
* The chrome's whole scale, in one place.
|
|
2117
2164
|
*
|
|
@@ -2181,17 +2228,17 @@ ${X}
|
|
|
2181
2228
|
height: 100%;
|
|
2182
2229
|
width: 100%;
|
|
2183
2230
|
overflow: hidden;
|
|
2184
|
-
`,
|
|
2185
|
-
css:
|
|
2186
|
-
children: /* @__PURE__ */ C(
|
|
2231
|
+
`, lt = (e) => /* @__PURE__ */ C("div", {
|
|
2232
|
+
css: ct,
|
|
2233
|
+
children: /* @__PURE__ */ C(R.Provider, { children: /* @__PURE__ */ C(st, {
|
|
2187
2234
|
options: e,
|
|
2188
2235
|
children: e.children
|
|
2189
2236
|
}) })
|
|
2190
|
-
}),
|
|
2237
|
+
}), ut = (e) => !!e && typeof e == "object" && "at" in e, dt = (e) => !!e && typeof e == "object" && "selection" in e, ft = ({ blob: e, name: t }) => ({
|
|
2191
2238
|
length: e.size,
|
|
2192
2239
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2193
2240
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2194
|
-
}),
|
|
2241
|
+
}), pt = async (e, t) => {
|
|
2195
2242
|
let n = await fetch(e, {
|
|
2196
2243
|
headers: { Range: "bytes=0-1" },
|
|
2197
2244
|
credentials: t
|
|
@@ -2201,8 +2248,8 @@ ${X}
|
|
|
2201
2248
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2202
2249
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2203
2250
|
return i;
|
|
2204
|
-
},
|
|
2205
|
-
let i = t ?? await
|
|
2251
|
+
}, mt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2252
|
+
let i = t ?? await pt(e, r);
|
|
2206
2253
|
return {
|
|
2207
2254
|
length: i,
|
|
2208
2255
|
name: n,
|
|
@@ -2215,9 +2262,9 @@ ${X}
|
|
|
2215
2262
|
return a.arrayBuffer();
|
|
2216
2263
|
}
|
|
2217
2264
|
};
|
|
2218
|
-
},
|
|
2219
|
-
if ("blob" in e) return
|
|
2220
|
-
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);
|
|
2221
2268
|
if ("read" in e) return {
|
|
2222
2269
|
length: e.length,
|
|
2223
2270
|
name: e.name,
|
|
@@ -2226,4 +2273,4 @@ ${X}
|
|
|
2226
2273
|
throw Error(`Unknown source type: ${e}`);
|
|
2227
2274
|
};
|
|
2228
2275
|
//#endregion
|
|
2229
|
-
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 };
|