@banou/media-player 0.8.10 → 0.8.11
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/index.d.ts +1 -1
- package/dist/index.js +475 -302
- package/dist/react/components/errors.d.ts +15 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +36 -0
- package/package.json +1 -1
- package/src/lib/index.tsx +1 -1
- package/src/lib/react/components/control-bar.tsx +4 -2
- package/src/lib/react/components/errors.tsx +194 -0
- package/src/lib/react/components/track-menu.tsx +2 -2
- package/src/lib/react/hooks/use-playback.ts +87 -20
- package/src/lib/react/source-feature.ts +29 -0
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ 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 {
|
|
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 ee, Volume1 as te, Volume2 as ne, VolumeX as re } from "react-feather";
|
|
8
|
+
import { Tooltip as ie } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var ae = {
|
|
11
11
|
indexes: [],
|
|
12
12
|
thumbnails: [],
|
|
13
13
|
subtitleTracks: [],
|
|
@@ -22,21 +22,22 @@ var re = {
|
|
|
22
22
|
pictureInPictureMode: null,
|
|
23
23
|
burnedInSubtitles: !1,
|
|
24
24
|
playbackError: null,
|
|
25
|
+
playbackErrors: [],
|
|
25
26
|
ready: !1,
|
|
26
27
|
setSourceState: () => {}
|
|
27
|
-
},
|
|
28
|
+
}, F = b({
|
|
28
29
|
name: "source",
|
|
29
|
-
state: () => ({ ...
|
|
30
|
+
state: () => ({ ...ae }),
|
|
30
31
|
attach({ set: e }) {
|
|
31
32
|
e({
|
|
32
33
|
setSourceState: (t) => e(t),
|
|
33
34
|
setHideUI: (t) => e({ hideUI: t })
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
}),
|
|
37
|
-
features: [...x,
|
|
37
|
+
}), I = _({
|
|
38
|
+
features: [...x, F],
|
|
38
39
|
displayName: "MediaPlayer"
|
|
39
|
-
}),
|
|
40
|
+
}), L = I.usePlayer, oe = (e) => {
|
|
40
41
|
if (!(!e || e === "und")) try {
|
|
41
42
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
42
43
|
type: "language",
|
|
@@ -45,53 +46,69 @@ var re = {
|
|
|
45
46
|
} catch {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
},
|
|
49
|
-
let t = e.map((e) =>
|
|
49
|
+
}, se = (e) => e?.replace(/_/g, " ").trim() || void 0, ce = (e) => {
|
|
50
|
+
let t = e.map((e) => oe(e.language) ?? se(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
50
51
|
...e,
|
|
51
52
|
[t]: (e[t] ?? 0) + 1
|
|
52
53
|
}), {});
|
|
53
54
|
return e.map((e, r) => {
|
|
54
|
-
let i = t[r], a =
|
|
55
|
+
let i = t[r], a = se(e.title);
|
|
55
56
|
return {
|
|
56
57
|
track: e,
|
|
57
58
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
58
59
|
};
|
|
59
60
|
});
|
|
60
|
-
},
|
|
61
|
+
}, le = (e) => ce(e).map(({ track: e, label: t }) => ({
|
|
61
62
|
id: e.streamIndex,
|
|
62
63
|
label: t
|
|
63
|
-
})),
|
|
64
|
-
|
|
64
|
+
})), ue = [
|
|
65
|
+
0,
|
|
66
|
+
250,
|
|
67
|
+
1e3,
|
|
68
|
+
3e3,
|
|
69
|
+
1e4
|
|
70
|
+
], de = 6e4, R = (e) => e instanceof Error ? e.message : String(e), fe = (e) => {
|
|
71
|
+
let t = [], n = e?.cause;
|
|
72
|
+
for (let e = 0; n != null && e < 8; e++) {
|
|
73
|
+
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
74
|
+
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
t.push(R(n)), n = n?.cause;
|
|
78
|
+
}
|
|
79
|
+
return t.length ? t.join("\n") : void 0;
|
|
80
|
+
}, pe = (e, t, r) => {
|
|
81
|
+
let a = L(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1 } = r ?? {}, [b, x] = m(void 0), [S, C] = m(0), w = p({
|
|
65
82
|
count: 0,
|
|
66
83
|
at: 0
|
|
67
|
-
});
|
|
68
|
-
d(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, [s]);
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
let
|
|
84
|
+
}), T = p(void 0);
|
|
85
|
+
d(() => (w.current = {
|
|
86
|
+
count: 0,
|
|
87
|
+
at: 0
|
|
88
|
+
}, a.setSourceState({ playbackErrors: [] }), () => {
|
|
89
|
+
T.current && clearTimeout(T.current);
|
|
90
|
+
}), [s]);
|
|
91
|
+
let E = p(null), D = p(null), O = p(!1), k = p(o);
|
|
92
|
+
k.current = o;
|
|
93
|
+
let A = p(r?.onSeek);
|
|
94
|
+
A.current = r?.onSeek;
|
|
95
|
+
let j = p(r?.onPlaybackError);
|
|
96
|
+
j.current = r?.onPlaybackError;
|
|
97
|
+
let M = u((e) => {
|
|
81
98
|
let t = typeof e == "number" ? e : void 0;
|
|
82
|
-
|
|
83
|
-
}, [a]),
|
|
99
|
+
O.current = !0, a.setSourceState({ selectedSubtitleTrack: t }), E.current?.selectSubtitleStream(t);
|
|
100
|
+
}, [a]), N = u((e) => {
|
|
84
101
|
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), x(e));
|
|
85
|
-
}, [a]),
|
|
102
|
+
}, [a]), P = L((e) => e.setSourceState);
|
|
86
103
|
d(() => {
|
|
87
|
-
|
|
88
|
-
selectSubtitleTrack:
|
|
89
|
-
selectAudioTrack:
|
|
104
|
+
P({
|
|
105
|
+
selectSubtitleTrack: M,
|
|
106
|
+
selectAudioTrack: N
|
|
90
107
|
});
|
|
91
108
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
P,
|
|
110
|
+
M,
|
|
111
|
+
N
|
|
95
112
|
]), d(() => {
|
|
96
113
|
if (!e || !t || !s || !o) return;
|
|
97
114
|
let r = !1;
|
|
@@ -99,30 +116,39 @@ var re = {
|
|
|
99
116
|
playbackError: null,
|
|
100
117
|
ready: !1
|
|
101
118
|
});
|
|
102
|
-
let u = (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
let u = (t, n) => {
|
|
120
|
+
let r = {
|
|
121
|
+
at: Date.now(),
|
|
122
|
+
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
123
|
+
message: R(t),
|
|
124
|
+
detail: fe(t),
|
|
125
|
+
recovered: n
|
|
126
|
+
};
|
|
127
|
+
a.setSourceState({ playbackErrors: [...a.playbackErrors, r] });
|
|
128
|
+
}, d = (e) => {
|
|
129
|
+
if (r) return;
|
|
130
|
+
let t = n(e);
|
|
131
|
+
if (u(e, t), t) {
|
|
132
|
+
let t = performance.now();
|
|
133
|
+
t - w.current.at > de && (w.current = {
|
|
134
|
+
count: 0,
|
|
135
|
+
at: t
|
|
136
|
+
});
|
|
137
|
+
let n = ue[Math.min(w.current.count, ue.length - 1)];
|
|
138
|
+
w.current = {
|
|
139
|
+
count: w.current.count + 1,
|
|
140
|
+
at: t
|
|
141
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), T.current && clearTimeout(T.current), T.current = setTimeout(() => C((e) => e + 1), n);
|
|
142
|
+
return;
|
|
118
143
|
}
|
|
144
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), j.current?.(e);
|
|
119
145
|
};
|
|
120
146
|
return (async () => {
|
|
121
147
|
try {
|
|
122
148
|
let n = await i({
|
|
123
149
|
videoElement: e,
|
|
124
150
|
canvasElement: t,
|
|
125
|
-
read: (e, t) =>
|
|
151
|
+
read: (e, t) => k.current(e, t),
|
|
126
152
|
length: s,
|
|
127
153
|
publicPath: c,
|
|
128
154
|
libavWorkerUrl: l,
|
|
@@ -135,23 +161,23 @@ var re = {
|
|
|
135
161
|
onReady: () => {
|
|
136
162
|
if (r) return;
|
|
137
163
|
a.setSourceState({ ready: !0 });
|
|
138
|
-
let t =
|
|
139
|
-
|
|
164
|
+
let t = D.current;
|
|
165
|
+
D.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
140
166
|
},
|
|
141
|
-
onError:
|
|
167
|
+
onError: d,
|
|
142
168
|
onRecovered: () => {
|
|
143
169
|
r || a.setSourceState({ playbackError: null });
|
|
144
170
|
},
|
|
145
|
-
onSeek: (e) =>
|
|
171
|
+
onSeek: (e) => A.current?.(e),
|
|
146
172
|
onSubtitleStreams: (e) => {
|
|
147
173
|
r || a.setSourceState({
|
|
148
|
-
subtitleTracks:
|
|
149
|
-
...
|
|
174
|
+
subtitleTracks: le(e),
|
|
175
|
+
...O.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
150
176
|
});
|
|
151
177
|
},
|
|
152
178
|
onAudioStreams: (e, t) => {
|
|
153
179
|
r || a.setSourceState({
|
|
154
|
-
audioTracks:
|
|
180
|
+
audioTracks: le(e),
|
|
155
181
|
selectedAudioTrack: t
|
|
156
182
|
});
|
|
157
183
|
}
|
|
@@ -160,17 +186,17 @@ var re = {
|
|
|
160
186
|
n.destroy();
|
|
161
187
|
return;
|
|
162
188
|
}
|
|
163
|
-
|
|
189
|
+
E.current = n, a.setSourceState({ indexes: n.indexes });
|
|
164
190
|
let o = a.selectedSubtitleTrack;
|
|
165
191
|
typeof o == "number" && n.selectSubtitleStream(o);
|
|
166
192
|
} catch (e) {
|
|
167
|
-
|
|
193
|
+
d(e);
|
|
168
194
|
}
|
|
169
195
|
})(), () => {
|
|
170
|
-
r = !0,
|
|
196
|
+
r = !0, D.current = {
|
|
171
197
|
time: e.currentTime,
|
|
172
198
|
size: s
|
|
173
|
-
},
|
|
199
|
+
}, E.current?.destroy(), E.current = null, a.setSourceState({ ready: !1 });
|
|
174
200
|
};
|
|
175
201
|
}, [
|
|
176
202
|
a,
|
|
@@ -188,13 +214,13 @@ var re = {
|
|
|
188
214
|
y,
|
|
189
215
|
S
|
|
190
216
|
]);
|
|
191
|
-
},
|
|
217
|
+
}, me = 5e3, he = 6e4, z = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
192
218
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
193
219
|
l.current = i;
|
|
194
220
|
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
195
221
|
return h.current = u, d(() => {
|
|
196
222
|
if (!n || !i || !e || !t) return;
|
|
197
|
-
let a = !1, o = null, u, d =
|
|
223
|
+
let a = !1, o = null, u, d = me, f = () => {
|
|
198
224
|
r({
|
|
199
225
|
publicPath: e,
|
|
200
226
|
workerUrl: t,
|
|
@@ -210,7 +236,7 @@ var re = {
|
|
|
210
236
|
}
|
|
211
237
|
o = e, c.current = e, e.update(h.current);
|
|
212
238
|
}, () => {
|
|
213
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
239
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, he));
|
|
214
240
|
});
|
|
215
241
|
};
|
|
216
242
|
return f(), () => {
|
|
@@ -223,7 +249,7 @@ var re = {
|
|
|
223
249
|
]), d(() => {
|
|
224
250
|
c.current?.update(u);
|
|
225
251
|
}, [u]), o;
|
|
226
|
-
},
|
|
252
|
+
}, B = (e, n) => {
|
|
227
253
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
228
254
|
d(() => {
|
|
229
255
|
if (!e || !n || !s) return;
|
|
@@ -251,7 +277,7 @@ var re = {
|
|
|
251
277
|
mode: s,
|
|
252
278
|
burnedIn: i
|
|
253
279
|
};
|
|
254
|
-
},
|
|
280
|
+
}, V = {
|
|
255
281
|
headings: {
|
|
256
282
|
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 ",
|
|
257
283
|
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 ",
|
|
@@ -278,14 +304,14 @@ var re = {
|
|
|
278
304
|
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 ",
|
|
279
305
|
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 "
|
|
280
306
|
}
|
|
281
|
-
},
|
|
307
|
+
}, ge = h`
|
|
282
308
|
top: unset !important;
|
|
283
309
|
left: unset !important;
|
|
284
310
|
width: 100%;
|
|
285
311
|
height: 100%;
|
|
286
312
|
margin: auto;
|
|
287
313
|
pointer-events: none;
|
|
288
|
-
`,
|
|
314
|
+
`, _e = h`
|
|
289
315
|
position: absolute;
|
|
290
316
|
top: 0;
|
|
291
317
|
left: 0;
|
|
@@ -293,7 +319,7 @@ var re = {
|
|
|
293
319
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
294
320
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
295
321
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
296
|
-
${
|
|
322
|
+
${V.headings.small}
|
|
297
323
|
color: white;
|
|
298
324
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
299
325
|
z-index: 2;
|
|
@@ -314,7 +340,7 @@ var re = {
|
|
|
314
340
|
|
|
315
341
|
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%);
|
|
316
342
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
317
|
-
`,
|
|
343
|
+
`, ve = h`
|
|
318
344
|
position: absolute;
|
|
319
345
|
inset: 0;
|
|
320
346
|
z-index: 2;
|
|
@@ -334,43 +360,43 @@ var re = {
|
|
|
334
360
|
to { transform: rotate(360deg); }
|
|
335
361
|
`} 0.8s linear infinite;
|
|
336
362
|
}
|
|
337
|
-
`,
|
|
363
|
+
`, ye = h`
|
|
338
364
|
position: absolute;
|
|
339
365
|
inset: auto 0 20%;
|
|
340
366
|
z-index: 3;
|
|
341
367
|
padding: 0 calc(2 * var(--mp-unit));
|
|
342
368
|
text-align: center;
|
|
343
369
|
color: #fff;
|
|
344
|
-
${
|
|
370
|
+
${V.bLarge.regular}
|
|
345
371
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
346
372
|
pointer-events: none;
|
|
347
|
-
`,
|
|
348
|
-
let t =
|
|
373
|
+
`, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
|
|
374
|
+
let t = L((e) => e.title), n = L((e) => e.hideUI), r = L((e) => e.playbackError), i = L((e) => e.ready), a = L((e) => e.size), o = L((e) => e.waiting);
|
|
349
375
|
return /* @__PURE__ */ w(S, { children: [
|
|
350
376
|
t ? /* @__PURE__ */ C("div", {
|
|
351
377
|
className: "title",
|
|
352
|
-
css:
|
|
378
|
+
css: _e,
|
|
353
379
|
style: { ...n ? {
|
|
354
380
|
opacity: "0",
|
|
355
381
|
pointerEvents: "none"
|
|
356
382
|
} : {} },
|
|
357
383
|
children: t
|
|
358
384
|
}) : void 0,
|
|
359
|
-
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css:
|
|
385
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: ve }) : void 0,
|
|
360
386
|
r ? /* @__PURE__ */ C("div", {
|
|
361
|
-
css:
|
|
362
|
-
children:
|
|
387
|
+
css: ye,
|
|
388
|
+
children: be(r)
|
|
363
389
|
}) : void 0,
|
|
364
390
|
/* @__PURE__ */ C("canvas", {
|
|
365
391
|
ref: e,
|
|
366
|
-
css:
|
|
392
|
+
css: ge
|
|
367
393
|
})
|
|
368
394
|
] });
|
|
369
|
-
},
|
|
395
|
+
}, H = 1e-4, U = 1, W = (e) => Math.max(H, Math.min(U, e)) ** 2, G = (e) => Math.max(H, Math.min(U, e)) ** (U / 2), K = (e) => {
|
|
370
396
|
if (e === void 0) return "0:00";
|
|
371
397
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
372
398
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
373
|
-
},
|
|
399
|
+
}, Se = (e, t) => `${K(e)} / ${K(t)}`, Ce = (e) => h`
|
|
374
400
|
display: flex;
|
|
375
401
|
justify-content: flex-end;
|
|
376
402
|
|
|
@@ -380,7 +406,7 @@ var re = {
|
|
|
380
406
|
z-index: 3;
|
|
381
407
|
|
|
382
408
|
* {
|
|
383
|
-
${
|
|
409
|
+
${V.bMedium.regular}
|
|
384
410
|
}
|
|
385
411
|
|
|
386
412
|
${e === "sm" && h`
|
|
@@ -392,7 +418,7 @@ var re = {
|
|
|
392
418
|
${e === "lg" && h`
|
|
393
419
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
394
420
|
`}
|
|
395
|
-
`,
|
|
421
|
+
`, q = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
|
|
396
422
|
"data-tooltip-id": e,
|
|
397
423
|
"data-open": !0,
|
|
398
424
|
"data-tooltip-offset": a,
|
|
@@ -400,12 +426,12 @@ var re = {
|
|
|
400
426
|
"data-tooltip-delay-hide": i,
|
|
401
427
|
"data-tooltip-place": o,
|
|
402
428
|
children: n
|
|
403
|
-
}), !s && /* @__PURE__ */ C(
|
|
404
|
-
css:
|
|
429
|
+
}), !s && /* @__PURE__ */ C(ie, {
|
|
430
|
+
css: Ce(c),
|
|
405
431
|
id: e,
|
|
406
432
|
noArrow: !0,
|
|
407
433
|
children: t
|
|
408
|
-
})] }),
|
|
434
|
+
})] }), J = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
409
435
|
let [i, a] = m(!1), o = p(t);
|
|
410
436
|
o.current = t;
|
|
411
437
|
let s = p(null), c = u((t, r) => {
|
|
@@ -432,7 +458,7 @@ var re = {
|
|
|
432
458
|
style: { touchAction: "none" }
|
|
433
459
|
}
|
|
434
460
|
};
|
|
435
|
-
},
|
|
461
|
+
}, we = h`
|
|
436
462
|
position: relative;
|
|
437
463
|
height: calc(.4 * var(--mp-unit));
|
|
438
464
|
|
|
@@ -486,7 +512,7 @@ var re = {
|
|
|
486
512
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
487
513
|
|
|
488
514
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
489
|
-
${
|
|
515
|
+
${V.bMedium.bold}
|
|
490
516
|
|
|
491
517
|
position: absolute;
|
|
492
518
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -603,8 +629,8 @@ var re = {
|
|
|
603
629
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
604
630
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
605
631
|
}
|
|
606
|
-
`,
|
|
607
|
-
let e =
|
|
632
|
+
`, Te = () => {
|
|
633
|
+
let e = L(), t = L((e) => e.currentTime), n = L((e) => e.duration), r = L((e) => e.size), i = L((e) => e.downloadedRanges), a = L((e) => e.indexes), o = L((e) => e.thumbnails), s = L((e) => e.thumbnailAt), c = p(null), [l, u] = m(void 0), [h, g] = m(void 0), _ = p(void 0), { dragging: v, handlers: y } = J({
|
|
608
634
|
ref: c,
|
|
609
635
|
onChange: (e) => {
|
|
610
636
|
u(e), _.current !== "mouse" && g(e * n);
|
|
@@ -662,7 +688,7 @@ var re = {
|
|
|
662
688
|
h
|
|
663
689
|
]);
|
|
664
690
|
return /* @__PURE__ */ w("div", {
|
|
665
|
-
css:
|
|
691
|
+
css: we,
|
|
666
692
|
ref: c,
|
|
667
693
|
className: v ? "progress-bar dragging" : "progress-bar",
|
|
668
694
|
onMouseMove: T,
|
|
@@ -703,7 +729,7 @@ var re = {
|
|
|
703
729
|
})
|
|
704
730
|
]
|
|
705
731
|
});
|
|
706
|
-
},
|
|
732
|
+
}, Ee = "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 = {
|
|
707
733
|
xmlns: "http://www.w3.org/2000/svg",
|
|
708
734
|
width: 24,
|
|
709
735
|
height: 24,
|
|
@@ -713,8 +739,8 @@ var re = {
|
|
|
713
739
|
strokeWidth: 2,
|
|
714
740
|
strokeLinecap: "round",
|
|
715
741
|
strokeLinejoin: "round"
|
|
716
|
-
},
|
|
717
|
-
...
|
|
742
|
+
}, De = (e) => /* @__PURE__ */ w("svg", {
|
|
743
|
+
...Y,
|
|
718
744
|
...e,
|
|
719
745
|
children: [/* @__PURE__ */ C("rect", {
|
|
720
746
|
x: "3",
|
|
@@ -724,8 +750,8 @@ var re = {
|
|
|
724
750
|
rx: "2",
|
|
725
751
|
ry: "2"
|
|
726
752
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
727
|
-
}),
|
|
728
|
-
...
|
|
753
|
+
}), Oe = (e) => /* @__PURE__ */ w("svg", {
|
|
754
|
+
...Y,
|
|
729
755
|
...e,
|
|
730
756
|
children: [
|
|
731
757
|
/* @__PURE__ */ C("rect", {
|
|
@@ -744,8 +770,8 @@ var re = {
|
|
|
744
770
|
y2: "22"
|
|
745
771
|
})
|
|
746
772
|
]
|
|
747
|
-
}),
|
|
748
|
-
...
|
|
773
|
+
}), ke = (e) => /* @__PURE__ */ w("svg", {
|
|
774
|
+
...Y,
|
|
749
775
|
...e,
|
|
750
776
|
children: [
|
|
751
777
|
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -759,95 +785,7 @@ var re = {
|
|
|
759
785
|
}),
|
|
760
786
|
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
761
787
|
]
|
|
762
|
-
}),
|
|
763
|
-
display: flex;
|
|
764
|
-
align-items: center;
|
|
765
|
-
justify-content: center;
|
|
766
|
-
flex-direction: column;
|
|
767
|
-
width: 100%;
|
|
768
|
-
|
|
769
|
-
.playback-slider {
|
|
770
|
-
display: flex;
|
|
771
|
-
align-items: center;
|
|
772
|
-
|
|
773
|
-
padding: 8px 4px;
|
|
774
|
-
margin: 0 2px;
|
|
775
|
-
/* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
|
|
776
|
-
@media (pointer: coarse) {
|
|
777
|
-
padding: 20px 8px;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
cursor: pointer;
|
|
781
|
-
|
|
782
|
-
> div {
|
|
783
|
-
position: relative;
|
|
784
|
-
|
|
785
|
-
background: #ccc;
|
|
786
|
-
border-radius: 4px;
|
|
787
|
-
|
|
788
|
-
width: 120px;
|
|
789
|
-
max-width: 100%;
|
|
790
|
-
height: 3px;
|
|
791
|
-
@media (min-width: 768px) {
|
|
792
|
-
height: 4px;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
.playback-handle {
|
|
797
|
-
position: absolute;
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
background: #ffffff;
|
|
801
|
-
border-radius: 50%;
|
|
802
|
-
transform: translateX(-50%);
|
|
803
|
-
pointer-events: none;
|
|
804
|
-
|
|
805
|
-
width: 10px;
|
|
806
|
-
height: 10px;
|
|
807
|
-
top: -3.5px;
|
|
808
|
-
@media (min-width: 768px) {
|
|
809
|
-
width: 12px;
|
|
810
|
-
height: 12px;
|
|
811
|
-
top: -4px;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
`, De = () => {
|
|
816
|
-
let e = I(), t = I((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 } = q({
|
|
817
|
-
ref: r,
|
|
818
|
-
onChange: (t) => e.setPlaybackRate(l(t))
|
|
819
|
-
}), f = (t) => {
|
|
820
|
-
t.preventDefault();
|
|
821
|
-
let n = .05, r = s;
|
|
822
|
-
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
823
|
-
};
|
|
824
|
-
d(() => {
|
|
825
|
-
let e = n.current;
|
|
826
|
-
return e && e.addEventListener("wheel", f, { passive: !1 }), () => {
|
|
827
|
-
e && e.removeEventListener("wheel", f);
|
|
828
|
-
};
|
|
829
|
-
}, [t]);
|
|
830
|
-
let m = c(s);
|
|
831
|
-
return /* @__PURE__ */ w("div", {
|
|
832
|
-
css: Ee,
|
|
833
|
-
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
834
|
-
className: "playback-slider",
|
|
835
|
-
ref: n,
|
|
836
|
-
...u,
|
|
837
|
-
children: /* @__PURE__ */ C("div", {
|
|
838
|
-
ref: r,
|
|
839
|
-
style: { background: `linear-gradient(to right,
|
|
840
|
-
#fff 0% ${m}%,
|
|
841
|
-
#3A3A3A ${m}% 100%
|
|
842
|
-
)` },
|
|
843
|
-
children: /* @__PURE__ */ C("div", {
|
|
844
|
-
className: "playback-handle",
|
|
845
|
-
style: { left: `${m}%` }
|
|
846
|
-
})
|
|
847
|
-
})
|
|
848
|
-
})]
|
|
849
|
-
});
|
|
850
|
-
}, Y = h`
|
|
788
|
+
}), X = h`
|
|
851
789
|
.popover {
|
|
852
790
|
position: absolute;
|
|
853
791
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -886,7 +824,7 @@ width: 100%;
|
|
|
886
824
|
|
|
887
825
|
border-radius: 8px;
|
|
888
826
|
background-color: rgba(28,28,28,0.95);
|
|
889
|
-
${
|
|
827
|
+
${V.bMedium.regular}
|
|
890
828
|
|
|
891
829
|
z-index: 4;
|
|
892
830
|
|
|
@@ -915,10 +853,10 @@ width: 100%;
|
|
|
915
853
|
:last-of-type {
|
|
916
854
|
border-radius: 0 0 8px 8px;
|
|
917
855
|
}
|
|
918
|
-
|
|
856
|
+
&:not(.no-hover) {
|
|
919
857
|
cursor: pointer;
|
|
920
858
|
}
|
|
921
|
-
|
|
859
|
+
&:not(.no-hover):hover {
|
|
922
860
|
background-color: rgba(255,255,255,.1);
|
|
923
861
|
}
|
|
924
862
|
|
|
@@ -929,7 +867,7 @@ width: 100%;
|
|
|
929
867
|
|
|
930
868
|
.secondary {
|
|
931
869
|
color: #eee;
|
|
932
|
-
${
|
|
870
|
+
${V.bSmall.regular}
|
|
933
871
|
}
|
|
934
872
|
}
|
|
935
873
|
}
|
|
@@ -971,10 +909,10 @@ width: 100%;
|
|
|
971
909
|
.failed {
|
|
972
910
|
border-bottom: 1px solid #4D4D4E;
|
|
973
911
|
color: #f66;
|
|
974
|
-
${
|
|
912
|
+
${V.bSmall.regular}
|
|
975
913
|
}
|
|
976
914
|
}
|
|
977
|
-
`,
|
|
915
|
+
`, Ae = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
978
916
|
let c = o !== void 0, l = (e, i, a) => {
|
|
979
917
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
980
918
|
return /* @__PURE__ */ w("div", {
|
|
@@ -991,7 +929,7 @@ width: 100%;
|
|
|
991
929
|
/* @__PURE__ */ w("div", {
|
|
992
930
|
className: i ? "back" : "back no-hover",
|
|
993
931
|
onClick: i,
|
|
994
|
-
children: [i ? /* @__PURE__ */ C(
|
|
932
|
+
children: [i ? /* @__PURE__ */ C(D, {}) : null, /* @__PURE__ */ C("span", { children: e })]
|
|
995
933
|
}),
|
|
996
934
|
s ? /* @__PURE__ */ C("div", {
|
|
997
935
|
className: "no-hover failed",
|
|
@@ -1042,7 +980,241 @@ width: 100%;
|
|
|
1042
980
|
});
|
|
1043
981
|
}
|
|
1044
982
|
};
|
|
1045
|
-
},
|
|
983
|
+
}, je = h`
|
|
984
|
+
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
985
|
+
which is the width of the player box, so it can be clamped to it. */
|
|
986
|
+
position: static;
|
|
987
|
+
|
|
988
|
+
.errors {
|
|
989
|
+
/* the icon keeps its size, the pressable box grows around it */
|
|
990
|
+
@media (pointer: coarse) {
|
|
991
|
+
box-sizing: border-box;
|
|
992
|
+
justify-content: center;
|
|
993
|
+
|
|
994
|
+
min-width: 44px;
|
|
995
|
+
min-height: 44px;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
${X}
|
|
1000
|
+
|
|
1001
|
+
.popover.error-list {
|
|
1002
|
+
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
1003
|
+
decoder message that has been ellipsized is not worth copying. */
|
|
1004
|
+
width: 420px;
|
|
1005
|
+
max-height: min(300px, calc(100cqh - 100% - 16px));
|
|
1006
|
+
|
|
1007
|
+
/* track-menu's header is a left-aligned label row; here it carries a control too, so the two
|
|
1008
|
+
ends go to the two ends */
|
|
1009
|
+
.back {
|
|
1010
|
+
justify-content: space-between;
|
|
1011
|
+
gap: 8px;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
.copy {
|
|
1015
|
+
/* sits in the header row, which track-menu styles as .back */
|
|
1016
|
+
display: flex;
|
|
1017
|
+
align-items: center;
|
|
1018
|
+
gap: 6px;
|
|
1019
|
+
|
|
1020
|
+
background: none;
|
|
1021
|
+
border: none;
|
|
1022
|
+
padding: 4px 6px;
|
|
1023
|
+
border-radius: 4px;
|
|
1024
|
+
|
|
1025
|
+
color: #fff;
|
|
1026
|
+
cursor: pointer;
|
|
1027
|
+
${V.bSmall.regular}
|
|
1028
|
+
|
|
1029
|
+
&:hover {
|
|
1030
|
+
background-color: rgba(255,255,255,.1);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
svg {
|
|
1034
|
+
width: 14px;
|
|
1035
|
+
height: 14px;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
.entry {
|
|
1040
|
+
/* one failure is a block of text, so it stacks instead of sitting on one line */
|
|
1041
|
+
display: flex;
|
|
1042
|
+
flex-direction: column;
|
|
1043
|
+
align-items: flex-start;
|
|
1044
|
+
gap: 2px;
|
|
1045
|
+
|
|
1046
|
+
.when {
|
|
1047
|
+
color: #bbb;
|
|
1048
|
+
${V.bSmall.regular}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.what {
|
|
1052
|
+
/* the decoder's own words, which are long and must not be cut */
|
|
1053
|
+
overflow-wrap: anywhere;
|
|
1054
|
+
white-space: pre-wrap;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
.cause {
|
|
1058
|
+
color: #ddd;
|
|
1059
|
+
overflow-wrap: anywhere;
|
|
1060
|
+
white-space: pre-wrap;
|
|
1061
|
+
${V.bSmall.regular}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
`, Me = (e) => new Date(e).toLocaleTimeString(), Q = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : K(Math.max(0, e)), Ne = (e) => e.map((e, t) => {
|
|
1066
|
+
let n = Q(e.atMediaTime);
|
|
1067
|
+
return [
|
|
1068
|
+
`${t + 1}. ${new Date(e.at).toISOString()}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1069
|
+
e.message,
|
|
1070
|
+
e.detail
|
|
1071
|
+
].filter(Boolean).join("\n");
|
|
1072
|
+
}).join("\n\n"), Pe = () => {
|
|
1073
|
+
let e = L((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
|
|
1074
|
+
if (e.length === 0) return null;
|
|
1075
|
+
let o = () => {
|
|
1076
|
+
navigator.clipboard?.writeText(Ne(e)).then(() => {
|
|
1077
|
+
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1078
|
+
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1079
|
+
}, s = `Playback errors (${e.length})`;
|
|
1080
|
+
return /* @__PURE__ */ w("div", {
|
|
1081
|
+
css: je,
|
|
1082
|
+
ref: r,
|
|
1083
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1084
|
+
id: "errors",
|
|
1085
|
+
disabled: t,
|
|
1086
|
+
text: /* @__PURE__ */ C("button", {
|
|
1087
|
+
className: "errors",
|
|
1088
|
+
type: "button",
|
|
1089
|
+
onClick: n,
|
|
1090
|
+
"aria-label": s,
|
|
1091
|
+
"aria-expanded": t,
|
|
1092
|
+
children: /* @__PURE__ */ C(T, { className: "alert-triangle" })
|
|
1093
|
+
}),
|
|
1094
|
+
toolTipText: /* @__PURE__ */ C("span", { children: s })
|
|
1095
|
+
}), t && /* @__PURE__ */ w("div", {
|
|
1096
|
+
className: "popover error-list",
|
|
1097
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1098
|
+
className: "back no-hover",
|
|
1099
|
+
children: [/* @__PURE__ */ C("span", { children: s }), /* @__PURE__ */ w("button", {
|
|
1100
|
+
className: "copy",
|
|
1101
|
+
type: "button",
|
|
1102
|
+
onClick: o,
|
|
1103
|
+
"aria-label": "Copy the errors",
|
|
1104
|
+
children: [C(i ? E : k, {}), /* @__PURE__ */ C("span", { children: i ? "Copied" : "Copy" })]
|
|
1105
|
+
})]
|
|
1106
|
+
}), e.map((e, t) => /* @__PURE__ */ w("div", {
|
|
1107
|
+
className: "entry no-hover",
|
|
1108
|
+
children: [
|
|
1109
|
+
/* @__PURE__ */ w("span", {
|
|
1110
|
+
className: "when",
|
|
1111
|
+
children: [
|
|
1112
|
+
Me(e.at),
|
|
1113
|
+
Q(e.atMediaTime) ? ` at ${Q(e.atMediaTime)}` : "",
|
|
1114
|
+
e.recovered ? " recovered" : ""
|
|
1115
|
+
]
|
|
1116
|
+
}),
|
|
1117
|
+
/* @__PURE__ */ C("span", {
|
|
1118
|
+
className: "what",
|
|
1119
|
+
children: e.message
|
|
1120
|
+
}),
|
|
1121
|
+
e.detail ? /* @__PURE__ */ C("span", {
|
|
1122
|
+
className: "cause",
|
|
1123
|
+
children: e.detail
|
|
1124
|
+
}) : null
|
|
1125
|
+
]
|
|
1126
|
+
}, `${e.at}-${t}`))]
|
|
1127
|
+
})]
|
|
1128
|
+
});
|
|
1129
|
+
}, Fe = h`
|
|
1130
|
+
display: flex;
|
|
1131
|
+
align-items: center;
|
|
1132
|
+
justify-content: center;
|
|
1133
|
+
flex-direction: column;
|
|
1134
|
+
width: 100%;
|
|
1135
|
+
|
|
1136
|
+
.playback-slider {
|
|
1137
|
+
display: flex;
|
|
1138
|
+
align-items: center;
|
|
1139
|
+
|
|
1140
|
+
padding: 8px 4px;
|
|
1141
|
+
margin: 0 2px;
|
|
1142
|
+
/* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
|
|
1143
|
+
@media (pointer: coarse) {
|
|
1144
|
+
padding: 20px 8px;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
cursor: pointer;
|
|
1148
|
+
|
|
1149
|
+
> div {
|
|
1150
|
+
position: relative;
|
|
1151
|
+
|
|
1152
|
+
background: #ccc;
|
|
1153
|
+
border-radius: 4px;
|
|
1154
|
+
|
|
1155
|
+
width: 120px;
|
|
1156
|
+
max-width: 100%;
|
|
1157
|
+
height: 3px;
|
|
1158
|
+
@media (min-width: 768px) {
|
|
1159
|
+
height: 4px;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.playback-handle {
|
|
1164
|
+
position: absolute;
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
background: #ffffff;
|
|
1168
|
+
border-radius: 50%;
|
|
1169
|
+
transform: translateX(-50%);
|
|
1170
|
+
pointer-events: none;
|
|
1171
|
+
|
|
1172
|
+
width: 10px;
|
|
1173
|
+
height: 10px;
|
|
1174
|
+
top: -3.5px;
|
|
1175
|
+
@media (min-width: 768px) {
|
|
1176
|
+
width: 12px;
|
|
1177
|
+
height: 12px;
|
|
1178
|
+
top: -4px;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
`, Ie = () => {
|
|
1183
|
+
let e = L(), t = L((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
|
+
ref: r,
|
|
1185
|
+
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1186
|
+
}), f = (t) => {
|
|
1187
|
+
t.preventDefault();
|
|
1188
|
+
let n = .05, r = s;
|
|
1189
|
+
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
1190
|
+
};
|
|
1191
|
+
d(() => {
|
|
1192
|
+
let e = n.current;
|
|
1193
|
+
return e && e.addEventListener("wheel", f, { passive: !1 }), () => {
|
|
1194
|
+
e && e.removeEventListener("wheel", f);
|
|
1195
|
+
};
|
|
1196
|
+
}, [t]);
|
|
1197
|
+
let m = c(s);
|
|
1198
|
+
return /* @__PURE__ */ w("div", {
|
|
1199
|
+
css: Fe,
|
|
1200
|
+
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1201
|
+
className: "playback-slider",
|
|
1202
|
+
ref: n,
|
|
1203
|
+
...u,
|
|
1204
|
+
children: /* @__PURE__ */ C("div", {
|
|
1205
|
+
ref: r,
|
|
1206
|
+
style: { background: `linear-gradient(to right,
|
|
1207
|
+
#fff 0% ${m}%,
|
|
1208
|
+
#3A3A3A ${m}% 100%
|
|
1209
|
+
)` },
|
|
1210
|
+
children: /* @__PURE__ */ C("div", {
|
|
1211
|
+
className: "playback-handle",
|
|
1212
|
+
style: { left: `${m}%` }
|
|
1213
|
+
})
|
|
1214
|
+
})
|
|
1215
|
+
})]
|
|
1216
|
+
});
|
|
1217
|
+
}, Le = h`
|
|
1046
1218
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1047
1219
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1048
1220
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1060,7 +1232,7 @@ position: static;
|
|
|
1060
1232
|
}
|
|
1061
1233
|
}
|
|
1062
1234
|
|
|
1063
|
-
${
|
|
1235
|
+
${X}
|
|
1064
1236
|
|
|
1065
1237
|
.playback-rate {
|
|
1066
1238
|
.slider {
|
|
@@ -1101,8 +1273,8 @@ ${Y}
|
|
|
1101
1273
|
}
|
|
1102
1274
|
}
|
|
1103
1275
|
|
|
1104
|
-
`,
|
|
1105
|
-
let e =
|
|
1276
|
+
`, Re = () => {
|
|
1277
|
+
let e = L(), t = L((e) => e.playbackRate), n = L((e) => e.audioTracks), r = L((e) => e.selectedAudioTrack), i = L((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) => {
|
|
1106
1278
|
e.setPlaybackRate(t), o(0);
|
|
1107
1279
|
}, h = (e) => {
|
|
1108
1280
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1110,10 +1282,10 @@ ${Y}
|
|
|
1110
1282
|
o(e);
|
|
1111
1283
|
};
|
|
1112
1284
|
return /* @__PURE__ */ w("div", {
|
|
1113
|
-
css:
|
|
1285
|
+
css: Le,
|
|
1114
1286
|
ref: l,
|
|
1115
1287
|
children: [
|
|
1116
|
-
/* @__PURE__ */ C(
|
|
1288
|
+
/* @__PURE__ */ C(q, {
|
|
1117
1289
|
id: "settings",
|
|
1118
1290
|
disabled: s,
|
|
1119
1291
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1122,7 +1294,7 @@ ${Y}
|
|
|
1122
1294
|
onClick: c,
|
|
1123
1295
|
"aria-label": "Settings",
|
|
1124
1296
|
"aria-expanded": s,
|
|
1125
|
-
children: /* @__PURE__ */ C(
|
|
1297
|
+
children: /* @__PURE__ */ C(ee, {})
|
|
1126
1298
|
}),
|
|
1127
1299
|
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1128
1300
|
}),
|
|
@@ -1130,13 +1302,13 @@ ${Y}
|
|
|
1130
1302
|
className: "popover menu",
|
|
1131
1303
|
children: [n.length > 1 ? /* @__PURE__ */ w("div", {
|
|
1132
1304
|
onClick: g(2),
|
|
1133
|
-
children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(
|
|
1305
|
+
children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(O, {}) })]
|
|
1134
1306
|
}) : null, /* @__PURE__ */ w("div", {
|
|
1135
1307
|
onClick: g(1),
|
|
1136
1308
|
children: [/* @__PURE__ */ C("div", { children: "Playback speed" }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("span", {
|
|
1137
1309
|
className: "secondary",
|
|
1138
1310
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
1139
|
-
}), /* @__PURE__ */ C(
|
|
1311
|
+
}), /* @__PURE__ */ C(O, {})] })]
|
|
1140
1312
|
})]
|
|
1141
1313
|
}),
|
|
1142
1314
|
s && a === 1 && /* @__PURE__ */ w("div", {
|
|
@@ -1145,11 +1317,11 @@ ${Y}
|
|
|
1145
1317
|
/* @__PURE__ */ w("div", {
|
|
1146
1318
|
className: "back",
|
|
1147
1319
|
onClick: g(0),
|
|
1148
|
-
children: [/* @__PURE__ */ C(
|
|
1320
|
+
children: [/* @__PURE__ */ C(D, {}), /* @__PURE__ */ C("span", { children: "Playback speed" })]
|
|
1149
1321
|
}),
|
|
1150
1322
|
/* @__PURE__ */ C("div", {
|
|
1151
1323
|
className: "slider no-hover",
|
|
1152
|
-
children: /* @__PURE__ */ C(
|
|
1324
|
+
children: /* @__PURE__ */ C(Ie, {})
|
|
1153
1325
|
}),
|
|
1154
1326
|
/* @__PURE__ */ w("div", {
|
|
1155
1327
|
className: "options no-hover",
|
|
@@ -1174,7 +1346,7 @@ ${Y}
|
|
|
1174
1346
|
})
|
|
1175
1347
|
]
|
|
1176
1348
|
}),
|
|
1177
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1349
|
+
s && a === 2 && /* @__PURE__ */ C(Ae, {
|
|
1178
1350
|
title: "Audio",
|
|
1179
1351
|
tracks: n,
|
|
1180
1352
|
selected: r,
|
|
@@ -1185,7 +1357,7 @@ ${Y}
|
|
|
1185
1357
|
})
|
|
1186
1358
|
]
|
|
1187
1359
|
});
|
|
1188
|
-
},
|
|
1360
|
+
}, ze = h`
|
|
1189
1361
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1190
1362
|
which is the width of the player box, so it can be clamped to it. */
|
|
1191
1363
|
position: static;
|
|
@@ -1201,15 +1373,15 @@ position: static;
|
|
|
1201
1373
|
}
|
|
1202
1374
|
}
|
|
1203
1375
|
|
|
1204
|
-
${
|
|
1205
|
-
`,
|
|
1206
|
-
let e =
|
|
1376
|
+
${X}
|
|
1377
|
+
`, Be = () => {
|
|
1378
|
+
let e = L((e) => e.subtitleTracks), t = L((e) => e.selectedSubtitleTrack), n = L((e) => e.selectSubtitleTrack), r = L((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
|
|
1207
1379
|
if (e.length === 0) return null;
|
|
1208
1380
|
let u = t !== void 0;
|
|
1209
1381
|
return /* @__PURE__ */ w("div", {
|
|
1210
|
-
css:
|
|
1382
|
+
css: ze,
|
|
1211
1383
|
ref: o,
|
|
1212
|
-
children: [/* @__PURE__ */ C(
|
|
1384
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1213
1385
|
id: "subtitles",
|
|
1214
1386
|
disabled: i,
|
|
1215
1387
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1219,10 +1391,10 @@ ${Y}
|
|
|
1219
1391
|
"aria-label": "Subtitles",
|
|
1220
1392
|
"aria-expanded": i,
|
|
1221
1393
|
"aria-pressed": u,
|
|
1222
|
-
children: u ? /* @__PURE__ */ C(
|
|
1394
|
+
children: u ? /* @__PURE__ */ C(De, { className: "captions" }) : /* @__PURE__ */ C(Oe, { className: "captions-off" })
|
|
1223
1395
|
}),
|
|
1224
1396
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1225
|
-
}), i && /* @__PURE__ */ C(
|
|
1397
|
+
}), i && /* @__PURE__ */ C(Ae, {
|
|
1226
1398
|
title: "Subtitles",
|
|
1227
1399
|
tracks: e,
|
|
1228
1400
|
selected: t,
|
|
@@ -1232,14 +1404,14 @@ ${Y}
|
|
|
1232
1404
|
failed: c
|
|
1233
1405
|
})]
|
|
1234
1406
|
});
|
|
1235
|
-
},
|
|
1407
|
+
}, Ve = {
|
|
1236
1408
|
primary: "#EAEBEE",
|
|
1237
1409
|
secondary: "#D0D0D9",
|
|
1238
1410
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1239
1411
|
accent: "#6EA8FE",
|
|
1240
1412
|
borderPrimary: "#384F70",
|
|
1241
1413
|
backgroundTooltip: "#222222"
|
|
1242
|
-
},
|
|
1414
|
+
}, He = h`
|
|
1243
1415
|
display: flex;
|
|
1244
1416
|
align-items: center;
|
|
1245
1417
|
|
|
@@ -1282,8 +1454,8 @@ ${Y}
|
|
|
1282
1454
|
width: 10px;
|
|
1283
1455
|
height: 10px;
|
|
1284
1456
|
}
|
|
1285
|
-
`,
|
|
1286
|
-
let n =
|
|
1457
|
+
`, Ue = ({ value: e, onChange: t }) => {
|
|
1458
|
+
let n = L((e) => e.volume), r = L((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
|
|
1287
1459
|
ref: a,
|
|
1288
1460
|
onChange: t
|
|
1289
1461
|
}), s = (n) => {
|
|
@@ -1297,12 +1469,12 @@ ${Y}
|
|
|
1297
1469
|
e && e.removeEventListener("wheel", s);
|
|
1298
1470
|
};
|
|
1299
1471
|
}, [e]);
|
|
1300
|
-
let c = e * 100, l = f(() => Math.round(r ? 0 :
|
|
1301
|
-
return /* @__PURE__ */ C(
|
|
1472
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
|
|
1473
|
+
return /* @__PURE__ */ C(q, {
|
|
1302
1474
|
id: "volume-slider",
|
|
1303
1475
|
text: /* @__PURE__ */ C("div", {
|
|
1304
1476
|
ref: i,
|
|
1305
|
-
css:
|
|
1477
|
+
css: He,
|
|
1306
1478
|
...o,
|
|
1307
1479
|
children: /* @__PURE__ */ C("div", {
|
|
1308
1480
|
ref: a,
|
|
@@ -1321,7 +1493,7 @@ ${Y}
|
|
|
1321
1493
|
children: [l, "%"]
|
|
1322
1494
|
})
|
|
1323
1495
|
});
|
|
1324
|
-
},
|
|
1496
|
+
}, We = h`
|
|
1325
1497
|
position: relative;
|
|
1326
1498
|
display: flex;
|
|
1327
1499
|
align-items: center;
|
|
@@ -1346,7 +1518,7 @@ ${Y}
|
|
|
1346
1518
|
border-radius: 4px;
|
|
1347
1519
|
|
|
1348
1520
|
.volume-value {
|
|
1349
|
-
${
|
|
1521
|
+
${V.bMedium.regular};
|
|
1350
1522
|
color: #ffffff;
|
|
1351
1523
|
}
|
|
1352
1524
|
}
|
|
@@ -1384,11 +1556,11 @@ ${Y}
|
|
|
1384
1556
|
}
|
|
1385
1557
|
}
|
|
1386
1558
|
|
|
1387
|
-
`,
|
|
1388
|
-
let t =
|
|
1559
|
+
`, Ge = ({ ref: e }) => {
|
|
1560
|
+
let t = L(), n = L((e) => e.volume), r = L((e) => e.muted), i = f(() => G(n), [n]);
|
|
1389
1561
|
return /* @__PURE__ */ w("div", {
|
|
1390
|
-
css:
|
|
1391
|
-
children: [/* @__PURE__ */ C(
|
|
1562
|
+
css: We,
|
|
1563
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1392
1564
|
id: "sound",
|
|
1393
1565
|
text: /* @__PURE__ */ C("button", {
|
|
1394
1566
|
className: "sound",
|
|
@@ -1397,7 +1569,7 @@ ${Y}
|
|
|
1397
1569
|
ref: e,
|
|
1398
1570
|
"aria-label": "Mute",
|
|
1399
1571
|
"aria-pressed": r || n === 0,
|
|
1400
|
-
children: C(r || n === 0 ?
|
|
1572
|
+
children: C(r || n === 0 ? re : n <= .5 ? te : ne, {
|
|
1401
1573
|
size: 18,
|
|
1402
1574
|
color: "#fff"
|
|
1403
1575
|
})
|
|
@@ -1407,16 +1579,16 @@ ${Y}
|
|
|
1407
1579
|
className: "volume-slider-container",
|
|
1408
1580
|
children: /* @__PURE__ */ C("div", {
|
|
1409
1581
|
className: "volume-slider-background",
|
|
1410
|
-
children: /* @__PURE__ */ C(
|
|
1582
|
+
children: /* @__PURE__ */ C(Ue, {
|
|
1411
1583
|
value: r ? 0 : i,
|
|
1412
1584
|
onChange: (e) => {
|
|
1413
|
-
t.setVolume(
|
|
1585
|
+
t.setVolume(W(e));
|
|
1414
1586
|
}
|
|
1415
1587
|
})
|
|
1416
1588
|
})
|
|
1417
1589
|
})]
|
|
1418
1590
|
});
|
|
1419
|
-
},
|
|
1591
|
+
}, $ = .05, Ke = 5, qe = h`
|
|
1420
1592
|
display: flex;
|
|
1421
1593
|
flex-direction: column;
|
|
1422
1594
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1427,7 +1599,7 @@ ${Y}
|
|
|
1427
1599
|
opacity: 0.72;
|
|
1428
1600
|
font-size: 0.9em;
|
|
1429
1601
|
}
|
|
1430
|
-
`,
|
|
1602
|
+
`, Je = h`
|
|
1431
1603
|
position: absolute;
|
|
1432
1604
|
bottom: 0;
|
|
1433
1605
|
width: 100%;
|
|
@@ -1492,10 +1664,10 @@ ${Y}
|
|
|
1492
1664
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1493
1665
|
*/
|
|
1494
1666
|
button[aria-pressed='true'] svg {
|
|
1495
|
-
stroke: ${
|
|
1667
|
+
stroke: ${Ve.accent};
|
|
1496
1668
|
}
|
|
1497
1669
|
|
|
1498
|
-
.play, .sound, .time, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1670
|
+
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1499
1671
|
display: flex;
|
|
1500
1672
|
align-items: center;
|
|
1501
1673
|
|
|
@@ -1513,7 +1685,7 @@ ${Y}
|
|
|
1513
1685
|
}
|
|
1514
1686
|
}
|
|
1515
1687
|
|
|
1516
|
-
.play, .sound, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1688
|
+
.play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1517
1689
|
border-radius: 4px;
|
|
1518
1690
|
|
|
1519
1691
|
padding: 8px;
|
|
@@ -1527,7 +1699,7 @@ ${Y}
|
|
|
1527
1699
|
cursor: pointer;
|
|
1528
1700
|
|
|
1529
1701
|
:hover {
|
|
1530
|
-
background-color: ${
|
|
1702
|
+
background-color: ${Ve.hover};
|
|
1531
1703
|
}
|
|
1532
1704
|
|
|
1533
1705
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1544,7 +1716,7 @@ ${Y}
|
|
|
1544
1716
|
|
|
1545
1717
|
.left {
|
|
1546
1718
|
.time {
|
|
1547
|
-
${
|
|
1719
|
+
${V.bMedium.regular}
|
|
1548
1720
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1549
1721
|
}
|
|
1550
1722
|
}
|
|
@@ -1565,10 +1737,10 @@ ${Y}
|
|
|
1565
1737
|
}
|
|
1566
1738
|
}
|
|
1567
1739
|
}
|
|
1568
|
-
`,
|
|
1569
|
-
let e =
|
|
1570
|
-
let r =
|
|
1571
|
-
e.setVolume(
|
|
1740
|
+
`, Ye = () => {
|
|
1741
|
+
let e = L(), t = L((e) => e.paused), n = L((e) => e.currentTime), r = L((e) => e.duration), i = L((e) => e.fullscreen), a = L((e) => e.hideUI), o = L((e) => e.togglePictureInPicture), s = L((e) => e.pictureInPictureMode), c = L((e) => e.burnedInSubtitles), l = L((e) => e.subtitleTracks), [f, p] = m(null), h = s === "burn-in", g = l.length > 0, _ = r > 0 && n === r, v = u(({ direction: t, stepSize: n }) => {
|
|
1742
|
+
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(W(a)), o && !e.muted && e.toggleMuted();
|
|
1572
1744
|
}, [e]);
|
|
1573
1745
|
d(() => {
|
|
1574
1746
|
let t = (t) => {
|
|
@@ -1581,16 +1753,16 @@ ${Y}
|
|
|
1581
1753
|
else if (t.key === "m") e.toggleMuted();
|
|
1582
1754
|
else if (t.key === "ArrowUp") v({
|
|
1583
1755
|
direction: "up",
|
|
1584
|
-
stepSize:
|
|
1756
|
+
stepSize: $
|
|
1585
1757
|
});
|
|
1586
1758
|
else if (t.key === "ArrowDown") v({
|
|
1587
1759
|
direction: "down",
|
|
1588
|
-
stepSize:
|
|
1760
|
+
stepSize: $
|
|
1589
1761
|
});
|
|
1590
1762
|
else if (t.key === "ArrowRight") {
|
|
1591
1763
|
if (!e.duration) return;
|
|
1592
|
-
e.seek(Math.min(e.currentTime +
|
|
1593
|
-
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime -
|
|
1764
|
+
e.seek(Math.min(e.currentTime + Ke, e.duration));
|
|
1765
|
+
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Ke, 0)) : r = !1;
|
|
1594
1766
|
r && t.preventDefault();
|
|
1595
1767
|
};
|
|
1596
1768
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
@@ -1598,26 +1770,26 @@ ${Y}
|
|
|
1598
1770
|
let y = u((e) => {
|
|
1599
1771
|
e.preventDefault(), e.deltaY < 0 ? v({
|
|
1600
1772
|
direction: "up",
|
|
1601
|
-
stepSize:
|
|
1773
|
+
stepSize: $
|
|
1602
1774
|
}) : v({
|
|
1603
1775
|
direction: "down",
|
|
1604
|
-
stepSize:
|
|
1776
|
+
stepSize: $
|
|
1605
1777
|
});
|
|
1606
1778
|
}, [v]);
|
|
1607
1779
|
return d(() => {
|
|
1608
1780
|
if (f) return f.addEventListener("wheel", y, { passive: !1 }), () => f.removeEventListener("wheel", y);
|
|
1609
1781
|
}, [f, y]), /* @__PURE__ */ w("div", {
|
|
1610
|
-
css:
|
|
1782
|
+
css: Je,
|
|
1611
1783
|
style: { ...a ? {
|
|
1612
1784
|
opacity: "0",
|
|
1613
1785
|
pointerEvents: "none"
|
|
1614
1786
|
} : {} },
|
|
1615
|
-
children: [/* @__PURE__ */ C(
|
|
1787
|
+
children: [/* @__PURE__ */ C(Te, {}), /* @__PURE__ */ w("div", {
|
|
1616
1788
|
className: "actions",
|
|
1617
1789
|
children: [/* @__PURE__ */ w("div", {
|
|
1618
1790
|
className: "left",
|
|
1619
1791
|
children: [
|
|
1620
|
-
/* @__PURE__ */ C(
|
|
1792
|
+
/* @__PURE__ */ C(q, {
|
|
1621
1793
|
id: "play",
|
|
1622
1794
|
tooltipPlace: "top-start",
|
|
1623
1795
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1625,22 +1797,23 @@ ${Y}
|
|
|
1625
1797
|
type: "button",
|
|
1626
1798
|
onClick: () => e.togglePaused(),
|
|
1627
1799
|
"aria-label": _ ? "Replay" : t ? "Play" : "Pause",
|
|
1628
|
-
children: C(_ ?
|
|
1800
|
+
children: C(_ ? P : t ? N : M, {})
|
|
1629
1801
|
}),
|
|
1630
1802
|
toolTipText: /* @__PURE__ */ C("span", { children: _ ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1631
1803
|
}),
|
|
1632
|
-
/* @__PURE__ */ C(
|
|
1804
|
+
/* @__PURE__ */ C(Ge, { ref: p }),
|
|
1633
1805
|
/* @__PURE__ */ C("div", {
|
|
1634
1806
|
className: "time",
|
|
1635
|
-
children:
|
|
1807
|
+
children: Se(n, r)
|
|
1636
1808
|
})
|
|
1637
1809
|
]
|
|
1638
1810
|
}), /* @__PURE__ */ w("div", {
|
|
1639
1811
|
className: "right",
|
|
1640
1812
|
children: [
|
|
1641
|
-
/* @__PURE__ */ C(
|
|
1642
|
-
/* @__PURE__ */ C(
|
|
1643
|
-
|
|
1813
|
+
/* @__PURE__ */ C(Pe, {}),
|
|
1814
|
+
/* @__PURE__ */ C(Be, {}),
|
|
1815
|
+
/* @__PURE__ */ C(Re, {}),
|
|
1816
|
+
o ? /* @__PURE__ */ C(q, {
|
|
1644
1817
|
id: "picture-in-picture",
|
|
1645
1818
|
tooltipPlace: "top-end",
|
|
1646
1819
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1650,13 +1823,13 @@ ${Y}
|
|
|
1650
1823
|
disabled: h && !g,
|
|
1651
1824
|
"aria-label": h ? "Put the subtitles in the video" : "Picture in picture",
|
|
1652
1825
|
"aria-pressed": h ? c : void 0,
|
|
1653
|
-
children: h ? /* @__PURE__ */ C(
|
|
1654
|
-
src:
|
|
1826
|
+
children: h ? /* @__PURE__ */ C(ke, {}) : /* @__PURE__ */ C("img", {
|
|
1827
|
+
src: Ee,
|
|
1655
1828
|
alt: ""
|
|
1656
1829
|
})
|
|
1657
1830
|
}),
|
|
1658
1831
|
toolTipText: /* @__PURE__ */ w("span", {
|
|
1659
|
-
css:
|
|
1832
|
+
css: qe,
|
|
1660
1833
|
children: [/* @__PURE__ */ C("span", {
|
|
1661
1834
|
className: "lead",
|
|
1662
1835
|
children: h ? g ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
|
|
@@ -1666,7 +1839,7 @@ ${Y}
|
|
|
1666
1839
|
}) : null]
|
|
1667
1840
|
})
|
|
1668
1841
|
}) : null,
|
|
1669
|
-
/* @__PURE__ */ C(
|
|
1842
|
+
/* @__PURE__ */ C(q, {
|
|
1670
1843
|
id: "full-screen",
|
|
1671
1844
|
tooltipPlace: "top-end",
|
|
1672
1845
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1675,7 +1848,7 @@ ${Y}
|
|
|
1675
1848
|
onClick: () => e.toggleFullscreen(),
|
|
1676
1849
|
"aria-label": "Full screen",
|
|
1677
1850
|
"aria-pressed": i,
|
|
1678
|
-
children: C(i ?
|
|
1851
|
+
children: C(i ? j : A, {})
|
|
1679
1852
|
}),
|
|
1680
1853
|
toolTipText: /* @__PURE__ */ C("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
|
|
1681
1854
|
})
|
|
@@ -1683,7 +1856,7 @@ ${Y}
|
|
|
1683
1856
|
})]
|
|
1684
1857
|
})]
|
|
1685
1858
|
});
|
|
1686
|
-
},
|
|
1859
|
+
}, Xe = 9e3, Ze = h`
|
|
1687
1860
|
position: absolute;
|
|
1688
1861
|
inset: 0;
|
|
1689
1862
|
z-index: 2;
|
|
@@ -1721,12 +1894,12 @@ ${Y}
|
|
|
1721
1894
|
}
|
|
1722
1895
|
|
|
1723
1896
|
.title {
|
|
1724
|
-
${
|
|
1897
|
+
${V.bMedium.bold}
|
|
1725
1898
|
color: #fff;
|
|
1726
1899
|
}
|
|
1727
1900
|
|
|
1728
1901
|
.body {
|
|
1729
|
-
${
|
|
1902
|
+
${V.bSmall.regular}
|
|
1730
1903
|
color: rgba(255, 255, 255, 0.75);
|
|
1731
1904
|
}
|
|
1732
1905
|
|
|
@@ -1737,18 +1910,18 @@ ${Y}
|
|
|
1737
1910
|
line-height: 1;
|
|
1738
1911
|
color: #6EA8FE;
|
|
1739
1912
|
}
|
|
1740
|
-
`,
|
|
1741
|
-
let e =
|
|
1913
|
+
`, Qe = () => {
|
|
1914
|
+
let e = L((e) => e.burnedInSubtitles), t = L((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1742
1915
|
return d(() => {
|
|
1743
1916
|
if (t !== "burn-in" || !e) {
|
|
1744
1917
|
r(!1);
|
|
1745
1918
|
return;
|
|
1746
1919
|
}
|
|
1747
1920
|
r(!0);
|
|
1748
|
-
let n = setTimeout(() => r(!1),
|
|
1921
|
+
let n = setTimeout(() => r(!1), Xe);
|
|
1749
1922
|
return () => clearTimeout(n);
|
|
1750
1923
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1751
|
-
css:
|
|
1924
|
+
css: Ze,
|
|
1752
1925
|
className: n ? "show" : "",
|
|
1753
1926
|
role: "status",
|
|
1754
1927
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -1769,7 +1942,7 @@ ${Y}
|
|
|
1769
1942
|
})]
|
|
1770
1943
|
})
|
|
1771
1944
|
});
|
|
1772
|
-
},
|
|
1945
|
+
}, $e = 3e3, et = h`
|
|
1773
1946
|
position: absolute;
|
|
1774
1947
|
inset: 0;
|
|
1775
1948
|
z-index: 2;
|
|
@@ -1780,7 +1953,7 @@ ${Y}
|
|
|
1780
1953
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1781
1954
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1782
1955
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1783
|
-
`,
|
|
1956
|
+
`, tt = h`
|
|
1784
1957
|
position: relative;
|
|
1785
1958
|
background-color: black;
|
|
1786
1959
|
display: flex;
|
|
@@ -1812,20 +1985,20 @@ ${Y}
|
|
|
1812
1985
|
&.hide {
|
|
1813
1986
|
cursor: none;
|
|
1814
1987
|
}
|
|
1815
|
-
`,
|
|
1988
|
+
`, nt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
1816
1989
|
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
1817
|
-
return l(e) && e.type === c ?
|
|
1990
|
+
return l(e) && e.type === c ? nt(e.props.children, `${r}/`) : [{
|
|
1818
1991
|
key: r,
|
|
1819
1992
|
item: e
|
|
1820
1993
|
}];
|
|
1821
|
-
}),
|
|
1822
|
-
let o =
|
|
1994
|
+
}), rt = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
1995
|
+
let o = L(), s = L((e) => e.hideUI), c = L((e) => e.setHideUI), l = p(void 0), u = p("mouse");
|
|
1823
1996
|
d(() => () => clearTimeout(l.current), []);
|
|
1824
1997
|
let f = () => {
|
|
1825
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
1998
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), $e);
|
|
1826
1999
|
};
|
|
1827
2000
|
return /* @__PURE__ */ w("div", {
|
|
1828
|
-
css:
|
|
2001
|
+
css: tt,
|
|
1829
2002
|
ref: e,
|
|
1830
2003
|
onPointerMove: (e) => {
|
|
1831
2004
|
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
@@ -1841,9 +2014,9 @@ ${Y}
|
|
|
1841
2014
|
},
|
|
1842
2015
|
className: s ? "hide" : "",
|
|
1843
2016
|
children: [
|
|
1844
|
-
/* @__PURE__ */ C(
|
|
1845
|
-
|
|
1846
|
-
css:
|
|
2017
|
+
/* @__PURE__ */ C(xe, { onCanvasRef: n }),
|
|
2018
|
+
nt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2019
|
+
css: et,
|
|
1847
2020
|
style: { ...s ? {
|
|
1848
2021
|
opacity: "0",
|
|
1849
2022
|
visibility: "hidden",
|
|
@@ -1851,8 +2024,8 @@ ${Y}
|
|
|
1851
2024
|
} : {} },
|
|
1852
2025
|
children: t
|
|
1853
2026
|
}, e)),
|
|
1854
|
-
i === !1 ? null : /* @__PURE__ */ C(
|
|
1855
|
-
/* @__PURE__ */ C(
|
|
2027
|
+
i === !1 ? null : /* @__PURE__ */ C(Ye, {}),
|
|
2028
|
+
/* @__PURE__ */ C(Qe, {}),
|
|
1856
2029
|
/* @__PURE__ */ w("div", {
|
|
1857
2030
|
className: "video",
|
|
1858
2031
|
onClick: () => {
|
|
@@ -1869,16 +2042,16 @@ ${Y}
|
|
|
1869
2042
|
})
|
|
1870
2043
|
]
|
|
1871
2044
|
});
|
|
1872
|
-
},
|
|
2045
|
+
}, it = ({ options: e, children: t }) => {
|
|
1873
2046
|
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;
|
|
1874
|
-
d(() => (p?.(S), () => p?.(null)), [S, p]),
|
|
1875
|
-
let w =
|
|
2047
|
+
d(() => (p?.(S), () => p?.(null)), [S, p]), pe(g, b, r);
|
|
2048
|
+
let w = z({
|
|
1876
2049
|
publicPath: s,
|
|
1877
2050
|
workerUrl: c,
|
|
1878
2051
|
length: f === !1 ? void 0 : a,
|
|
1879
2052
|
read: u ?? l,
|
|
1880
2053
|
downloadedRanges: o
|
|
1881
|
-
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } =
|
|
2054
|
+
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = B(g, b), k = L((e) => e.setSourceState);
|
|
1882
2055
|
d(() => {
|
|
1883
2056
|
k({
|
|
1884
2057
|
title: i,
|
|
@@ -1930,7 +2103,7 @@ ${Y}
|
|
|
1930
2103
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
1931
2104
|
selectAudioTrack: (e) => M.select(String(e))
|
|
1932
2105
|
});
|
|
1933
|
-
}, [k, M]), /* @__PURE__ */ C(
|
|
2106
|
+
}, [k, M]), /* @__PURE__ */ C(rt, {
|
|
1934
2107
|
ref: h,
|
|
1935
2108
|
onVideoRef: n ? void 0 : _,
|
|
1936
2109
|
onCanvasRef: x,
|
|
@@ -1938,7 +2111,7 @@ ${Y}
|
|
|
1938
2111
|
controls: e.controls,
|
|
1939
2112
|
children: t
|
|
1940
2113
|
});
|
|
1941
|
-
},
|
|
2114
|
+
}, at = h`
|
|
1942
2115
|
/**
|
|
1943
2116
|
* The chrome's whole scale, in one place.
|
|
1944
2117
|
*
|
|
@@ -2008,17 +2181,17 @@ ${Y}
|
|
|
2008
2181
|
height: 100%;
|
|
2009
2182
|
width: 100%;
|
|
2010
2183
|
overflow: hidden;
|
|
2011
|
-
`,
|
|
2012
|
-
css:
|
|
2013
|
-
children: /* @__PURE__ */ C(
|
|
2184
|
+
`, ot = (e) => /* @__PURE__ */ C("div", {
|
|
2185
|
+
css: at,
|
|
2186
|
+
children: /* @__PURE__ */ C(I.Provider, { children: /* @__PURE__ */ C(it, {
|
|
2014
2187
|
options: e,
|
|
2015
2188
|
children: e.children
|
|
2016
2189
|
}) })
|
|
2017
|
-
}),
|
|
2190
|
+
}), st = (e) => !!e && typeof e == "object" && "at" in e, ct = (e) => !!e && typeof e == "object" && "selection" in e, lt = ({ blob: e, name: t }) => ({
|
|
2018
2191
|
length: e.size,
|
|
2019
2192
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2020
2193
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2021
|
-
}),
|
|
2194
|
+
}), ut = async (e, t) => {
|
|
2022
2195
|
let n = await fetch(e, {
|
|
2023
2196
|
headers: { Range: "bytes=0-1" },
|
|
2024
2197
|
credentials: t
|
|
@@ -2028,8 +2201,8 @@ ${Y}
|
|
|
2028
2201
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2029
2202
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2030
2203
|
return i;
|
|
2031
|
-
},
|
|
2032
|
-
let i = t ?? await
|
|
2204
|
+
}, dt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2205
|
+
let i = t ?? await ut(e, r);
|
|
2033
2206
|
return {
|
|
2034
2207
|
length: i,
|
|
2035
2208
|
name: n,
|
|
@@ -2042,9 +2215,9 @@ ${Y}
|
|
|
2042
2215
|
return a.arrayBuffer();
|
|
2043
2216
|
}
|
|
2044
2217
|
};
|
|
2045
|
-
},
|
|
2046
|
-
if ("blob" in e) return
|
|
2047
|
-
if ("url" in e) return
|
|
2218
|
+
}, ft = async (e) => {
|
|
2219
|
+
if ("blob" in e) return lt(e);
|
|
2220
|
+
if ("url" in e) return dt(e);
|
|
2048
2221
|
if ("read" in e) return {
|
|
2049
2222
|
length: e.length,
|
|
2050
2223
|
name: e.name,
|
|
@@ -2053,4 +2226,4 @@ ${Y}
|
|
|
2053
2226
|
throw Error(`Unknown source type: ${e}`);
|
|
2054
2227
|
};
|
|
2055
2228
|
//#endregion
|
|
2056
|
-
export {
|
|
2229
|
+
export { ot as MediaPlayer, ot as default, I as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, ft as inputToRemuxerInput, ct as isDelegatedTracks, st as isExternalThumbnails, F as sourceFeature, i as startPlayback, B as usePictureInPicture, L as usePlayer, z as useSeekThumbnails };
|