@banou/media-player 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -4
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/playback.d.ts +17 -0
- package/dist/{engine-YeMWShCv.js → engine-DqyZgmTv.js} +173 -134
- package/dist/index.d.ts +1 -1
- package/dist/index.js +625 -331
- package/dist/react/components/skip-chapter.d.ts +10 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +17 -1
- package/dist/react/video-player.d.ts +13 -0
- package/dist/utils/chapters.d.ts +37 -0
- package/package.json +1 -1
- package/src/lib/engine/index.ts +1 -1
- package/src/lib/engine/playback.ts +15 -0
- package/src/lib/engine/thumbnails.ts +135 -19
- package/src/lib/index.tsx +1 -0
- package/src/lib/react/components/chrome.tsx +2 -0
- package/src/lib/react/components/progress-bar.tsx +127 -25
- package/src/lib/react/components/skip-chapter.tsx +166 -0
- package/src/lib/react/hooks/use-playback.ts +17 -2
- package/src/lib/react/source-feature.ts +10 -1
- package/src/lib/react/video-player.tsx +28 -1
- package/src/lib/utils/chapters.ts +302 -0
- package/src/lib/utils/source.ts +12 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-
|
|
1
|
+
import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-DqyZgmTv.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";
|
|
@@ -9,6 +9,7 @@ import { Tooltip as z } from "react-tooltip";
|
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
10
|
var B = {
|
|
11
11
|
indexes: [],
|
|
12
|
+
chapters: [],
|
|
12
13
|
thumbnails: [],
|
|
13
14
|
requestThumbnail: () => {},
|
|
14
15
|
subtitleTracks: [],
|
|
@@ -26,7 +27,7 @@ var B = {
|
|
|
26
27
|
playbackErrors: [],
|
|
27
28
|
ready: !1,
|
|
28
29
|
setSourceState: () => {}
|
|
29
|
-
},
|
|
30
|
+
}, V = b({
|
|
30
31
|
name: "source",
|
|
31
32
|
state: () => ({ ...B }),
|
|
32
33
|
attach({ set: e }) {
|
|
@@ -35,10 +36,10 @@ var B = {
|
|
|
35
36
|
setHideUI: (t) => e({ hideUI: t })
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
}),
|
|
39
|
-
features: [...x,
|
|
39
|
+
}), H = _({
|
|
40
|
+
features: [...x, V],
|
|
40
41
|
displayName: "MediaPlayer"
|
|
41
|
-
}),
|
|
42
|
+
}), U = H.usePlayer, W = (e) => {
|
|
42
43
|
if (!(!e || e === "und")) try {
|
|
43
44
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
44
45
|
type: "language",
|
|
@@ -47,60 +48,62 @@ var B = {
|
|
|
47
48
|
} catch {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
-
let t = e.map((e) =>
|
|
51
|
+
}, G = (e) => e?.replace(/_/g, " ").trim() || void 0, ee = (e) => {
|
|
52
|
+
let t = e.map((e) => W(e.language) ?? G(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
52
53
|
...e,
|
|
53
54
|
[t]: (e[t] ?? 0) + 1
|
|
54
55
|
}), {});
|
|
55
56
|
return e.map((e, r) => {
|
|
56
|
-
let i = t[r], a =
|
|
57
|
+
let i = t[r], a = G(e.title);
|
|
57
58
|
return {
|
|
58
59
|
track: e,
|
|
59
60
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
60
61
|
};
|
|
61
62
|
});
|
|
62
|
-
},
|
|
63
|
+
}, te = (e) => ee(e).map(({ track: e, label: t }) => ({
|
|
63
64
|
id: e.streamIndex,
|
|
64
65
|
label: t
|
|
65
|
-
})),
|
|
66
|
+
})), ne = [
|
|
66
67
|
0,
|
|
67
68
|
250,
|
|
68
69
|
1e3,
|
|
69
70
|
3e3,
|
|
70
71
|
1e4
|
|
71
|
-
],
|
|
72
|
+
], re = 6e4, ie = 500, ae = (e) => e instanceof Error ? e.message : String(e), oe = (e) => {
|
|
72
73
|
let t = [], n = e?.cause;
|
|
73
74
|
for (let e = 0; n != null && e < 8; e++) {
|
|
74
75
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
75
76
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
|
-
t.push(
|
|
79
|
+
t.push(ae(n)), n = n?.cause;
|
|
79
80
|
}
|
|
80
81
|
return t.length ? t.join("\n") : void 0;
|
|
81
|
-
},
|
|
82
|
-
let a =
|
|
82
|
+
}, se = (e, t, r) => {
|
|
83
|
+
let a = U(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = ie } = r ?? {}, S = p(b);
|
|
84
|
+
S.current = b;
|
|
85
|
+
let [C, w] = m(void 0), [T, E] = m(0), D = p({
|
|
83
86
|
count: 0,
|
|
84
87
|
at: 0
|
|
85
|
-
}),
|
|
86
|
-
d(() => (
|
|
88
|
+
}), O = p(void 0);
|
|
89
|
+
d(() => (D.current = {
|
|
87
90
|
count: 0,
|
|
88
91
|
at: 0
|
|
89
92
|
}, a.setSourceState({ playbackErrors: [] }), () => {
|
|
90
|
-
|
|
93
|
+
O.current && clearTimeout(O.current);
|
|
91
94
|
}), [s]);
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
let
|
|
97
|
-
|
|
98
|
-
let
|
|
95
|
+
let k = p(null), A = p(null), j = p(!1), M = p(o);
|
|
96
|
+
M.current = o;
|
|
97
|
+
let N = p(r?.onSeek);
|
|
98
|
+
N.current = r?.onSeek;
|
|
99
|
+
let P = p(r?.onPlaybackError);
|
|
100
|
+
P.current = r?.onPlaybackError;
|
|
101
|
+
let F = u((e) => {
|
|
99
102
|
let t = typeof e == "number" ? e : void 0;
|
|
100
|
-
|
|
101
|
-
}, [a]),
|
|
102
|
-
let t =
|
|
103
|
-
if (!t ||
|
|
103
|
+
j.current = !0, a.setSourceState({ selectedSubtitleTrack: t }), k.current?.selectSubtitleStream(t);
|
|
104
|
+
}, [a]), I = u((e) => {
|
|
105
|
+
let t = k.current;
|
|
106
|
+
if (!t || x <= 0) {
|
|
104
107
|
a.seek(e);
|
|
105
108
|
return;
|
|
106
109
|
}
|
|
@@ -112,24 +115,24 @@ var B = {
|
|
|
112
115
|
}
|
|
113
116
|
}, c = setTimeout(() => {
|
|
114
117
|
o = "deadline", s();
|
|
115
|
-
},
|
|
118
|
+
}, x);
|
|
116
119
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
117
120
|
clearTimeout(c), s();
|
|
118
121
|
});
|
|
119
|
-
}, [a,
|
|
120
|
-
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }),
|
|
121
|
-
}, [a]),
|
|
122
|
+
}, [a, x]), L = u((e) => {
|
|
123
|
+
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), w(e));
|
|
124
|
+
}, [a]), R = U((e) => e.setSourceState);
|
|
122
125
|
d(() => {
|
|
123
|
-
|
|
124
|
-
selectSubtitleTrack:
|
|
125
|
-
selectAudioTrack:
|
|
126
|
-
requestSeek:
|
|
126
|
+
R({
|
|
127
|
+
selectSubtitleTrack: F,
|
|
128
|
+
selectAudioTrack: L,
|
|
129
|
+
requestSeek: I
|
|
127
130
|
});
|
|
128
131
|
}, [
|
|
129
|
-
|
|
130
|
-
N,
|
|
132
|
+
R,
|
|
131
133
|
F,
|
|
132
|
-
|
|
134
|
+
L,
|
|
135
|
+
I
|
|
133
136
|
]), d(() => {
|
|
134
137
|
if (!e || !t || !s || !o) return;
|
|
135
138
|
let r = !1;
|
|
@@ -138,7 +141,7 @@ var B = {
|
|
|
138
141
|
ready: !1
|
|
139
142
|
});
|
|
140
143
|
let u = (t, n) => {
|
|
141
|
-
let r = Date.now(), i =
|
|
144
|
+
let r = Date.now(), i = ae(t), o = oe(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
142
145
|
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
143
146
|
let e = {
|
|
144
147
|
...c,
|
|
@@ -163,25 +166,25 @@ var B = {
|
|
|
163
166
|
let t = n(e);
|
|
164
167
|
if (u(e, t), t) {
|
|
165
168
|
let t = performance.now();
|
|
166
|
-
t -
|
|
169
|
+
t - D.current.at > re && (D.current = {
|
|
167
170
|
count: 0,
|
|
168
171
|
at: t
|
|
169
172
|
});
|
|
170
|
-
let n =
|
|
171
|
-
|
|
172
|
-
count:
|
|
173
|
+
let n = ne[Math.min(D.current.count, ne.length - 1)];
|
|
174
|
+
D.current = {
|
|
175
|
+
count: D.current.count + 1,
|
|
173
176
|
at: t
|
|
174
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
177
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), O.current && clearTimeout(O.current), O.current = setTimeout(() => E((e) => e + 1), n);
|
|
175
178
|
return;
|
|
176
179
|
}
|
|
177
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
180
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), P.current?.(e);
|
|
178
181
|
};
|
|
179
182
|
return (async () => {
|
|
180
183
|
try {
|
|
181
184
|
let n = await i({
|
|
182
185
|
videoElement: e,
|
|
183
186
|
subtitleContainer: t,
|
|
184
|
-
read: (e, t) =>
|
|
187
|
+
read: (e, t) => M.current(e, t),
|
|
185
188
|
length: s,
|
|
186
189
|
publicPath: c,
|
|
187
190
|
libavWorkerUrl: l,
|
|
@@ -190,27 +193,27 @@ var B = {
|
|
|
190
193
|
jassubLegacyWasmUrl: g,
|
|
191
194
|
defaultFontUrl: _,
|
|
192
195
|
bufferSize: v,
|
|
193
|
-
audioStreamIndex:
|
|
196
|
+
audioStreamIndex: C,
|
|
194
197
|
onReady: () => {
|
|
195
198
|
if (r) return;
|
|
196
199
|
a.setSourceState({ ready: !0 });
|
|
197
|
-
let t =
|
|
198
|
-
|
|
200
|
+
let t = A.current;
|
|
201
|
+
A.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
199
202
|
},
|
|
200
203
|
onError: d,
|
|
201
204
|
onRecovered: () => {
|
|
202
205
|
r || a.setSourceState({ playbackError: null });
|
|
203
206
|
},
|
|
204
|
-
onSeek: (e) =>
|
|
207
|
+
onSeek: (e) => N.current?.(e),
|
|
205
208
|
onSubtitleStreams: (e) => {
|
|
206
209
|
r || a.setSourceState({
|
|
207
|
-
subtitleTracks:
|
|
208
|
-
...
|
|
210
|
+
subtitleTracks: te(e),
|
|
211
|
+
...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
209
212
|
});
|
|
210
213
|
},
|
|
211
214
|
onAudioStreams: (e, t) => {
|
|
212
215
|
r || a.setSourceState({
|
|
213
|
-
audioTracks:
|
|
216
|
+
audioTracks: te(e),
|
|
214
217
|
selectedAudioTrack: t
|
|
215
218
|
});
|
|
216
219
|
}
|
|
@@ -219,17 +222,20 @@ var B = {
|
|
|
219
222
|
n.destroy();
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
222
|
-
|
|
225
|
+
k.current = n, a.setSourceState({
|
|
226
|
+
indexes: n.indexes,
|
|
227
|
+
chapters: S.current ?? n.chapters
|
|
228
|
+
});
|
|
223
229
|
let o = a.selectedSubtitleTrack;
|
|
224
230
|
typeof o == "number" && n.selectSubtitleStream(o);
|
|
225
231
|
} catch (e) {
|
|
226
232
|
d(e);
|
|
227
233
|
}
|
|
228
234
|
})(), () => {
|
|
229
|
-
r = !0,
|
|
235
|
+
r = !0, A.current = {
|
|
230
236
|
time: e.currentTime,
|
|
231
237
|
size: s
|
|
232
|
-
},
|
|
238
|
+
}, k.current?.destroy(), k.current = null, a.setSourceState({ ready: !1 });
|
|
233
239
|
};
|
|
234
240
|
}, [
|
|
235
241
|
a,
|
|
@@ -243,17 +249,17 @@ var B = {
|
|
|
243
249
|
g,
|
|
244
250
|
_,
|
|
245
251
|
v,
|
|
246
|
-
|
|
252
|
+
C,
|
|
247
253
|
y,
|
|
248
|
-
|
|
254
|
+
T
|
|
249
255
|
]);
|
|
250
|
-
},
|
|
256
|
+
}, ce = 5e3, le = 6e4, ue = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
251
257
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
252
258
|
l.current = i;
|
|
253
259
|
let h = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = p(h);
|
|
254
260
|
return g.current = h, d(() => {
|
|
255
261
|
if (!n || !i || !e || !t) return;
|
|
256
|
-
let a = !1, o = null, u, d =
|
|
262
|
+
let a = !1, o = null, u, d = ce, f = () => {
|
|
257
263
|
r({
|
|
258
264
|
publicPath: e,
|
|
259
265
|
workerUrl: t,
|
|
@@ -269,7 +275,7 @@ var B = {
|
|
|
269
275
|
}
|
|
270
276
|
o = e, c.current = e, e.update(g.current);
|
|
271
277
|
}, () => {
|
|
272
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
278
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, le));
|
|
273
279
|
});
|
|
274
280
|
};
|
|
275
281
|
return f(), () => {
|
|
@@ -287,7 +293,7 @@ var B = {
|
|
|
287
293
|
c.current?.prioritize(e);
|
|
288
294
|
}, [])
|
|
289
295
|
};
|
|
290
|
-
},
|
|
296
|
+
}, de = (e, n) => {
|
|
291
297
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
292
298
|
d(() => {
|
|
293
299
|
if (!e || !n || !s) return;
|
|
@@ -315,7 +321,7 @@ var B = {
|
|
|
315
321
|
mode: s,
|
|
316
322
|
burnedIn: i
|
|
317
323
|
};
|
|
318
|
-
},
|
|
324
|
+
}, K = {
|
|
319
325
|
headings: {
|
|
320
326
|
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 ",
|
|
321
327
|
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 ",
|
|
@@ -342,7 +348,7 @@ var B = {
|
|
|
342
348
|
medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
|
|
343
349
|
regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
|
|
344
350
|
}
|
|
345
|
-
},
|
|
351
|
+
}, fe = h`
|
|
346
352
|
display: flex;
|
|
347
353
|
justify-content: center;
|
|
348
354
|
align-items: center;
|
|
@@ -355,7 +361,7 @@ var B = {
|
|
|
355
361
|
margin: auto;
|
|
356
362
|
pointer-events: none;
|
|
357
363
|
}
|
|
358
|
-
`,
|
|
364
|
+
`, pe = h`
|
|
359
365
|
position: absolute;
|
|
360
366
|
top: 0;
|
|
361
367
|
left: 0;
|
|
@@ -363,7 +369,7 @@ var B = {
|
|
|
363
369
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
364
370
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
365
371
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
366
|
-
${
|
|
372
|
+
${K.headings.small}
|
|
367
373
|
color: white;
|
|
368
374
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
369
375
|
z-index: 2;
|
|
@@ -384,7 +390,7 @@ var B = {
|
|
|
384
390
|
|
|
385
391
|
background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
|
|
386
392
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
387
|
-
`,
|
|
393
|
+
`, me = h`
|
|
388
394
|
position: absolute;
|
|
389
395
|
inset: 0;
|
|
390
396
|
z-index: 2;
|
|
@@ -404,44 +410,44 @@ var B = {
|
|
|
404
410
|
to { transform: rotate(360deg); }
|
|
405
411
|
`} 0.8s linear infinite;
|
|
406
412
|
}
|
|
407
|
-
`,
|
|
413
|
+
`, he = h`
|
|
408
414
|
position: absolute;
|
|
409
415
|
inset: auto 0 20%;
|
|
410
416
|
z-index: 3;
|
|
411
417
|
padding: 0 calc(2 * var(--mp-unit));
|
|
412
418
|
text-align: center;
|
|
413
419
|
color: #fff;
|
|
414
|
-
${
|
|
420
|
+
${K.bLarge.regular}
|
|
415
421
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
416
422
|
pointer-events: none;
|
|
417
|
-
`,
|
|
418
|
-
let t =
|
|
423
|
+
`, ge = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", _e = ({ onSubtitleRef: e }) => {
|
|
424
|
+
let t = U((e) => e.title), n = U((e) => e.hideUI), r = U((e) => e.playbackError), i = U((e) => e.ready), a = U((e) => e.size), o = U((e) => e.waiting);
|
|
419
425
|
return /* @__PURE__ */ w(S, { children: [
|
|
420
426
|
t ? /* @__PURE__ */ C("div", {
|
|
421
427
|
className: "title",
|
|
422
|
-
css:
|
|
428
|
+
css: pe,
|
|
423
429
|
style: { ...n ? {
|
|
424
430
|
opacity: "0",
|
|
425
431
|
pointerEvents: "none"
|
|
426
432
|
} : {} },
|
|
427
433
|
children: t
|
|
428
434
|
}) : void 0,
|
|
429
|
-
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css:
|
|
435
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: me }) : void 0,
|
|
430
436
|
r ? /* @__PURE__ */ C("div", {
|
|
431
|
-
css:
|
|
432
|
-
children:
|
|
437
|
+
css: he,
|
|
438
|
+
children: ge(r)
|
|
433
439
|
}) : void 0,
|
|
434
440
|
/* @__PURE__ */ C("div", {
|
|
435
441
|
className: "subtitles",
|
|
436
442
|
ref: e,
|
|
437
|
-
css:
|
|
443
|
+
css: fe
|
|
438
444
|
})
|
|
439
445
|
] });
|
|
440
|
-
},
|
|
446
|
+
}, ve = 1e-4, q = 1, ye = (e) => Math.max(ve, Math.min(q, e)) ** 2, J = (e) => Math.max(ve, Math.min(q, e)) ** (q / 2), Y = (e) => {
|
|
441
447
|
if (e === void 0) return "0:00";
|
|
442
448
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
443
449
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
444
|
-
},
|
|
450
|
+
}, be = (e, t) => `${Y(e)} / ${Y(t)}`, xe = (e) => h`
|
|
445
451
|
display: flex;
|
|
446
452
|
justify-content: flex-start;
|
|
447
453
|
|
|
@@ -473,7 +479,7 @@ var B = {
|
|
|
473
479
|
z-index: 3;
|
|
474
480
|
|
|
475
481
|
* {
|
|
476
|
-
${
|
|
482
|
+
${K.bMedium.regular}
|
|
477
483
|
}
|
|
478
484
|
|
|
479
485
|
${e === "sm" && h`
|
|
@@ -485,25 +491,25 @@ var B = {
|
|
|
485
491
|
${e === "lg" && h`
|
|
486
492
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
487
493
|
`}
|
|
488
|
-
`,
|
|
494
|
+
`, X = {
|
|
489
495
|
x: -1,
|
|
490
496
|
y: -1,
|
|
491
497
|
anchors: 0
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
},
|
|
498
|
+
}, Se = (e) => {
|
|
499
|
+
X.x = e.clientX, X.y = e.clientY;
|
|
500
|
+
}, Ce = () => (X.anchors++ === 0 && window.addEventListener("pointermove", Se, {
|
|
495
501
|
capture: !0,
|
|
496
502
|
passive: !0
|
|
497
503
|
}), () => {
|
|
498
|
-
--
|
|
499
|
-
}),
|
|
504
|
+
--X.anchors === 0 && window.removeEventListener("pointermove", Se, { capture: !0 });
|
|
505
|
+
}), Z = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
500
506
|
let l = p(null), u = p(null);
|
|
501
507
|
return d(() => {
|
|
502
|
-
let e =
|
|
508
|
+
let e = Ce(), t = () => {
|
|
503
509
|
let e = l.current;
|
|
504
510
|
if (!e) return;
|
|
505
511
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
506
|
-
|
|
512
|
+
X.x >= t && X.x < n && X.y >= r && X.y < i || u.current?.close();
|
|
507
513
|
}, n = ["fullscreenchange", "webkitfullscreenchange"];
|
|
508
514
|
for (let e of n) document.addEventListener(e, t);
|
|
509
515
|
return () => {
|
|
@@ -521,12 +527,12 @@ var B = {
|
|
|
521
527
|
children: n
|
|
522
528
|
}), !s && /* @__PURE__ */ C(z, {
|
|
523
529
|
ref: u,
|
|
524
|
-
css:
|
|
530
|
+
css: xe(c),
|
|
525
531
|
id: e,
|
|
526
532
|
noArrow: !0,
|
|
527
533
|
children: t
|
|
528
534
|
})] });
|
|
529
|
-
},
|
|
535
|
+
}, we = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
530
536
|
let [i, a] = m(!1), o = p(t);
|
|
531
537
|
o.current = t;
|
|
532
538
|
let s = p(null), c = u((t, r) => {
|
|
@@ -565,7 +571,118 @@ var B = {
|
|
|
565
571
|
style: { touchAction: "none" }
|
|
566
572
|
}
|
|
567
573
|
};
|
|
568
|
-
}, De =
|
|
574
|
+
}, Te = 2, Ee = .005, De = "#000", Oe = "#0000", ke = (e, t) => {
|
|
575
|
+
if (!t) return [];
|
|
576
|
+
let n = /* @__PURE__ */ new Set();
|
|
577
|
+
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
578
|
+
let r = e / t;
|
|
579
|
+
r <= Ee || r >= 1 - Ee || n.add(Number((r * 100).toFixed(4)));
|
|
580
|
+
}
|
|
581
|
+
return n.size ? [
|
|
582
|
+
0,
|
|
583
|
+
...[...n].sort((e, t) => e - t),
|
|
584
|
+
100
|
|
585
|
+
] : [];
|
|
586
|
+
}, Ae = (e, t) => {
|
|
587
|
+
let n = Te / 2, r = e.length - 2, i = [];
|
|
588
|
+
for (let a = 0; a <= r; a += 1) {
|
|
589
|
+
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
590
|
+
i.push(`${t(a) ? De : Oe} ${c} ${l}`), a !== r && i.push(`${Oe} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
591
|
+
}
|
|
592
|
+
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
593
|
+
}, je = /* @__PURE__ */ new Set([
|
|
594
|
+
"op",
|
|
595
|
+
"ops",
|
|
596
|
+
"opening",
|
|
597
|
+
"openings",
|
|
598
|
+
"ncop",
|
|
599
|
+
"オープニング",
|
|
600
|
+
"op主題歌"
|
|
601
|
+
]), Me = /* @__PURE__ */ new Set([
|
|
602
|
+
"ed",
|
|
603
|
+
"eds",
|
|
604
|
+
"ending",
|
|
605
|
+
"endings",
|
|
606
|
+
"nced",
|
|
607
|
+
"credits",
|
|
608
|
+
"endcard",
|
|
609
|
+
"endroll",
|
|
610
|
+
"エンディング",
|
|
611
|
+
"エンドカード",
|
|
612
|
+
"エンドロール",
|
|
613
|
+
"ed主題歌"
|
|
614
|
+
]), Ne = /* @__PURE__ */ new Set(["intro", "イントロ"]), Pe = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Fe = {
|
|
615
|
+
"credits start": "ending",
|
|
616
|
+
"credits end": null,
|
|
617
|
+
"preview end": null,
|
|
618
|
+
"end credits": "ending",
|
|
619
|
+
"closing credits": "ending"
|
|
620
|
+
}, Ie = /* @__PURE__ */ new Set([
|
|
621
|
+
"theme",
|
|
622
|
+
"themes",
|
|
623
|
+
"song",
|
|
624
|
+
"sequence",
|
|
625
|
+
"nc",
|
|
626
|
+
"non",
|
|
627
|
+
"credit",
|
|
628
|
+
"creditless",
|
|
629
|
+
"textless",
|
|
630
|
+
"clean",
|
|
631
|
+
"tv",
|
|
632
|
+
"size",
|
|
633
|
+
"version",
|
|
634
|
+
"ver",
|
|
635
|
+
"full",
|
|
636
|
+
"the",
|
|
637
|
+
"主題歌",
|
|
638
|
+
"ノンクレジット"
|
|
639
|
+
]), Le = /* @__PURE__ */ new Set([
|
|
640
|
+
"post",
|
|
641
|
+
"pre",
|
|
642
|
+
"after",
|
|
643
|
+
"before",
|
|
644
|
+
"non"
|
|
645
|
+
]), Re = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, ze = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Be = (e) => e.replace(/([a-z-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w-ヿ一-鿿]+|[^\w-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !Ie.has(e)), Ve = (e, t) => {
|
|
646
|
+
if (je.has(e)) return "opening";
|
|
647
|
+
if (Me.has(e)) return "ending";
|
|
648
|
+
if (t) {
|
|
649
|
+
if (Ne.has(e)) return "opening";
|
|
650
|
+
if (Pe.has(e)) return "ending";
|
|
651
|
+
}
|
|
652
|
+
}, He = (e, t) => {
|
|
653
|
+
if (ze(e)) return;
|
|
654
|
+
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
655
|
+
if (n in Fe) return Fe[n] ?? void 0;
|
|
656
|
+
let r = n.split(Re).map((e) => e.trim()).filter(Boolean);
|
|
657
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => Le.has(e)))) return;
|
|
658
|
+
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
659
|
+
for (let e of i) {
|
|
660
|
+
let n = Be(e);
|
|
661
|
+
if (n.length !== 1) continue;
|
|
662
|
+
let r = Ve(n[0], t);
|
|
663
|
+
if (r) return r;
|
|
664
|
+
}
|
|
665
|
+
}, Ue = 15, We = 87, Ge = 93, Ke = (e) => {
|
|
666
|
+
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
667
|
+
if (!n) return t;
|
|
668
|
+
let r = e.map((e, t) => ({
|
|
669
|
+
index: t,
|
|
670
|
+
start: e.start,
|
|
671
|
+
length: e.end - e.start
|
|
672
|
+
})).filter(({ length: e }) => e >= We && e <= Ge), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
673
|
+
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
674
|
+
}, qe = (e) => {
|
|
675
|
+
let t = e.map(({ title: e }) => He(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
|
|
676
|
+
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
677
|
+
let i = e.map((e, n) => {
|
|
678
|
+
if (e.end - e.start < Ue) return;
|
|
679
|
+
let r = t[n];
|
|
680
|
+
if (r) return r;
|
|
681
|
+
let i = He(e.title, !0);
|
|
682
|
+
return i && !t.includes(i) ? i : void 0;
|
|
683
|
+
});
|
|
684
|
+
return i.some(Boolean) ? i : Ke(e);
|
|
685
|
+
}, Je = h`
|
|
569
686
|
position: relative;
|
|
570
687
|
height: calc(.4 * var(--mp-unit));
|
|
571
688
|
|
|
@@ -598,6 +715,37 @@ var B = {
|
|
|
598
715
|
}
|
|
599
716
|
}
|
|
600
717
|
|
|
718
|
+
/*
|
|
719
|
+
* One copy of the track per mask, stacked.
|
|
720
|
+
*
|
|
721
|
+
* The rest track paints every segment except the one under the pointer, the focus track paints only that one and
|
|
722
|
+
* is the only element that grows. Both are full bar width, which is what keeps every percentage
|
|
723
|
+
* and every scaleX inside them meaning exactly what it meant before chapters existed: the gaps are
|
|
724
|
+
* cut by a mask, not by resizing anything.
|
|
725
|
+
*
|
|
726
|
+
* The mask sits HERE and never on .loaded-part or .play. Those two carry a scaleX, and a mask
|
|
727
|
+
* travels with its element's transform, so a gap drawn on them would slide with the fill.
|
|
728
|
+
*/
|
|
729
|
+
.track {
|
|
730
|
+
position: absolute;
|
|
731
|
+
inset: 0;
|
|
732
|
+
/* never a hit target: .padding is the only one, and a second would break the drag gesture and
|
|
733
|
+
fire a bubbling mouseout at every boundary crossing */
|
|
734
|
+
pointer-events: none;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/*
|
|
738
|
+
* The segment under the pointer, on TOP of the growth the whole bar already got.
|
|
739
|
+
*
|
|
740
|
+
* Measured off YouTube's live player, hovering one chapter of five: every other segment goes 4px
|
|
741
|
+
* to 6px, and the one under the pointer goes to 10px. Both grow about the bar's centre line, so
|
|
742
|
+
* the emphasised segment bulges above and below its neighbours rather than sitting on them. 6 x
|
|
743
|
+
* 1.667 is 10, and the 1.5 the layers inside already carry gets this track from 4 to exactly that.
|
|
744
|
+
*/
|
|
745
|
+
.track.focus {
|
|
746
|
+
transform: scaleY(1.667);
|
|
747
|
+
}
|
|
748
|
+
|
|
601
749
|
|
|
602
750
|
.background-bar {
|
|
603
751
|
position: absolute;
|
|
@@ -619,7 +767,24 @@ var B = {
|
|
|
619
767
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
620
768
|
|
|
621
769
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
622
|
-
${
|
|
770
|
+
${K.bMedium.bold}
|
|
771
|
+
|
|
772
|
+
gap: calc(.6 * var(--mp-unit));
|
|
773
|
+
|
|
774
|
+
/*
|
|
775
|
+
* The chapter under the pointer, next to the time, which is where the reference puts it.
|
|
776
|
+
*
|
|
777
|
+
* It is the one part of this pill whose width the player does not control, so it is capped and
|
|
778
|
+
* ellipsised rather than allowed to push the box outside the picture. The cap and the clamp that
|
|
779
|
+
* positions the pill are set together on the element, since a centred box can only be kept
|
|
780
|
+
* inside the bar if the clamp knows its half width.
|
|
781
|
+
*/
|
|
782
|
+
.chapter-title {
|
|
783
|
+
overflow: hidden;
|
|
784
|
+
text-overflow: ellipsis;
|
|
785
|
+
min-width: 0;
|
|
786
|
+
font-weight: normal;
|
|
787
|
+
}
|
|
623
788
|
|
|
624
789
|
position: absolute;
|
|
625
790
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -736,38 +901,38 @@ var B = {
|
|
|
736
901
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
737
902
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
738
903
|
}
|
|
739
|
-
`,
|
|
740
|
-
let e =
|
|
741
|
-
|
|
742
|
-
},
|
|
743
|
-
ref:
|
|
904
|
+
`, Ye = 4, Xe = () => {
|
|
905
|
+
let e = U(), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U((e) => e.duration), i = U((e) => e.size), a = U((e) => e.downloadedRanges), o = U((e) => e.indexes), s = U((e) => e.thumbnails), c = U((e) => e.thumbnailAt), l = U((e) => e.requestThumbnail), u = U((e) => e.chapters), h = p(null), [g, _] = m(void 0), [v, y] = m(void 0), b = (e) => {
|
|
906
|
+
y(e), l(e);
|
|
907
|
+
}, x = p(void 0), S = p(0), T = p(void 0), E = p(void 0), D = p(!1), { dragging: O, handlers: k } = we({
|
|
908
|
+
ref: h,
|
|
744
909
|
onChange: (e) => {
|
|
745
|
-
if (
|
|
746
|
-
else if (!
|
|
747
|
-
let t =
|
|
748
|
-
Math.abs(e -
|
|
910
|
+
if (S.current += 1, T.current = e, E.current === void 0) E.current = e;
|
|
911
|
+
else if (!D.current) {
|
|
912
|
+
let t = h.current?.getBoundingClientRect().width ?? 0;
|
|
913
|
+
Math.abs(e - E.current) * t > Ye && (D.current = !0);
|
|
749
914
|
}
|
|
750
|
-
|
|
915
|
+
_(e), x.current !== "mouse" && b(e * r);
|
|
751
916
|
}
|
|
752
|
-
}),
|
|
753
|
-
|
|
754
|
-
},
|
|
755
|
-
|
|
756
|
-
let i =
|
|
917
|
+
}), A = (e) => {
|
|
918
|
+
x.current = e.pointerType, S.current = 0, E.current = void 0, D.current = !1, k.onPointerDown(e);
|
|
919
|
+
}, j = (t) => {
|
|
920
|
+
k.onPointerUp(t);
|
|
921
|
+
let i = S.current > 0 ? T.current : void 0;
|
|
757
922
|
if (i !== void 0 && r) {
|
|
758
923
|
let t = i * r;
|
|
759
924
|
n ? n(t) : e.seek(t);
|
|
760
925
|
}
|
|
761
|
-
|
|
762
|
-
}, j = (e) => {
|
|
763
|
-
if (!u.current) return;
|
|
764
|
-
let { left: t, right: n } = u.current.getBoundingClientRect();
|
|
765
|
-
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
926
|
+
S.current = 0, D.current = !1, E.current = void 0, t.pointerType !== "mouse" && b(void 0);
|
|
766
927
|
}, M = (e) => {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
},
|
|
928
|
+
if (!h.current) return;
|
|
929
|
+
let { left: t, right: n } = h.current.getBoundingClientRect();
|
|
930
|
+
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
931
|
+
}, N = (e) => {
|
|
932
|
+
b(M(e.clientX));
|
|
933
|
+
}, P = () => {
|
|
934
|
+
h.current && b(void 0);
|
|
935
|
+
}, F = (e) => r ? e / r * 100 : 0, I = f(() => a?.map((e, t) => {
|
|
771
936
|
if (!i || !r) return null;
|
|
772
937
|
let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
|
|
773
938
|
if (!a || !s) return null;
|
|
@@ -783,72 +948,102 @@ var B = {
|
|
|
783
948
|
r,
|
|
784
949
|
o.length,
|
|
785
950
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
786
|
-
])
|
|
787
|
-
if (!_ || _ < 0) return;
|
|
788
|
-
let e = Math.floor(_ / 3600), t = Math.floor((_ - e * 3600) / 60), n = Math.floor(_ - e * 3600 - t * 60);
|
|
789
|
-
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
790
|
-
}, [_]);
|
|
951
|
+
]);
|
|
791
952
|
d(() => {
|
|
792
|
-
|
|
953
|
+
g === void 0 || !r || !O || !D.current || e.seek(g * r);
|
|
793
954
|
}, [
|
|
794
955
|
e,
|
|
795
|
-
|
|
796
|
-
|
|
956
|
+
O,
|
|
957
|
+
g,
|
|
797
958
|
r
|
|
798
959
|
]);
|
|
799
|
-
let L = f(() => !r || typeof t != "number" ? 0 : t / r, [r, t]), R = f(() => {
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
-
|
|
960
|
+
let L = f(() => !r || typeof t != "number" ? 0 : t / r, [r, t]), R = f(() => ke(u, r), [u, r]), z = R.length > 0, B = f(() => {
|
|
961
|
+
if (!z || v === void 0 || !r) return -1;
|
|
962
|
+
let e = v / r * 100, t = R.findIndex((t, n) => n < R.length - 1 && e >= t && e < R[n + 1]);
|
|
963
|
+
return t >= 0 ? t : R.length - 2;
|
|
964
|
+
}, [
|
|
965
|
+
z,
|
|
966
|
+
R,
|
|
967
|
+
v,
|
|
968
|
+
r
|
|
969
|
+
]), V = f(() => z ? Ae(R, (e) => e !== B) : void 0, [
|
|
970
|
+
z,
|
|
971
|
+
R,
|
|
972
|
+
B
|
|
973
|
+
]), H = f(() => B >= 0 ? Ae(R, (e) => e === B) : void 0, [R, B]), W = f(() => {
|
|
974
|
+
if (v !== void 0) return u.find(({ start: e, end: t }) => e <= v && v < t);
|
|
975
|
+
}, [u, v]), G = f(() => {
|
|
976
|
+
if (v) {
|
|
977
|
+
if (c) return c(v);
|
|
978
|
+
if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= v && v < t);
|
|
803
979
|
}
|
|
804
980
|
}, [
|
|
805
981
|
s,
|
|
806
982
|
c,
|
|
807
|
-
|
|
808
|
-
])
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
ref: u,
|
|
812
|
-
className: D ? "progress-bar dragging" : "progress-bar",
|
|
813
|
-
onMouseMove: M,
|
|
814
|
-
onMouseOut: N,
|
|
983
|
+
v
|
|
984
|
+
]), ee = (e, t) => /* @__PURE__ */ w("div", {
|
|
985
|
+
className: e ? `track ${e}` : "track",
|
|
986
|
+
style: t ? { maskImage: t } : void 0,
|
|
815
987
|
children: [
|
|
816
988
|
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
817
|
-
_ ? /* @__PURE__ */ C("div", {
|
|
818
|
-
className: "cursor-time",
|
|
819
|
-
style: { left: `clamp(calc(3 * var(--mp-unit)), ${P(_)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
820
|
-
children: I
|
|
821
|
-
}) : void 0,
|
|
822
|
-
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
823
989
|
/* @__PURE__ */ C("div", {
|
|
824
990
|
className: "loaded",
|
|
825
|
-
children:
|
|
991
|
+
children: I
|
|
826
992
|
}),
|
|
827
|
-
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
828
993
|
/* @__PURE__ */ C("div", {
|
|
829
994
|
className: "play-container",
|
|
830
995
|
children: /* @__PURE__ */ C("div", {
|
|
831
996
|
className: "play",
|
|
832
997
|
style: { transform: `scaleX(${L})` }
|
|
833
998
|
})
|
|
834
|
-
})
|
|
835
|
-
|
|
999
|
+
})
|
|
1000
|
+
]
|
|
1001
|
+
});
|
|
1002
|
+
return /* @__PURE__ */ w("div", {
|
|
1003
|
+
css: Je,
|
|
1004
|
+
ref: h,
|
|
1005
|
+
className: [
|
|
1006
|
+
"progress-bar",
|
|
1007
|
+
O ? "dragging" : "",
|
|
1008
|
+
z ? "segmented" : ""
|
|
1009
|
+
].filter(Boolean).join(" "),
|
|
1010
|
+
onMouseMove: N,
|
|
1011
|
+
onMouseOut: P,
|
|
1012
|
+
children: [
|
|
1013
|
+
ee(void 0, V),
|
|
1014
|
+
v ? /* @__PURE__ */ w("div", {
|
|
1015
|
+
className: "cursor-time",
|
|
1016
|
+
style: {
|
|
1017
|
+
left: W ? `clamp(var(--thumbnail-half), ${F(v)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${F(v)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1018
|
+
maxWidth: W ? "var(--thumbnail-width)" : void 0
|
|
1019
|
+
},
|
|
1020
|
+
children: [/* @__PURE__ */ C("span", {
|
|
1021
|
+
className: "cursor-time-value",
|
|
1022
|
+
children: Y(v)
|
|
1023
|
+
}), W ? /* @__PURE__ */ C("span", {
|
|
1024
|
+
className: "chapter-title",
|
|
1025
|
+
children: W.title
|
|
1026
|
+
}) : void 0]
|
|
1027
|
+
}) : void 0,
|
|
1028
|
+
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
1029
|
+
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
1030
|
+
H ? ee("focus", H) : void 0,
|
|
836
1031
|
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
837
1032
|
/* @__PURE__ */ C("div", {
|
|
838
1033
|
className: "padding",
|
|
839
|
-
...
|
|
840
|
-
onPointerDown:
|
|
841
|
-
onPointerUp:
|
|
842
|
-
onPointerCancel:
|
|
1034
|
+
...k,
|
|
1035
|
+
onPointerDown: A,
|
|
1036
|
+
onPointerUp: j,
|
|
1037
|
+
onPointerCancel: j
|
|
843
1038
|
}),
|
|
844
1039
|
/* @__PURE__ */ C("div", {
|
|
845
1040
|
className: "thumbnail",
|
|
846
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
847
|
-
children:
|
|
1041
|
+
style: { left: `clamp(var(--thumbnail-half), ${F(v ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1042
|
+
children: G?.url ? /* @__PURE__ */ C("img", { src: G.url }) : void 0
|
|
848
1043
|
})
|
|
849
1044
|
]
|
|
850
1045
|
});
|
|
851
|
-
},
|
|
1046
|
+
}, Ze = "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", Q = {
|
|
852
1047
|
xmlns: "http://www.w3.org/2000/svg",
|
|
853
1048
|
width: 24,
|
|
854
1049
|
height: 24,
|
|
@@ -858,8 +1053,8 @@ var B = {
|
|
|
858
1053
|
strokeWidth: 2,
|
|
859
1054
|
strokeLinecap: "round",
|
|
860
1055
|
strokeLinejoin: "round"
|
|
861
|
-
},
|
|
862
|
-
...
|
|
1056
|
+
}, Qe = (e) => /* @__PURE__ */ w("svg", {
|
|
1057
|
+
...Q,
|
|
863
1058
|
...e,
|
|
864
1059
|
children: [/* @__PURE__ */ C("rect", {
|
|
865
1060
|
x: "3",
|
|
@@ -869,8 +1064,8 @@ var B = {
|
|
|
869
1064
|
rx: "2",
|
|
870
1065
|
ry: "2"
|
|
871
1066
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
872
|
-
}),
|
|
873
|
-
...
|
|
1067
|
+
}), $e = (e) => /* @__PURE__ */ w("svg", {
|
|
1068
|
+
...Q,
|
|
874
1069
|
...e,
|
|
875
1070
|
children: [
|
|
876
1071
|
/* @__PURE__ */ C("rect", {
|
|
@@ -889,8 +1084,8 @@ var B = {
|
|
|
889
1084
|
y2: "22"
|
|
890
1085
|
})
|
|
891
1086
|
]
|
|
892
|
-
}),
|
|
893
|
-
...
|
|
1087
|
+
}), et = (e) => /* @__PURE__ */ w("svg", {
|
|
1088
|
+
...Q,
|
|
894
1089
|
...e,
|
|
895
1090
|
children: [
|
|
896
1091
|
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -904,8 +1099,8 @@ var B = {
|
|
|
904
1099
|
}),
|
|
905
1100
|
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
906
1101
|
]
|
|
907
|
-
}),
|
|
908
|
-
...
|
|
1102
|
+
}), tt = (e) => /* @__PURE__ */ w("svg", {
|
|
1103
|
+
...Q,
|
|
909
1104
|
...e,
|
|
910
1105
|
children: [
|
|
911
1106
|
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -919,7 +1114,7 @@ var B = {
|
|
|
919
1114
|
}),
|
|
920
1115
|
/* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
|
|
921
1116
|
]
|
|
922
|
-
}),
|
|
1117
|
+
}), nt = h`
|
|
923
1118
|
.popover {
|
|
924
1119
|
position: absolute;
|
|
925
1120
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -958,7 +1153,7 @@ var B = {
|
|
|
958
1153
|
|
|
959
1154
|
border-radius: 8px;
|
|
960
1155
|
background-color: rgba(28,28,28,0.95);
|
|
961
|
-
${
|
|
1156
|
+
${K.bMedium.regular}
|
|
962
1157
|
|
|
963
1158
|
z-index: 4;
|
|
964
1159
|
|
|
@@ -1001,7 +1196,7 @@ var B = {
|
|
|
1001
1196
|
|
|
1002
1197
|
.secondary {
|
|
1003
1198
|
color: #eee;
|
|
1004
|
-
${
|
|
1199
|
+
${K.bSmall.regular}
|
|
1005
1200
|
}
|
|
1006
1201
|
}
|
|
1007
1202
|
}
|
|
@@ -1043,10 +1238,10 @@ var B = {
|
|
|
1043
1238
|
.failed {
|
|
1044
1239
|
border-bottom: 1px solid #4D4D4E;
|
|
1045
1240
|
color: #f66;
|
|
1046
|
-
${
|
|
1241
|
+
${K.bSmall.regular}
|
|
1047
1242
|
}
|
|
1048
1243
|
}
|
|
1049
|
-
`,
|
|
1244
|
+
`, rt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1050
1245
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1051
1246
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1052
1247
|
return /* @__PURE__ */ w("div", {
|
|
@@ -1073,7 +1268,7 @@ var B = {
|
|
|
1073
1268
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1074
1269
|
]
|
|
1075
1270
|
});
|
|
1076
|
-
},
|
|
1271
|
+
}, it = ({ onReset: e } = {}) => {
|
|
1077
1272
|
let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
|
|
1078
1273
|
c.current = e;
|
|
1079
1274
|
let l = () => {
|
|
@@ -1114,7 +1309,7 @@ var B = {
|
|
|
1114
1309
|
});
|
|
1115
1310
|
}
|
|
1116
1311
|
};
|
|
1117
|
-
},
|
|
1312
|
+
}, at = h`
|
|
1118
1313
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1119
1314
|
which is the width of the player box, so it can be clamped to it. */
|
|
1120
1315
|
position: static;
|
|
@@ -1130,7 +1325,7 @@ position: static;
|
|
|
1130
1325
|
}
|
|
1131
1326
|
}
|
|
1132
1327
|
|
|
1133
|
-
${
|
|
1328
|
+
${nt}
|
|
1134
1329
|
|
|
1135
1330
|
.popover.error-list {
|
|
1136
1331
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1158,7 +1353,7 @@ ${Z}
|
|
|
1158
1353
|
|
|
1159
1354
|
color: #fff;
|
|
1160
1355
|
cursor: pointer;
|
|
1161
|
-
${
|
|
1356
|
+
${K.bSmall.regular}
|
|
1162
1357
|
|
|
1163
1358
|
&:hover {
|
|
1164
1359
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1179,7 +1374,7 @@ ${Z}
|
|
|
1179
1374
|
|
|
1180
1375
|
.when {
|
|
1181
1376
|
color: #bbb;
|
|
1182
|
-
${
|
|
1377
|
+
${K.bSmall.regular}
|
|
1183
1378
|
|
|
1184
1379
|
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1185
1380
|
.count {
|
|
@@ -1198,29 +1393,29 @@ ${Z}
|
|
|
1198
1393
|
color: #ddd;
|
|
1199
1394
|
overflow-wrap: anywhere;
|
|
1200
1395
|
white-space: pre-wrap;
|
|
1201
|
-
${
|
|
1396
|
+
${K.bSmall.regular}
|
|
1202
1397
|
}
|
|
1203
1398
|
}
|
|
1204
1399
|
}
|
|
1205
|
-
`,
|
|
1206
|
-
let n =
|
|
1400
|
+
`, ot = (e) => new Date(e).toLocaleTimeString(), st = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), ct = (e) => e.reduce((e, t) => e + t.count, 0), lt = (e) => e.map((e, t) => {
|
|
1401
|
+
let n = st(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1207
1402
|
return [
|
|
1208
1403
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1209
1404
|
e.message,
|
|
1210
1405
|
e.detail
|
|
1211
1406
|
].filter(Boolean).join("\n");
|
|
1212
|
-
}).join("\n\n"),
|
|
1213
|
-
let e =
|
|
1407
|
+
}).join("\n\n"), ut = () => {
|
|
1408
|
+
let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = it(), [i, a] = m(!1);
|
|
1214
1409
|
if (e.length === 0) return null;
|
|
1215
1410
|
let o = () => {
|
|
1216
|
-
navigator.clipboard?.writeText(
|
|
1411
|
+
navigator.clipboard?.writeText(lt(e)).then(() => {
|
|
1217
1412
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1218
1413
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1219
|
-
}, s = `Playback errors (${
|
|
1414
|
+
}, s = `Playback errors (${ct(e)})`;
|
|
1220
1415
|
return /* @__PURE__ */ w("div", {
|
|
1221
|
-
css:
|
|
1416
|
+
css: at,
|
|
1222
1417
|
ref: r,
|
|
1223
|
-
children: [/* @__PURE__ */ C(
|
|
1418
|
+
children: [/* @__PURE__ */ C(Z, {
|
|
1224
1419
|
id: "errors",
|
|
1225
1420
|
disabled: t,
|
|
1226
1421
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1249,9 +1444,9 @@ ${Z}
|
|
|
1249
1444
|
/* @__PURE__ */ w("span", {
|
|
1250
1445
|
className: "when",
|
|
1251
1446
|
children: [
|
|
1252
|
-
|
|
1253
|
-
e.count > 1 ? ` to ${
|
|
1254
|
-
|
|
1447
|
+
ot(e.at),
|
|
1448
|
+
e.count > 1 ? ` to ${ot(e.lastAt)}` : "",
|
|
1449
|
+
st(e.atMediaTime) ? ` at ${st(e.atMediaTime)}` : "",
|
|
1255
1450
|
e.recovered ? " recovered" : "",
|
|
1256
1451
|
e.count > 1 ? /* @__PURE__ */ C("span", {
|
|
1257
1452
|
className: "count",
|
|
@@ -1271,7 +1466,7 @@ ${Z}
|
|
|
1271
1466
|
}, `${e.at}-${t}`))]
|
|
1272
1467
|
})]
|
|
1273
1468
|
});
|
|
1274
|
-
},
|
|
1469
|
+
}, dt = h`
|
|
1275
1470
|
display: flex;
|
|
1276
1471
|
align-items: center;
|
|
1277
1472
|
justify-content: center;
|
|
@@ -1324,8 +1519,8 @@ width: 100%;
|
|
|
1324
1519
|
}
|
|
1325
1520
|
}
|
|
1326
1521
|
}
|
|
1327
|
-
`,
|
|
1328
|
-
let e =
|
|
1522
|
+
`, ft = () => {
|
|
1523
|
+
let e = U(), t = U((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 } = we({
|
|
1329
1524
|
ref: r,
|
|
1330
1525
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1331
1526
|
}), f = (t) => {
|
|
@@ -1341,7 +1536,7 @@ width: 100%;
|
|
|
1341
1536
|
}, [t]);
|
|
1342
1537
|
let m = c(s);
|
|
1343
1538
|
return /* @__PURE__ */ w("div", {
|
|
1344
|
-
css:
|
|
1539
|
+
css: dt,
|
|
1345
1540
|
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1346
1541
|
className: "playback-slider",
|
|
1347
1542
|
ref: n,
|
|
@@ -1359,7 +1554,7 @@ width: 100%;
|
|
|
1359
1554
|
})
|
|
1360
1555
|
})]
|
|
1361
1556
|
});
|
|
1362
|
-
},
|
|
1557
|
+
}, pt = h`
|
|
1363
1558
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1364
1559
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1365
1560
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1377,7 +1572,7 @@ position: static;
|
|
|
1377
1572
|
}
|
|
1378
1573
|
}
|
|
1379
1574
|
|
|
1380
|
-
${
|
|
1575
|
+
${nt}
|
|
1381
1576
|
|
|
1382
1577
|
.playback-rate {
|
|
1383
1578
|
.slider {
|
|
@@ -1418,8 +1613,8 @@ ${Z}
|
|
|
1418
1613
|
}
|
|
1419
1614
|
}
|
|
1420
1615
|
|
|
1421
|
-
`,
|
|
1422
|
-
let e =
|
|
1616
|
+
`, mt = () => {
|
|
1617
|
+
let e = U(), t = U((e) => e.playbackRate), n = U((e) => e.audioTracks), r = U((e) => e.selectedAudioTrack), i = U((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = it({ onReset: () => o(0) }), p = (t) => {
|
|
1423
1618
|
e.setPlaybackRate(t), o(0);
|
|
1424
1619
|
}, h = (e) => {
|
|
1425
1620
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1427,10 +1622,10 @@ ${Z}
|
|
|
1427
1622
|
o(e);
|
|
1428
1623
|
};
|
|
1429
1624
|
return /* @__PURE__ */ w("div", {
|
|
1430
|
-
css:
|
|
1625
|
+
css: pt,
|
|
1431
1626
|
ref: l,
|
|
1432
1627
|
children: [
|
|
1433
|
-
/* @__PURE__ */ C(
|
|
1628
|
+
/* @__PURE__ */ C(Z, {
|
|
1434
1629
|
id: "settings",
|
|
1435
1630
|
disabled: s,
|
|
1436
1631
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1466,7 +1661,7 @@ ${Z}
|
|
|
1466
1661
|
}),
|
|
1467
1662
|
/* @__PURE__ */ C("div", {
|
|
1468
1663
|
className: "slider no-hover",
|
|
1469
|
-
children: /* @__PURE__ */ C(
|
|
1664
|
+
children: /* @__PURE__ */ C(ft, {})
|
|
1470
1665
|
}),
|
|
1471
1666
|
/* @__PURE__ */ w("div", {
|
|
1472
1667
|
className: "options no-hover",
|
|
@@ -1491,7 +1686,7 @@ ${Z}
|
|
|
1491
1686
|
})
|
|
1492
1687
|
]
|
|
1493
1688
|
}),
|
|
1494
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1689
|
+
s && a === 2 && /* @__PURE__ */ C(rt, {
|
|
1495
1690
|
title: "Audio",
|
|
1496
1691
|
tracks: n,
|
|
1497
1692
|
selected: r,
|
|
@@ -1502,7 +1697,7 @@ ${Z}
|
|
|
1502
1697
|
})
|
|
1503
1698
|
]
|
|
1504
1699
|
});
|
|
1505
|
-
},
|
|
1700
|
+
}, ht = h`
|
|
1506
1701
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1507
1702
|
which is the width of the player box, so it can be clamped to it. */
|
|
1508
1703
|
position: static;
|
|
@@ -1518,15 +1713,15 @@ position: static;
|
|
|
1518
1713
|
}
|
|
1519
1714
|
}
|
|
1520
1715
|
|
|
1521
|
-
${
|
|
1522
|
-
`,
|
|
1523
|
-
let e =
|
|
1716
|
+
${nt}
|
|
1717
|
+
`, gt = () => {
|
|
1718
|
+
let e = U((e) => e.subtitleTracks), t = U((e) => e.selectedSubtitleTrack), n = U((e) => e.selectSubtitleTrack), r = U((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = it();
|
|
1524
1719
|
if (e.length === 0) return null;
|
|
1525
1720
|
let u = t !== void 0;
|
|
1526
1721
|
return /* @__PURE__ */ w("div", {
|
|
1527
|
-
css:
|
|
1722
|
+
css: ht,
|
|
1528
1723
|
ref: o,
|
|
1529
|
-
children: [/* @__PURE__ */ C(
|
|
1724
|
+
children: [/* @__PURE__ */ C(Z, {
|
|
1530
1725
|
id: "subtitles",
|
|
1531
1726
|
disabled: i,
|
|
1532
1727
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1536,10 +1731,10 @@ ${Z}
|
|
|
1536
1731
|
"aria-label": "Subtitles",
|
|
1537
1732
|
"aria-expanded": i,
|
|
1538
1733
|
"aria-pressed": u,
|
|
1539
|
-
children: u ? /* @__PURE__ */ C(
|
|
1734
|
+
children: u ? /* @__PURE__ */ C(Qe, { className: "captions" }) : /* @__PURE__ */ C($e, { className: "captions-off" })
|
|
1540
1735
|
}),
|
|
1541
1736
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1542
|
-
}), i && /* @__PURE__ */ C(
|
|
1737
|
+
}), i && /* @__PURE__ */ C(rt, {
|
|
1543
1738
|
title: "Subtitles",
|
|
1544
1739
|
tracks: e,
|
|
1545
1740
|
selected: t,
|
|
@@ -1549,13 +1744,13 @@ ${Z}
|
|
|
1549
1744
|
failed: c
|
|
1550
1745
|
})]
|
|
1551
1746
|
});
|
|
1552
|
-
},
|
|
1747
|
+
}, _t = {
|
|
1553
1748
|
primary: "#EAEBEE",
|
|
1554
1749
|
secondary: "#D0D0D9",
|
|
1555
1750
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1556
1751
|
borderPrimary: "#384F70",
|
|
1557
1752
|
backgroundTooltip: "#222222"
|
|
1558
|
-
},
|
|
1753
|
+
}, vt = h`
|
|
1559
1754
|
display: flex;
|
|
1560
1755
|
align-items: center;
|
|
1561
1756
|
|
|
@@ -1598,8 +1793,8 @@ ${Z}
|
|
|
1598
1793
|
width: 10px;
|
|
1599
1794
|
height: 10px;
|
|
1600
1795
|
}
|
|
1601
|
-
`,
|
|
1602
|
-
let n =
|
|
1796
|
+
`, yt = ({ value: e, onChange: t }) => {
|
|
1797
|
+
let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = we({
|
|
1603
1798
|
ref: a,
|
|
1604
1799
|
onChange: t
|
|
1605
1800
|
}), s = (n) => {
|
|
@@ -1613,12 +1808,12 @@ ${Z}
|
|
|
1613
1808
|
e && e.removeEventListener("wheel", s);
|
|
1614
1809
|
};
|
|
1615
1810
|
}, [e]);
|
|
1616
|
-
let c = e * 100, l = f(() => Math.round(r ? 0 :
|
|
1617
|
-
return /* @__PURE__ */ C(
|
|
1811
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : J(n) * 100), [n, r]);
|
|
1812
|
+
return /* @__PURE__ */ C(Z, {
|
|
1618
1813
|
id: "volume-slider",
|
|
1619
1814
|
text: /* @__PURE__ */ C("div", {
|
|
1620
1815
|
ref: i,
|
|
1621
|
-
css:
|
|
1816
|
+
css: vt,
|
|
1622
1817
|
...o,
|
|
1623
1818
|
children: /* @__PURE__ */ C("div", {
|
|
1624
1819
|
ref: a,
|
|
@@ -1637,7 +1832,7 @@ ${Z}
|
|
|
1637
1832
|
children: [l, "%"]
|
|
1638
1833
|
})
|
|
1639
1834
|
});
|
|
1640
|
-
},
|
|
1835
|
+
}, bt = h`
|
|
1641
1836
|
position: relative;
|
|
1642
1837
|
display: flex;
|
|
1643
1838
|
align-items: center;
|
|
@@ -1662,7 +1857,7 @@ ${Z}
|
|
|
1662
1857
|
border-radius: 4px;
|
|
1663
1858
|
|
|
1664
1859
|
.volume-value {
|
|
1665
|
-
${
|
|
1860
|
+
${K.bMedium.regular};
|
|
1666
1861
|
color: #ffffff;
|
|
1667
1862
|
}
|
|
1668
1863
|
}
|
|
@@ -1700,11 +1895,11 @@ ${Z}
|
|
|
1700
1895
|
}
|
|
1701
1896
|
}
|
|
1702
1897
|
|
|
1703
|
-
`,
|
|
1704
|
-
let t =
|
|
1898
|
+
`, xt = ({ ref: e }) => {
|
|
1899
|
+
let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => J(n), [n]);
|
|
1705
1900
|
return /* @__PURE__ */ w("div", {
|
|
1706
|
-
css:
|
|
1707
|
-
children: [/* @__PURE__ */ C(
|
|
1901
|
+
css: bt,
|
|
1902
|
+
children: [/* @__PURE__ */ C(Z, {
|
|
1708
1903
|
id: "sound",
|
|
1709
1904
|
text: /* @__PURE__ */ C("button", {
|
|
1710
1905
|
className: "sound",
|
|
@@ -1723,16 +1918,16 @@ ${Z}
|
|
|
1723
1918
|
className: "volume-slider-container",
|
|
1724
1919
|
children: /* @__PURE__ */ C("div", {
|
|
1725
1920
|
className: "volume-slider-background",
|
|
1726
|
-
children: /* @__PURE__ */ C(
|
|
1921
|
+
children: /* @__PURE__ */ C(yt, {
|
|
1727
1922
|
value: r ? 0 : i,
|
|
1728
1923
|
onChange: (e) => {
|
|
1729
|
-
t.setVolume(
|
|
1924
|
+
t.setVolume(ye(e));
|
|
1730
1925
|
}
|
|
1731
1926
|
})
|
|
1732
1927
|
})
|
|
1733
1928
|
})]
|
|
1734
1929
|
});
|
|
1735
|
-
}, $ = .05,
|
|
1930
|
+
}, $ = .05, St = 5, Ct = h`
|
|
1736
1931
|
display: flex;
|
|
1737
1932
|
flex-direction: column;
|
|
1738
1933
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1741,7 +1936,7 @@ ${Z}
|
|
|
1741
1936
|
opacity: 0.72;
|
|
1742
1937
|
font-size: 0.9em;
|
|
1743
1938
|
}
|
|
1744
|
-
`,
|
|
1939
|
+
`, wt = h`
|
|
1745
1940
|
position: absolute;
|
|
1746
1941
|
bottom: 0;
|
|
1747
1942
|
width: 100%;
|
|
@@ -1831,7 +2026,7 @@ ${Z}
|
|
|
1831
2026
|
cursor: pointer;
|
|
1832
2027
|
|
|
1833
2028
|
:hover {
|
|
1834
|
-
background-color: ${
|
|
2029
|
+
background-color: ${_t.hover};
|
|
1835
2030
|
}
|
|
1836
2031
|
|
|
1837
2032
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1848,7 +2043,7 @@ ${Z}
|
|
|
1848
2043
|
|
|
1849
2044
|
.left {
|
|
1850
2045
|
.time {
|
|
1851
|
-
${
|
|
2046
|
+
${K.bMedium.regular}
|
|
1852
2047
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1853
2048
|
}
|
|
1854
2049
|
}
|
|
@@ -1869,10 +2064,10 @@ ${Z}
|
|
|
1869
2064
|
}
|
|
1870
2065
|
}
|
|
1871
2066
|
}
|
|
1872
|
-
`,
|
|
1873
|
-
let e =
|
|
1874
|
-
let r =
|
|
1875
|
-
e.setVolume(
|
|
2067
|
+
`, Tt = () => {
|
|
2068
|
+
let e = U(), t = U((e) => e.paused), n = U((e) => e.currentTime), r = U((e) => e.duration), i = U((e) => e.fullscreen), a = U((e) => e.hideUI), o = U((e) => e.togglePictureInPicture), s = U((e) => e.pictureInPictureMode), c = U((e) => e.burnedInSubtitles), l = U((e) => e.subtitleTracks), f = U((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 }) => {
|
|
2069
|
+
let r = J(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
2070
|
+
e.setVolume(ye(a)), o && !e.muted && e.toggleMuted();
|
|
1876
2071
|
}, [e]);
|
|
1877
2072
|
d(() => {
|
|
1878
2073
|
let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
|
|
@@ -1893,8 +2088,8 @@ ${Z}
|
|
|
1893
2088
|
});
|
|
1894
2089
|
else if (n.key === "ArrowRight") {
|
|
1895
2090
|
if (!e.duration) return;
|
|
1896
|
-
t(Math.min(e.currentTime +
|
|
1897
|
-
} else n.key === "ArrowLeft" ? t(Math.max(e.currentTime -
|
|
2091
|
+
t(Math.min(e.currentTime + St, e.duration));
|
|
2092
|
+
} else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - St, 0)) : i = !1;
|
|
1898
2093
|
i && n.preventDefault();
|
|
1899
2094
|
};
|
|
1900
2095
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
@@ -1915,17 +2110,17 @@ ${Z}
|
|
|
1915
2110
|
return d(() => {
|
|
1916
2111
|
if (p) return p.addEventListener("wheel", b, { passive: !1 }), () => p.removeEventListener("wheel", b);
|
|
1917
2112
|
}, [p, b]), /* @__PURE__ */ w("div", {
|
|
1918
|
-
css:
|
|
2113
|
+
css: wt,
|
|
1919
2114
|
style: { ...a ? {
|
|
1920
2115
|
opacity: "0",
|
|
1921
2116
|
pointerEvents: "none"
|
|
1922
2117
|
} : {} },
|
|
1923
|
-
children: [/* @__PURE__ */ C(
|
|
2118
|
+
children: [/* @__PURE__ */ C(Xe, {}), /* @__PURE__ */ w("div", {
|
|
1924
2119
|
className: "actions",
|
|
1925
2120
|
children: [/* @__PURE__ */ w("div", {
|
|
1926
2121
|
className: "left",
|
|
1927
2122
|
children: [
|
|
1928
|
-
/* @__PURE__ */ C(
|
|
2123
|
+
/* @__PURE__ */ C(Z, {
|
|
1929
2124
|
id: "play",
|
|
1930
2125
|
tooltipPlace: "top-start",
|
|
1931
2126
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1937,19 +2132,19 @@ ${Z}
|
|
|
1937
2132
|
}),
|
|
1938
2133
|
toolTipText: /* @__PURE__ */ C("span", { children: v ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1939
2134
|
}),
|
|
1940
|
-
/* @__PURE__ */ C(
|
|
2135
|
+
/* @__PURE__ */ C(xt, { ref: h }),
|
|
1941
2136
|
/* @__PURE__ */ C("div", {
|
|
1942
2137
|
className: "time",
|
|
1943
|
-
children:
|
|
2138
|
+
children: be(n, r)
|
|
1944
2139
|
})
|
|
1945
2140
|
]
|
|
1946
2141
|
}), /* @__PURE__ */ w("div", {
|
|
1947
2142
|
className: "right",
|
|
1948
2143
|
children: [
|
|
1949
|
-
/* @__PURE__ */ C(
|
|
1950
|
-
/* @__PURE__ */ C(
|
|
1951
|
-
/* @__PURE__ */ C(
|
|
1952
|
-
o ? /* @__PURE__ */ C(
|
|
2144
|
+
/* @__PURE__ */ C(ut, {}),
|
|
2145
|
+
/* @__PURE__ */ C(gt, {}),
|
|
2146
|
+
/* @__PURE__ */ C(mt, {}),
|
|
2147
|
+
o ? /* @__PURE__ */ C(Z, {
|
|
1953
2148
|
id: "picture-in-picture",
|
|
1954
2149
|
tooltipPlace: "top-end",
|
|
1955
2150
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1959,13 +2154,13 @@ ${Z}
|
|
|
1959
2154
|
disabled: g && !_,
|
|
1960
2155
|
"aria-label": g ? "Put the subtitles in the video" : "Picture in picture",
|
|
1961
2156
|
"aria-pressed": g ? c : void 0,
|
|
1962
|
-
children: g ? C(c ?
|
|
1963
|
-
src:
|
|
2157
|
+
children: g ? C(c ? et : tt, {}) : /* @__PURE__ */ C("img", {
|
|
2158
|
+
src: Ze,
|
|
1964
2159
|
alt: ""
|
|
1965
2160
|
})
|
|
1966
2161
|
}),
|
|
1967
2162
|
toolTipText: /* @__PURE__ */ w("span", {
|
|
1968
|
-
css:
|
|
2163
|
+
css: Ct,
|
|
1969
2164
|
children: [/* @__PURE__ */ C("span", {
|
|
1970
2165
|
className: "lead",
|
|
1971
2166
|
children: g ? _ ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
|
|
@@ -1975,7 +2170,7 @@ ${Z}
|
|
|
1975
2170
|
}) : null]
|
|
1976
2171
|
})
|
|
1977
2172
|
}) : null,
|
|
1978
|
-
/* @__PURE__ */ C(
|
|
2173
|
+
/* @__PURE__ */ C(Z, {
|
|
1979
2174
|
id: "full-screen",
|
|
1980
2175
|
tooltipPlace: "top-end",
|
|
1981
2176
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1992,7 +2187,7 @@ ${Z}
|
|
|
1992
2187
|
})]
|
|
1993
2188
|
})]
|
|
1994
2189
|
});
|
|
1995
|
-
},
|
|
2190
|
+
}, Et = 9e3, Dt = h`
|
|
1996
2191
|
position: absolute;
|
|
1997
2192
|
inset: 0;
|
|
1998
2193
|
z-index: 2;
|
|
@@ -2030,12 +2225,12 @@ ${Z}
|
|
|
2030
2225
|
}
|
|
2031
2226
|
|
|
2032
2227
|
.title {
|
|
2033
|
-
${
|
|
2228
|
+
${K.bMedium.bold}
|
|
2034
2229
|
color: #fff;
|
|
2035
2230
|
}
|
|
2036
2231
|
|
|
2037
2232
|
.body {
|
|
2038
|
-
${
|
|
2233
|
+
${K.bSmall.regular}
|
|
2039
2234
|
color: rgba(255, 255, 255, 0.75);
|
|
2040
2235
|
}
|
|
2041
2236
|
|
|
@@ -2046,18 +2241,18 @@ ${Z}
|
|
|
2046
2241
|
line-height: 1;
|
|
2047
2242
|
color: #fff;
|
|
2048
2243
|
}
|
|
2049
|
-
`,
|
|
2050
|
-
let e =
|
|
2244
|
+
`, Ot = () => {
|
|
2245
|
+
let e = U((e) => e.burnedInSubtitles), t = U((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
2051
2246
|
return d(() => {
|
|
2052
2247
|
if (t !== "burn-in" || !e) {
|
|
2053
2248
|
r(!1);
|
|
2054
2249
|
return;
|
|
2055
2250
|
}
|
|
2056
2251
|
r(!0);
|
|
2057
|
-
let n = setTimeout(() => r(!1),
|
|
2252
|
+
let n = setTimeout(() => r(!1), Et);
|
|
2058
2253
|
return () => clearTimeout(n);
|
|
2059
2254
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
2060
|
-
css:
|
|
2255
|
+
css: Dt,
|
|
2061
2256
|
className: n ? "show" : "",
|
|
2062
2257
|
role: "status",
|
|
2063
2258
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -2078,7 +2273,101 @@ ${Z}
|
|
|
2078
2273
|
})]
|
|
2079
2274
|
})
|
|
2080
2275
|
});
|
|
2081
|
-
},
|
|
2276
|
+
}, kt = 1, At = 6e3, jt = 1, Mt = {
|
|
2277
|
+
opening: "Skip Opening",
|
|
2278
|
+
ending: "Skip Ending"
|
|
2279
|
+
}, Nt = h`
|
|
2280
|
+
position: absolute;
|
|
2281
|
+
inset: 0;
|
|
2282
|
+
z-index: 2;
|
|
2283
|
+
pointer-events: none;
|
|
2284
|
+
|
|
2285
|
+
button {
|
|
2286
|
+
position: absolute;
|
|
2287
|
+
/* clear of the control bar, which is 6 to 8px of padding plus a row of 18 to 28px controls and
|
|
2288
|
+
the seekbar above them */
|
|
2289
|
+
bottom: calc(7 * var(--mp-unit));
|
|
2290
|
+
right: calc(2.4 * var(--mp-unit));
|
|
2291
|
+
|
|
2292
|
+
/* the one thing in this layer that can be pressed */
|
|
2293
|
+
pointer-events: auto;
|
|
2294
|
+
cursor: pointer;
|
|
2295
|
+
|
|
2296
|
+
${K.bMedium.bold}
|
|
2297
|
+
color: #fff;
|
|
2298
|
+
padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
|
|
2299
|
+
border: 1px solid rgba(255, 255, 255, .55);
|
|
2300
|
+
border-radius: calc(.4 * var(--mp-unit));
|
|
2301
|
+
background-color: rgba(20, 20, 22, .8);
|
|
2302
|
+
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
2303
|
+
|
|
2304
|
+
opacity: 0;
|
|
2305
|
+
transform: translateY(calc(.6 * var(--mp-unit)));
|
|
2306
|
+
/* visibility as well as opacity, so a faded button cannot be hovered or pressed */
|
|
2307
|
+
visibility: hidden;
|
|
2308
|
+
transition: opacity .18s ease, transform .18s ease, visibility .18s;
|
|
2309
|
+
|
|
2310
|
+
&:hover, &:focus-visible {
|
|
2311
|
+
background-color: rgba(255, 255, 255, .92);
|
|
2312
|
+
color: #111;
|
|
2313
|
+
border-color: transparent;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
&.show button {
|
|
2318
|
+
opacity: 1;
|
|
2319
|
+
transform: none;
|
|
2320
|
+
visibility: visible;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
@media (pointer: coarse) {
|
|
2324
|
+
button {
|
|
2325
|
+
/* a finger needs a target, and the control row below is already 44px */
|
|
2326
|
+
min-height: 44px;
|
|
2327
|
+
bottom: calc(9 * var(--mp-unit));
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
`, Pt = () => {
|
|
2331
|
+
let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U(), i = f(() => qe(e), [e]), a = f(() => {
|
|
2332
|
+
if (typeof t != "number") return;
|
|
2333
|
+
let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - kt <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
|
|
2334
|
+
return r ? {
|
|
2335
|
+
kind: r,
|
|
2336
|
+
end: e[n].end
|
|
2337
|
+
} : void 0;
|
|
2338
|
+
}, [
|
|
2339
|
+
e,
|
|
2340
|
+
i,
|
|
2341
|
+
t
|
|
2342
|
+
]), o = p(0), [s, c] = m(0);
|
|
2343
|
+
d(() => {
|
|
2344
|
+
let e = typeof t == "number" ? t : 0, n = o.current;
|
|
2345
|
+
o.current = e, e < n - jt && c((e) => e + 1);
|
|
2346
|
+
}, [t]);
|
|
2347
|
+
let [l, u] = m(!1), h = a ? `${a.kind}@${a.end}` : "";
|
|
2348
|
+
return d(() => {
|
|
2349
|
+
if (!h) {
|
|
2350
|
+
u(!1);
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
u(!0);
|
|
2354
|
+
let e = setTimeout(() => u(!1), At);
|
|
2355
|
+
return () => clearTimeout(e);
|
|
2356
|
+
}, [h, s]), d(() => {
|
|
2357
|
+
a || u(!1);
|
|
2358
|
+
}, [a]), a ? /* @__PURE__ */ C("div", {
|
|
2359
|
+
css: Nt,
|
|
2360
|
+
className: l ? "show" : "",
|
|
2361
|
+
children: /* @__PURE__ */ C("button", {
|
|
2362
|
+
type: "button",
|
|
2363
|
+
className: "skip-chapter",
|
|
2364
|
+
onClick: () => {
|
|
2365
|
+
u(!1), n ? n(a.end) : r.seek(a.end);
|
|
2366
|
+
},
|
|
2367
|
+
children: Mt[a.kind]
|
|
2368
|
+
})
|
|
2369
|
+
}) : null;
|
|
2370
|
+
}, Ft = 3e3, It = h`
|
|
2082
2371
|
position: absolute;
|
|
2083
2372
|
inset: 0;
|
|
2084
2373
|
z-index: 2;
|
|
@@ -2089,7 +2378,7 @@ ${Z}
|
|
|
2089
2378
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2090
2379
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2091
2380
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2092
|
-
`,
|
|
2381
|
+
`, Lt = h`
|
|
2093
2382
|
position: relative;
|
|
2094
2383
|
background-color: black;
|
|
2095
2384
|
display: flex;
|
|
@@ -2134,14 +2423,14 @@ ${Z}
|
|
|
2134
2423
|
&.hide {
|
|
2135
2424
|
cursor: none;
|
|
2136
2425
|
}
|
|
2137
|
-
`,
|
|
2426
|
+
`, Rt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
2138
2427
|
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
2139
|
-
return l(e) && e.type === c ?
|
|
2428
|
+
return l(e) && e.type === c ? Rt(e.props.children, `${r}/`) : [{
|
|
2140
2429
|
key: r,
|
|
2141
2430
|
item: e
|
|
2142
2431
|
}];
|
|
2143
|
-
}),
|
|
2144
|
-
let o =
|
|
2432
|
+
}), zt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
|
|
2433
|
+
let o = U(), s = U((e) => e.hideUI), c = U((e) => e.setHideUI), l = p(void 0), u = p("mouse"), f = p({
|
|
2145
2434
|
x: -1,
|
|
2146
2435
|
y: -1
|
|
2147
2436
|
}), m = p(null);
|
|
@@ -2156,15 +2445,15 @@ ${Z}
|
|
|
2156
2445
|
return !!n && m.current.contains(n) && !n.closest(".video");
|
|
2157
2446
|
}, _ = () => {
|
|
2158
2447
|
if (g()) {
|
|
2159
|
-
l.current = setTimeout(_,
|
|
2448
|
+
l.current = setTimeout(_, Ft);
|
|
2160
2449
|
return;
|
|
2161
2450
|
}
|
|
2162
2451
|
c(!0);
|
|
2163
2452
|
}, v = () => {
|
|
2164
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(_,
|
|
2453
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(_, Ft);
|
|
2165
2454
|
};
|
|
2166
2455
|
return /* @__PURE__ */ w("div", {
|
|
2167
|
-
css:
|
|
2456
|
+
css: Lt,
|
|
2168
2457
|
ref: h,
|
|
2169
2458
|
onPointerMove: (e) => {
|
|
2170
2459
|
u.current = e.pointerType, e.pointerType === "mouse" && (f.current = {
|
|
@@ -2183,9 +2472,9 @@ ${Z}
|
|
|
2183
2472
|
},
|
|
2184
2473
|
className: s ? "hide" : "",
|
|
2185
2474
|
children: [
|
|
2186
|
-
/* @__PURE__ */ C(
|
|
2187
|
-
|
|
2188
|
-
css:
|
|
2475
|
+
/* @__PURE__ */ C(_e, { onSubtitleRef: n }),
|
|
2476
|
+
Rt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2477
|
+
css: It,
|
|
2189
2478
|
style: { ...s ? {
|
|
2190
2479
|
opacity: "0",
|
|
2191
2480
|
visibility: "hidden",
|
|
@@ -2193,8 +2482,9 @@ ${Z}
|
|
|
2193
2482
|
} : {} },
|
|
2194
2483
|
children: t
|
|
2195
2484
|
}, e)),
|
|
2196
|
-
i === !1 ? null : /* @__PURE__ */ C(
|
|
2197
|
-
/* @__PURE__ */ C(
|
|
2485
|
+
i === !1 ? null : /* @__PURE__ */ C(Tt, {}),
|
|
2486
|
+
/* @__PURE__ */ C(Ot, {}),
|
|
2487
|
+
/* @__PURE__ */ C(Pt, {}),
|
|
2198
2488
|
/* @__PURE__ */ w("div", {
|
|
2199
2489
|
className: "video",
|
|
2200
2490
|
onClick: () => {
|
|
@@ -2211,96 +2501,98 @@ ${Z}
|
|
|
2211
2501
|
})
|
|
2212
2502
|
]
|
|
2213
2503
|
});
|
|
2214
|
-
},
|
|
2215
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size:
|
|
2216
|
-
d(() => (
|
|
2217
|
-
let { expose:
|
|
2218
|
-
|
|
2219
|
-
let
|
|
2504
|
+
}, Bt = ({ options: e, children: t }) => {
|
|
2505
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: f, thumbnailsEnabled: h } = r ?? {}, g = y(), _ = v(), [b, x] = m(null), [S, w] = m(null), T = n?.media ?? b;
|
|
2506
|
+
d(() => (g?.(T), () => g?.(null)), [T, g]);
|
|
2507
|
+
let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
|
|
2508
|
+
O.current = D;
|
|
2509
|
+
let k = D ? D.id : void 0, A = D ? D.origin : void 0, j = D ? D.channel : void 0;
|
|
2220
2510
|
d(() => {
|
|
2221
|
-
if (!
|
|
2511
|
+
if (!E || !T) return;
|
|
2222
2512
|
let e, t = !1;
|
|
2223
2513
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
2224
|
-
t || (e = n(
|
|
2514
|
+
t || (e = n(T, O.current ?? {}));
|
|
2225
2515
|
}).catch(() => {}), () => {
|
|
2226
2516
|
t = !0, e?.();
|
|
2227
2517
|
};
|
|
2228
2518
|
}, [
|
|
2229
|
-
|
|
2230
|
-
!!
|
|
2231
|
-
O,
|
|
2519
|
+
T,
|
|
2520
|
+
!!E,
|
|
2232
2521
|
k,
|
|
2233
|
-
A
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2522
|
+
A,
|
|
2523
|
+
j
|
|
2524
|
+
]), se(b, S, r);
|
|
2525
|
+
let { thumbnails: M, requestThumbnail: N } = ue({
|
|
2526
|
+
publicPath: c,
|
|
2527
|
+
workerUrl: l,
|
|
2528
|
+
length: h === !1 ? void 0 : o,
|
|
2529
|
+
read: f ?? u,
|
|
2530
|
+
downloadedRanges: s
|
|
2531
|
+
}), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = de(b, S), R = U((e) => e.setSourceState);
|
|
2242
2532
|
d(() => {
|
|
2243
|
-
|
|
2533
|
+
R({
|
|
2244
2534
|
title: i,
|
|
2245
|
-
size:
|
|
2246
|
-
downloadedRanges:
|
|
2535
|
+
size: o,
|
|
2536
|
+
downloadedRanges: s
|
|
2247
2537
|
});
|
|
2248
2538
|
}, [
|
|
2249
|
-
|
|
2539
|
+
R,
|
|
2250
2540
|
i,
|
|
2251
|
-
|
|
2252
|
-
|
|
2541
|
+
o,
|
|
2542
|
+
s
|
|
2253
2543
|
]);
|
|
2254
|
-
let
|
|
2544
|
+
let z = n?.thumbnails?.at;
|
|
2255
2545
|
d(() => {
|
|
2256
|
-
|
|
2257
|
-
thumbnails:
|
|
2258
|
-
thumbnailAt:
|
|
2259
|
-
requestThumbnail:
|
|
2260
|
-
togglePictureInPicture:
|
|
2261
|
-
pictureInPictureMode:
|
|
2262
|
-
burnedInSubtitles:
|
|
2546
|
+
R({
|
|
2547
|
+
thumbnails: P,
|
|
2548
|
+
thumbnailAt: z,
|
|
2549
|
+
requestThumbnail: N,
|
|
2550
|
+
togglePictureInPicture: F,
|
|
2551
|
+
pictureInPictureMode: I,
|
|
2552
|
+
burnedInSubtitles: L
|
|
2263
2553
|
});
|
|
2264
2554
|
}, [
|
|
2265
|
-
L,
|
|
2266
|
-
N,
|
|
2267
2555
|
R,
|
|
2268
|
-
M,
|
|
2269
2556
|
P,
|
|
2557
|
+
z,
|
|
2558
|
+
N,
|
|
2270
2559
|
F,
|
|
2271
|
-
I
|
|
2560
|
+
I,
|
|
2561
|
+
L
|
|
2272
2562
|
]);
|
|
2273
|
-
let
|
|
2563
|
+
let B = n?.subtitles?.selection, V = n?.audioTracks?.selection;
|
|
2274
2564
|
return d(() => {
|
|
2275
|
-
|
|
2276
|
-
subtitleTracks:
|
|
2565
|
+
B && R({
|
|
2566
|
+
subtitleTracks: B.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2277
2567
|
id: e,
|
|
2278
2568
|
label: t,
|
|
2279
2569
|
disabled: n
|
|
2280
2570
|
})),
|
|
2281
|
-
selectedSubtitleTrack:
|
|
2282
|
-
selectSubtitleTrack: (e) =>
|
|
2283
|
-
subtitleOffLabel:
|
|
2571
|
+
selectedSubtitleTrack: B.selectedId ?? void 0,
|
|
2572
|
+
selectSubtitleTrack: (e) => B.select(e == null ? null : String(e)),
|
|
2573
|
+
subtitleOffLabel: B.offLabel
|
|
2284
2574
|
});
|
|
2285
|
-
}, [
|
|
2286
|
-
|
|
2287
|
-
audioTracks:
|
|
2575
|
+
}, [R, B]), d(() => {
|
|
2576
|
+
V && R({
|
|
2577
|
+
audioTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2288
2578
|
id: e,
|
|
2289
2579
|
label: t,
|
|
2290
2580
|
disabled: n
|
|
2291
2581
|
})),
|
|
2292
|
-
selectedAudioTrack:
|
|
2293
|
-
selectAudioTrack: (e) =>
|
|
2582
|
+
selectedAudioTrack: V.selectedId ?? void 0,
|
|
2583
|
+
selectAudioTrack: (e) => V.select(String(e))
|
|
2294
2584
|
});
|
|
2295
|
-
}, [
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2585
|
+
}, [R, V]), d(() => {
|
|
2586
|
+
a && R({ chapters: a });
|
|
2587
|
+
}, [R, a]), /* @__PURE__ */ C(zt, {
|
|
2588
|
+
ref: _,
|
|
2589
|
+
onVideoRef: n ? void 0 : x,
|
|
2590
|
+
onSubtitleRef: w,
|
|
2299
2591
|
overlay: e.overlay,
|
|
2300
2592
|
controls: e.controls,
|
|
2301
2593
|
children: t
|
|
2302
2594
|
});
|
|
2303
|
-
},
|
|
2595
|
+
}, Vt = h`
|
|
2304
2596
|
/**
|
|
2305
2597
|
* The chrome's whole scale, in one place.
|
|
2306
2598
|
*
|
|
@@ -2370,17 +2662,17 @@ ${Z}
|
|
|
2370
2662
|
height: 100%;
|
|
2371
2663
|
width: 100%;
|
|
2372
2664
|
overflow: hidden;
|
|
2373
|
-
`,
|
|
2374
|
-
css:
|
|
2375
|
-
children: /* @__PURE__ */ C(
|
|
2665
|
+
`, Ht = (e) => /* @__PURE__ */ C("div", {
|
|
2666
|
+
css: Vt,
|
|
2667
|
+
children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Bt, {
|
|
2376
2668
|
options: e,
|
|
2377
2669
|
children: e.children
|
|
2378
2670
|
}) })
|
|
2379
|
-
}),
|
|
2671
|
+
}), Ut = (e) => !!e && typeof e == "object" && "at" in e, Wt = (e) => !!e && typeof e == "object" && "selection" in e, Gt = ({ blob: e, name: t }) => ({
|
|
2380
2672
|
length: e.size,
|
|
2381
2673
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2382
2674
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2383
|
-
}),
|
|
2675
|
+
}), Kt = async (e, t) => {
|
|
2384
2676
|
let n = await fetch(e, {
|
|
2385
2677
|
headers: { Range: "bytes=0-1" },
|
|
2386
2678
|
credentials: t
|
|
@@ -2390,23 +2682,25 @@ ${Z}
|
|
|
2390
2682
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2391
2683
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2392
2684
|
return i;
|
|
2393
|
-
},
|
|
2394
|
-
let i = t ?? await
|
|
2685
|
+
}, qt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2686
|
+
let i = t ?? await Kt(e, r);
|
|
2395
2687
|
return {
|
|
2396
2688
|
length: i,
|
|
2397
2689
|
name: n,
|
|
2398
2690
|
read: async (t, n) => {
|
|
2399
|
-
let a =
|
|
2400
|
-
|
|
2691
|
+
let a = Math.min(t + n, i) - 1;
|
|
2692
|
+
if (a < t) return /* @__PURE__ */ new ArrayBuffer(0);
|
|
2693
|
+
let o = await fetch(e, {
|
|
2694
|
+
headers: { Range: `bytes=${t}-${a}` },
|
|
2401
2695
|
credentials: r
|
|
2402
2696
|
});
|
|
2403
|
-
if (!
|
|
2404
|
-
return
|
|
2697
|
+
if (!o.ok) throw Error(`The source could not be read: HTTP ${o.status}`);
|
|
2698
|
+
return o.arrayBuffer();
|
|
2405
2699
|
}
|
|
2406
2700
|
};
|
|
2407
|
-
},
|
|
2408
|
-
if ("blob" in e) return
|
|
2409
|
-
if ("url" in e) return
|
|
2701
|
+
}, Jt = async (e) => {
|
|
2702
|
+
if ("blob" in e) return Gt(e);
|
|
2703
|
+
if ("url" in e) return qt(e);
|
|
2410
2704
|
if ("read" in e) return {
|
|
2411
2705
|
length: e.length,
|
|
2412
2706
|
name: e.name,
|
|
@@ -2415,4 +2709,4 @@ ${Z}
|
|
|
2415
2709
|
throw Error(`Unknown source type: ${e}`);
|
|
2416
2710
|
};
|
|
2417
2711
|
//#endregion
|
|
2418
|
-
export {
|
|
2712
|
+
export { Ht as MediaPlayer, Ht as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, Jt as inputToRemuxerInput, Wt as isDelegatedTracks, Ut as isExternalThumbnails, V as sourceFeature, i as startPlayback, de as usePictureInPicture, U as usePlayer, ue as useSeekThumbnails };
|