@banou/media-player 0.8.10 → 0.8.12
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 +498 -302
- package/dist/react/components/errors.d.ts +17 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +47 -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 +213 -0
- package/src/lib/react/components/track-menu.tsx +2 -2
- package/src/lib/react/hooks/use-playback.ts +106 -20
- package/src/lib/react/source-feature.ts +40 -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,51 @@ 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 = Date.now(), i = R(t), o = fe(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
121
|
+
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
122
|
+
let e = {
|
|
123
|
+
...c,
|
|
124
|
+
count: c.count + 1,
|
|
125
|
+
lastAt: r
|
|
126
|
+
};
|
|
127
|
+
a.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
let l = {
|
|
131
|
+
at: r,
|
|
132
|
+
lastAt: r,
|
|
133
|
+
count: 1,
|
|
134
|
+
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
135
|
+
message: i,
|
|
136
|
+
detail: o,
|
|
137
|
+
recovered: n
|
|
138
|
+
};
|
|
139
|
+
a.setSourceState({ playbackErrors: [...s, l] });
|
|
140
|
+
}, d = (e) => {
|
|
141
|
+
if (r) return;
|
|
142
|
+
let t = n(e);
|
|
143
|
+
if (u(e, t), t) {
|
|
144
|
+
let t = performance.now();
|
|
145
|
+
t - w.current.at > de && (w.current = {
|
|
146
|
+
count: 0,
|
|
147
|
+
at: t
|
|
148
|
+
});
|
|
149
|
+
let n = ue[Math.min(w.current.count, ue.length - 1)];
|
|
150
|
+
w.current = {
|
|
151
|
+
count: w.current.count + 1,
|
|
152
|
+
at: t
|
|
153
|
+
}, 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);
|
|
154
|
+
return;
|
|
118
155
|
}
|
|
156
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), j.current?.(e);
|
|
119
157
|
};
|
|
120
158
|
return (async () => {
|
|
121
159
|
try {
|
|
122
160
|
let n = await i({
|
|
123
161
|
videoElement: e,
|
|
124
162
|
canvasElement: t,
|
|
125
|
-
read: (e, t) =>
|
|
163
|
+
read: (e, t) => k.current(e, t),
|
|
126
164
|
length: s,
|
|
127
165
|
publicPath: c,
|
|
128
166
|
libavWorkerUrl: l,
|
|
@@ -135,23 +173,23 @@ var re = {
|
|
|
135
173
|
onReady: () => {
|
|
136
174
|
if (r) return;
|
|
137
175
|
a.setSourceState({ ready: !0 });
|
|
138
|
-
let t =
|
|
139
|
-
|
|
176
|
+
let t = D.current;
|
|
177
|
+
D.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
140
178
|
},
|
|
141
|
-
onError:
|
|
179
|
+
onError: d,
|
|
142
180
|
onRecovered: () => {
|
|
143
181
|
r || a.setSourceState({ playbackError: null });
|
|
144
182
|
},
|
|
145
|
-
onSeek: (e) =>
|
|
183
|
+
onSeek: (e) => A.current?.(e),
|
|
146
184
|
onSubtitleStreams: (e) => {
|
|
147
185
|
r || a.setSourceState({
|
|
148
|
-
subtitleTracks:
|
|
149
|
-
...
|
|
186
|
+
subtitleTracks: le(e),
|
|
187
|
+
...O.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
150
188
|
});
|
|
151
189
|
},
|
|
152
190
|
onAudioStreams: (e, t) => {
|
|
153
191
|
r || a.setSourceState({
|
|
154
|
-
audioTracks:
|
|
192
|
+
audioTracks: le(e),
|
|
155
193
|
selectedAudioTrack: t
|
|
156
194
|
});
|
|
157
195
|
}
|
|
@@ -160,17 +198,17 @@ var re = {
|
|
|
160
198
|
n.destroy();
|
|
161
199
|
return;
|
|
162
200
|
}
|
|
163
|
-
|
|
201
|
+
E.current = n, a.setSourceState({ indexes: n.indexes });
|
|
164
202
|
let o = a.selectedSubtitleTrack;
|
|
165
203
|
typeof o == "number" && n.selectSubtitleStream(o);
|
|
166
204
|
} catch (e) {
|
|
167
|
-
|
|
205
|
+
d(e);
|
|
168
206
|
}
|
|
169
207
|
})(), () => {
|
|
170
|
-
r = !0,
|
|
208
|
+
r = !0, D.current = {
|
|
171
209
|
time: e.currentTime,
|
|
172
210
|
size: s
|
|
173
|
-
},
|
|
211
|
+
}, E.current?.destroy(), E.current = null, a.setSourceState({ ready: !1 });
|
|
174
212
|
};
|
|
175
213
|
}, [
|
|
176
214
|
a,
|
|
@@ -188,13 +226,13 @@ var re = {
|
|
|
188
226
|
y,
|
|
189
227
|
S
|
|
190
228
|
]);
|
|
191
|
-
},
|
|
229
|
+
}, me = 5e3, he = 6e4, z = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
192
230
|
let [o, s] = m([]), c = p(null), l = p(i);
|
|
193
231
|
l.current = i;
|
|
194
232
|
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
195
233
|
return h.current = u, d(() => {
|
|
196
234
|
if (!n || !i || !e || !t) return;
|
|
197
|
-
let a = !1, o = null, u, d =
|
|
235
|
+
let a = !1, o = null, u, d = me, f = () => {
|
|
198
236
|
r({
|
|
199
237
|
publicPath: e,
|
|
200
238
|
workerUrl: t,
|
|
@@ -210,7 +248,7 @@ var re = {
|
|
|
210
248
|
}
|
|
211
249
|
o = e, c.current = e, e.update(h.current);
|
|
212
250
|
}, () => {
|
|
213
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
251
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, he));
|
|
214
252
|
});
|
|
215
253
|
};
|
|
216
254
|
return f(), () => {
|
|
@@ -223,7 +261,7 @@ var re = {
|
|
|
223
261
|
]), d(() => {
|
|
224
262
|
c.current?.update(u);
|
|
225
263
|
}, [u]), o;
|
|
226
|
-
},
|
|
264
|
+
}, B = (e, n) => {
|
|
227
265
|
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
228
266
|
d(() => {
|
|
229
267
|
if (!e || !n || !s) return;
|
|
@@ -251,7 +289,7 @@ var re = {
|
|
|
251
289
|
mode: s,
|
|
252
290
|
burnedIn: i
|
|
253
291
|
};
|
|
254
|
-
},
|
|
292
|
+
}, V = {
|
|
255
293
|
headings: {
|
|
256
294
|
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
295
|
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 +316,14 @@ var re = {
|
|
|
278
316
|
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
317
|
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
318
|
}
|
|
281
|
-
},
|
|
319
|
+
}, ge = h`
|
|
282
320
|
top: unset !important;
|
|
283
321
|
left: unset !important;
|
|
284
322
|
width: 100%;
|
|
285
323
|
height: 100%;
|
|
286
324
|
margin: auto;
|
|
287
325
|
pointer-events: none;
|
|
288
|
-
`,
|
|
326
|
+
`, _e = h`
|
|
289
327
|
position: absolute;
|
|
290
328
|
top: 0;
|
|
291
329
|
left: 0;
|
|
@@ -293,7 +331,7 @@ var re = {
|
|
|
293
331
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
294
332
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
295
333
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
296
|
-
${
|
|
334
|
+
${V.headings.small}
|
|
297
335
|
color: white;
|
|
298
336
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
299
337
|
z-index: 2;
|
|
@@ -314,7 +352,7 @@ var re = {
|
|
|
314
352
|
|
|
315
353
|
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
354
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
317
|
-
`,
|
|
355
|
+
`, ve = h`
|
|
318
356
|
position: absolute;
|
|
319
357
|
inset: 0;
|
|
320
358
|
z-index: 2;
|
|
@@ -334,43 +372,43 @@ var re = {
|
|
|
334
372
|
to { transform: rotate(360deg); }
|
|
335
373
|
`} 0.8s linear infinite;
|
|
336
374
|
}
|
|
337
|
-
`,
|
|
375
|
+
`, ye = h`
|
|
338
376
|
position: absolute;
|
|
339
377
|
inset: auto 0 20%;
|
|
340
378
|
z-index: 3;
|
|
341
379
|
padding: 0 calc(2 * var(--mp-unit));
|
|
342
380
|
text-align: center;
|
|
343
381
|
color: #fff;
|
|
344
|
-
${
|
|
382
|
+
${V.bLarge.regular}
|
|
345
383
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
346
384
|
pointer-events: none;
|
|
347
|
-
`,
|
|
348
|
-
let t =
|
|
385
|
+
`, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
|
|
386
|
+
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
387
|
return /* @__PURE__ */ w(S, { children: [
|
|
350
388
|
t ? /* @__PURE__ */ C("div", {
|
|
351
389
|
className: "title",
|
|
352
|
-
css:
|
|
390
|
+
css: _e,
|
|
353
391
|
style: { ...n ? {
|
|
354
392
|
opacity: "0",
|
|
355
393
|
pointerEvents: "none"
|
|
356
394
|
} : {} },
|
|
357
395
|
children: t
|
|
358
396
|
}) : void 0,
|
|
359
|
-
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css:
|
|
397
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: ve }) : void 0,
|
|
360
398
|
r ? /* @__PURE__ */ C("div", {
|
|
361
|
-
css:
|
|
362
|
-
children:
|
|
399
|
+
css: ye,
|
|
400
|
+
children: be(r)
|
|
363
401
|
}) : void 0,
|
|
364
402
|
/* @__PURE__ */ C("canvas", {
|
|
365
403
|
ref: e,
|
|
366
|
-
css:
|
|
404
|
+
css: ge
|
|
367
405
|
})
|
|
368
406
|
] });
|
|
369
|
-
},
|
|
407
|
+
}, 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
408
|
if (e === void 0) return "0:00";
|
|
371
409
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
372
410
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
373
|
-
},
|
|
411
|
+
}, Se = (e, t) => `${K(e)} / ${K(t)}`, Ce = (e) => h`
|
|
374
412
|
display: flex;
|
|
375
413
|
justify-content: flex-end;
|
|
376
414
|
|
|
@@ -380,7 +418,7 @@ var re = {
|
|
|
380
418
|
z-index: 3;
|
|
381
419
|
|
|
382
420
|
* {
|
|
383
|
-
${
|
|
421
|
+
${V.bMedium.regular}
|
|
384
422
|
}
|
|
385
423
|
|
|
386
424
|
${e === "sm" && h`
|
|
@@ -392,7 +430,7 @@ var re = {
|
|
|
392
430
|
${e === "lg" && h`
|
|
393
431
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
394
432
|
`}
|
|
395
|
-
`,
|
|
433
|
+
`, 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
434
|
"data-tooltip-id": e,
|
|
397
435
|
"data-open": !0,
|
|
398
436
|
"data-tooltip-offset": a,
|
|
@@ -400,12 +438,12 @@ var re = {
|
|
|
400
438
|
"data-tooltip-delay-hide": i,
|
|
401
439
|
"data-tooltip-place": o,
|
|
402
440
|
children: n
|
|
403
|
-
}), !s && /* @__PURE__ */ C(
|
|
404
|
-
css:
|
|
441
|
+
}), !s && /* @__PURE__ */ C(ie, {
|
|
442
|
+
css: Ce(c),
|
|
405
443
|
id: e,
|
|
406
444
|
noArrow: !0,
|
|
407
445
|
children: t
|
|
408
|
-
})] }),
|
|
446
|
+
})] }), J = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
409
447
|
let [i, a] = m(!1), o = p(t);
|
|
410
448
|
o.current = t;
|
|
411
449
|
let s = p(null), c = u((t, r) => {
|
|
@@ -432,7 +470,7 @@ var re = {
|
|
|
432
470
|
style: { touchAction: "none" }
|
|
433
471
|
}
|
|
434
472
|
};
|
|
435
|
-
},
|
|
473
|
+
}, we = h`
|
|
436
474
|
position: relative;
|
|
437
475
|
height: calc(.4 * var(--mp-unit));
|
|
438
476
|
|
|
@@ -486,7 +524,7 @@ var re = {
|
|
|
486
524
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
487
525
|
|
|
488
526
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
489
|
-
${
|
|
527
|
+
${V.bMedium.bold}
|
|
490
528
|
|
|
491
529
|
position: absolute;
|
|
492
530
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -603,8 +641,8 @@ var re = {
|
|
|
603
641
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
604
642
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
605
643
|
}
|
|
606
|
-
`,
|
|
607
|
-
let e =
|
|
644
|
+
`, Te = () => {
|
|
645
|
+
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
646
|
ref: c,
|
|
609
647
|
onChange: (e) => {
|
|
610
648
|
u(e), _.current !== "mouse" && g(e * n);
|
|
@@ -662,7 +700,7 @@ var re = {
|
|
|
662
700
|
h
|
|
663
701
|
]);
|
|
664
702
|
return /* @__PURE__ */ w("div", {
|
|
665
|
-
css:
|
|
703
|
+
css: we,
|
|
666
704
|
ref: c,
|
|
667
705
|
className: v ? "progress-bar dragging" : "progress-bar",
|
|
668
706
|
onMouseMove: T,
|
|
@@ -703,7 +741,7 @@ var re = {
|
|
|
703
741
|
})
|
|
704
742
|
]
|
|
705
743
|
});
|
|
706
|
-
},
|
|
744
|
+
}, 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
745
|
xmlns: "http://www.w3.org/2000/svg",
|
|
708
746
|
width: 24,
|
|
709
747
|
height: 24,
|
|
@@ -713,8 +751,8 @@ var re = {
|
|
|
713
751
|
strokeWidth: 2,
|
|
714
752
|
strokeLinecap: "round",
|
|
715
753
|
strokeLinejoin: "round"
|
|
716
|
-
},
|
|
717
|
-
...
|
|
754
|
+
}, De = (e) => /* @__PURE__ */ w("svg", {
|
|
755
|
+
...Y,
|
|
718
756
|
...e,
|
|
719
757
|
children: [/* @__PURE__ */ C("rect", {
|
|
720
758
|
x: "3",
|
|
@@ -724,8 +762,8 @@ var re = {
|
|
|
724
762
|
rx: "2",
|
|
725
763
|
ry: "2"
|
|
726
764
|
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
727
|
-
}),
|
|
728
|
-
...
|
|
765
|
+
}), Oe = (e) => /* @__PURE__ */ w("svg", {
|
|
766
|
+
...Y,
|
|
729
767
|
...e,
|
|
730
768
|
children: [
|
|
731
769
|
/* @__PURE__ */ C("rect", {
|
|
@@ -744,8 +782,8 @@ var re = {
|
|
|
744
782
|
y2: "22"
|
|
745
783
|
})
|
|
746
784
|
]
|
|
747
|
-
}),
|
|
748
|
-
...
|
|
785
|
+
}), ke = (e) => /* @__PURE__ */ w("svg", {
|
|
786
|
+
...Y,
|
|
749
787
|
...e,
|
|
750
788
|
children: [
|
|
751
789
|
/* @__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 +797,7 @@ var re = {
|
|
|
759
797
|
}),
|
|
760
798
|
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
761
799
|
]
|
|
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`
|
|
800
|
+
}), X = h`
|
|
851
801
|
.popover {
|
|
852
802
|
position: absolute;
|
|
853
803
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -886,7 +836,7 @@ width: 100%;
|
|
|
886
836
|
|
|
887
837
|
border-radius: 8px;
|
|
888
838
|
background-color: rgba(28,28,28,0.95);
|
|
889
|
-
${
|
|
839
|
+
${V.bMedium.regular}
|
|
890
840
|
|
|
891
841
|
z-index: 4;
|
|
892
842
|
|
|
@@ -915,10 +865,10 @@ width: 100%;
|
|
|
915
865
|
:last-of-type {
|
|
916
866
|
border-radius: 0 0 8px 8px;
|
|
917
867
|
}
|
|
918
|
-
|
|
868
|
+
&:not(.no-hover) {
|
|
919
869
|
cursor: pointer;
|
|
920
870
|
}
|
|
921
|
-
|
|
871
|
+
&:not(.no-hover):hover {
|
|
922
872
|
background-color: rgba(255,255,255,.1);
|
|
923
873
|
}
|
|
924
874
|
|
|
@@ -929,7 +879,7 @@ width: 100%;
|
|
|
929
879
|
|
|
930
880
|
.secondary {
|
|
931
881
|
color: #eee;
|
|
932
|
-
${
|
|
882
|
+
${V.bSmall.regular}
|
|
933
883
|
}
|
|
934
884
|
}
|
|
935
885
|
}
|
|
@@ -971,10 +921,10 @@ width: 100%;
|
|
|
971
921
|
.failed {
|
|
972
922
|
border-bottom: 1px solid #4D4D4E;
|
|
973
923
|
color: #f66;
|
|
974
|
-
${
|
|
924
|
+
${V.bSmall.regular}
|
|
975
925
|
}
|
|
976
926
|
}
|
|
977
|
-
`,
|
|
927
|
+
`, Ae = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
978
928
|
let c = o !== void 0, l = (e, i, a) => {
|
|
979
929
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
980
930
|
return /* @__PURE__ */ w("div", {
|
|
@@ -991,7 +941,7 @@ width: 100%;
|
|
|
991
941
|
/* @__PURE__ */ w("div", {
|
|
992
942
|
className: i ? "back" : "back no-hover",
|
|
993
943
|
onClick: i,
|
|
994
|
-
children: [i ? /* @__PURE__ */ C(
|
|
944
|
+
children: [i ? /* @__PURE__ */ C(D, {}) : null, /* @__PURE__ */ C("span", { children: e })]
|
|
995
945
|
}),
|
|
996
946
|
s ? /* @__PURE__ */ C("div", {
|
|
997
947
|
className: "no-hover failed",
|
|
@@ -1042,7 +992,252 @@ width: 100%;
|
|
|
1042
992
|
});
|
|
1043
993
|
}
|
|
1044
994
|
};
|
|
1045
|
-
},
|
|
995
|
+
}, je = h`
|
|
996
|
+
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
997
|
+
which is the width of the player box, so it can be clamped to it. */
|
|
998
|
+
position: static;
|
|
999
|
+
|
|
1000
|
+
.errors {
|
|
1001
|
+
/* the icon keeps its size, the pressable box grows around it */
|
|
1002
|
+
@media (pointer: coarse) {
|
|
1003
|
+
box-sizing: border-box;
|
|
1004
|
+
justify-content: center;
|
|
1005
|
+
|
|
1006
|
+
min-width: 44px;
|
|
1007
|
+
min-height: 44px;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
${X}
|
|
1012
|
+
|
|
1013
|
+
.popover.error-list {
|
|
1014
|
+
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
1015
|
+
decoder message that has been ellipsized is not worth copying. */
|
|
1016
|
+
width: 420px;
|
|
1017
|
+
max-height: min(300px, calc(100cqh - 100% - 16px));
|
|
1018
|
+
|
|
1019
|
+
/* track-menu's header is a left-aligned label row; here it carries a control too, so the two
|
|
1020
|
+
ends go to the two ends */
|
|
1021
|
+
.back {
|
|
1022
|
+
justify-content: space-between;
|
|
1023
|
+
gap: 8px;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
.copy {
|
|
1027
|
+
/* sits in the header row, which track-menu styles as .back */
|
|
1028
|
+
display: flex;
|
|
1029
|
+
align-items: center;
|
|
1030
|
+
gap: 6px;
|
|
1031
|
+
|
|
1032
|
+
background: none;
|
|
1033
|
+
border: none;
|
|
1034
|
+
padding: 4px 6px;
|
|
1035
|
+
border-radius: 4px;
|
|
1036
|
+
|
|
1037
|
+
color: #fff;
|
|
1038
|
+
cursor: pointer;
|
|
1039
|
+
${V.bSmall.regular}
|
|
1040
|
+
|
|
1041
|
+
&:hover {
|
|
1042
|
+
background-color: rgba(255,255,255,.1);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
svg {
|
|
1046
|
+
width: 14px;
|
|
1047
|
+
height: 14px;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.entry {
|
|
1052
|
+
/* one failure is a block of text, so it stacks instead of sitting on one line */
|
|
1053
|
+
display: flex;
|
|
1054
|
+
flex-direction: column;
|
|
1055
|
+
align-items: flex-start;
|
|
1056
|
+
gap: 2px;
|
|
1057
|
+
|
|
1058
|
+
.when {
|
|
1059
|
+
color: #bbb;
|
|
1060
|
+
${V.bSmall.regular}
|
|
1061
|
+
|
|
1062
|
+
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1063
|
+
.count {
|
|
1064
|
+
margin-left: 6px;
|
|
1065
|
+
color: #fff;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
.what {
|
|
1070
|
+
/* the decoder's own words, which are long and must not be cut */
|
|
1071
|
+
overflow-wrap: anywhere;
|
|
1072
|
+
white-space: pre-wrap;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.cause {
|
|
1076
|
+
color: #ddd;
|
|
1077
|
+
overflow-wrap: anywhere;
|
|
1078
|
+
white-space: pre-wrap;
|
|
1079
|
+
${V.bSmall.regular}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
`, Me = (e) => new Date(e).toLocaleTimeString(), Q = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : K(Math.max(0, e)), Ne = (e) => e.reduce((e, t) => e + t.count, 0), Pe = (e) => e.map((e, t) => {
|
|
1084
|
+
let n = Q(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1085
|
+
return [
|
|
1086
|
+
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1087
|
+
e.message,
|
|
1088
|
+
e.detail
|
|
1089
|
+
].filter(Boolean).join("\n");
|
|
1090
|
+
}).join("\n\n"), Fe = () => {
|
|
1091
|
+
let e = L((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
|
|
1092
|
+
if (e.length === 0) return null;
|
|
1093
|
+
let o = () => {
|
|
1094
|
+
navigator.clipboard?.writeText(Pe(e)).then(() => {
|
|
1095
|
+
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1096
|
+
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1097
|
+
}, s = `Playback errors (${Ne(e)})`;
|
|
1098
|
+
return /* @__PURE__ */ w("div", {
|
|
1099
|
+
css: je,
|
|
1100
|
+
ref: r,
|
|
1101
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1102
|
+
id: "errors",
|
|
1103
|
+
disabled: t,
|
|
1104
|
+
text: /* @__PURE__ */ C("button", {
|
|
1105
|
+
className: "errors",
|
|
1106
|
+
type: "button",
|
|
1107
|
+
onClick: n,
|
|
1108
|
+
"aria-label": s,
|
|
1109
|
+
"aria-expanded": t,
|
|
1110
|
+
children: /* @__PURE__ */ C(T, { className: "alert-triangle" })
|
|
1111
|
+
}),
|
|
1112
|
+
toolTipText: /* @__PURE__ */ C("span", { children: s })
|
|
1113
|
+
}), t && /* @__PURE__ */ w("div", {
|
|
1114
|
+
className: "popover error-list",
|
|
1115
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1116
|
+
className: "back no-hover",
|
|
1117
|
+
children: [/* @__PURE__ */ C("span", { children: s }), /* @__PURE__ */ w("button", {
|
|
1118
|
+
className: "copy",
|
|
1119
|
+
type: "button",
|
|
1120
|
+
onClick: o,
|
|
1121
|
+
"aria-label": "Copy the errors",
|
|
1122
|
+
children: [C(i ? E : k, {}), /* @__PURE__ */ C("span", { children: i ? "Copied" : "Copy" })]
|
|
1123
|
+
})]
|
|
1124
|
+
}), e.map((e, t) => /* @__PURE__ */ w("div", {
|
|
1125
|
+
className: "entry no-hover",
|
|
1126
|
+
children: [
|
|
1127
|
+
/* @__PURE__ */ w("span", {
|
|
1128
|
+
className: "when",
|
|
1129
|
+
children: [
|
|
1130
|
+
Me(e.at),
|
|
1131
|
+
e.count > 1 ? ` to ${Me(e.lastAt)}` : "",
|
|
1132
|
+
Q(e.atMediaTime) ? ` at ${Q(e.atMediaTime)}` : "",
|
|
1133
|
+
e.recovered ? " recovered" : "",
|
|
1134
|
+
e.count > 1 ? /* @__PURE__ */ C("span", {
|
|
1135
|
+
className: "count",
|
|
1136
|
+
children: `×${e.count}`
|
|
1137
|
+
}) : null
|
|
1138
|
+
]
|
|
1139
|
+
}),
|
|
1140
|
+
/* @__PURE__ */ C("span", {
|
|
1141
|
+
className: "what",
|
|
1142
|
+
children: e.message
|
|
1143
|
+
}),
|
|
1144
|
+
e.detail ? /* @__PURE__ */ C("span", {
|
|
1145
|
+
className: "cause",
|
|
1146
|
+
children: e.detail
|
|
1147
|
+
}) : null
|
|
1148
|
+
]
|
|
1149
|
+
}, `${e.at}-${t}`))]
|
|
1150
|
+
})]
|
|
1151
|
+
});
|
|
1152
|
+
}, Ie = h`
|
|
1153
|
+
display: flex;
|
|
1154
|
+
align-items: center;
|
|
1155
|
+
justify-content: center;
|
|
1156
|
+
flex-direction: column;
|
|
1157
|
+
width: 100%;
|
|
1158
|
+
|
|
1159
|
+
.playback-slider {
|
|
1160
|
+
display: flex;
|
|
1161
|
+
align-items: center;
|
|
1162
|
+
|
|
1163
|
+
padding: 8px 4px;
|
|
1164
|
+
margin: 0 2px;
|
|
1165
|
+
/* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
|
|
1166
|
+
@media (pointer: coarse) {
|
|
1167
|
+
padding: 20px 8px;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
cursor: pointer;
|
|
1171
|
+
|
|
1172
|
+
> div {
|
|
1173
|
+
position: relative;
|
|
1174
|
+
|
|
1175
|
+
background: #ccc;
|
|
1176
|
+
border-radius: 4px;
|
|
1177
|
+
|
|
1178
|
+
width: 120px;
|
|
1179
|
+
max-width: 100%;
|
|
1180
|
+
height: 3px;
|
|
1181
|
+
@media (min-width: 768px) {
|
|
1182
|
+
height: 4px;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
.playback-handle {
|
|
1187
|
+
position: absolute;
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
background: #ffffff;
|
|
1191
|
+
border-radius: 50%;
|
|
1192
|
+
transform: translateX(-50%);
|
|
1193
|
+
pointer-events: none;
|
|
1194
|
+
|
|
1195
|
+
width: 10px;
|
|
1196
|
+
height: 10px;
|
|
1197
|
+
top: -3.5px;
|
|
1198
|
+
@media (min-width: 768px) {
|
|
1199
|
+
width: 12px;
|
|
1200
|
+
height: 12px;
|
|
1201
|
+
top: -4px;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
`, Le = () => {
|
|
1206
|
+
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({
|
|
1207
|
+
ref: r,
|
|
1208
|
+
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1209
|
+
}), f = (t) => {
|
|
1210
|
+
t.preventDefault();
|
|
1211
|
+
let n = .05, r = s;
|
|
1212
|
+
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
1213
|
+
};
|
|
1214
|
+
d(() => {
|
|
1215
|
+
let e = n.current;
|
|
1216
|
+
return e && e.addEventListener("wheel", f, { passive: !1 }), () => {
|
|
1217
|
+
e && e.removeEventListener("wheel", f);
|
|
1218
|
+
};
|
|
1219
|
+
}, [t]);
|
|
1220
|
+
let m = c(s);
|
|
1221
|
+
return /* @__PURE__ */ w("div", {
|
|
1222
|
+
css: Ie,
|
|
1223
|
+
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1224
|
+
className: "playback-slider",
|
|
1225
|
+
ref: n,
|
|
1226
|
+
...u,
|
|
1227
|
+
children: /* @__PURE__ */ C("div", {
|
|
1228
|
+
ref: r,
|
|
1229
|
+
style: { background: `linear-gradient(to right,
|
|
1230
|
+
#fff 0% ${m}%,
|
|
1231
|
+
#3A3A3A ${m}% 100%
|
|
1232
|
+
)` },
|
|
1233
|
+
children: /* @__PURE__ */ C("div", {
|
|
1234
|
+
className: "playback-handle",
|
|
1235
|
+
style: { left: `${m}%` }
|
|
1236
|
+
})
|
|
1237
|
+
})
|
|
1238
|
+
})]
|
|
1239
|
+
});
|
|
1240
|
+
}, Re = h`
|
|
1046
1241
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1047
1242
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1048
1243
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1060,7 +1255,7 @@ position: static;
|
|
|
1060
1255
|
}
|
|
1061
1256
|
}
|
|
1062
1257
|
|
|
1063
|
-
${
|
|
1258
|
+
${X}
|
|
1064
1259
|
|
|
1065
1260
|
.playback-rate {
|
|
1066
1261
|
.slider {
|
|
@@ -1101,8 +1296,8 @@ ${Y}
|
|
|
1101
1296
|
}
|
|
1102
1297
|
}
|
|
1103
1298
|
|
|
1104
|
-
`,
|
|
1105
|
-
let e =
|
|
1299
|
+
`, ze = () => {
|
|
1300
|
+
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
1301
|
e.setPlaybackRate(t), o(0);
|
|
1107
1302
|
}, h = (e) => {
|
|
1108
1303
|
e !== void 0 && f(e, () => i(e));
|
|
@@ -1110,10 +1305,10 @@ ${Y}
|
|
|
1110
1305
|
o(e);
|
|
1111
1306
|
};
|
|
1112
1307
|
return /* @__PURE__ */ w("div", {
|
|
1113
|
-
css:
|
|
1308
|
+
css: Re,
|
|
1114
1309
|
ref: l,
|
|
1115
1310
|
children: [
|
|
1116
|
-
/* @__PURE__ */ C(
|
|
1311
|
+
/* @__PURE__ */ C(q, {
|
|
1117
1312
|
id: "settings",
|
|
1118
1313
|
disabled: s,
|
|
1119
1314
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1122,7 +1317,7 @@ ${Y}
|
|
|
1122
1317
|
onClick: c,
|
|
1123
1318
|
"aria-label": "Settings",
|
|
1124
1319
|
"aria-expanded": s,
|
|
1125
|
-
children: /* @__PURE__ */ C(
|
|
1320
|
+
children: /* @__PURE__ */ C(ee, {})
|
|
1126
1321
|
}),
|
|
1127
1322
|
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1128
1323
|
}),
|
|
@@ -1130,13 +1325,13 @@ ${Y}
|
|
|
1130
1325
|
className: "popover menu",
|
|
1131
1326
|
children: [n.length > 1 ? /* @__PURE__ */ w("div", {
|
|
1132
1327
|
onClick: g(2),
|
|
1133
|
-
children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(
|
|
1328
|
+
children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(O, {}) })]
|
|
1134
1329
|
}) : null, /* @__PURE__ */ w("div", {
|
|
1135
1330
|
onClick: g(1),
|
|
1136
1331
|
children: [/* @__PURE__ */ C("div", { children: "Playback speed" }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("span", {
|
|
1137
1332
|
className: "secondary",
|
|
1138
1333
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
1139
|
-
}), /* @__PURE__ */ C(
|
|
1334
|
+
}), /* @__PURE__ */ C(O, {})] })]
|
|
1140
1335
|
})]
|
|
1141
1336
|
}),
|
|
1142
1337
|
s && a === 1 && /* @__PURE__ */ w("div", {
|
|
@@ -1145,11 +1340,11 @@ ${Y}
|
|
|
1145
1340
|
/* @__PURE__ */ w("div", {
|
|
1146
1341
|
className: "back",
|
|
1147
1342
|
onClick: g(0),
|
|
1148
|
-
children: [/* @__PURE__ */ C(
|
|
1343
|
+
children: [/* @__PURE__ */ C(D, {}), /* @__PURE__ */ C("span", { children: "Playback speed" })]
|
|
1149
1344
|
}),
|
|
1150
1345
|
/* @__PURE__ */ C("div", {
|
|
1151
1346
|
className: "slider no-hover",
|
|
1152
|
-
children: /* @__PURE__ */ C(
|
|
1347
|
+
children: /* @__PURE__ */ C(Le, {})
|
|
1153
1348
|
}),
|
|
1154
1349
|
/* @__PURE__ */ w("div", {
|
|
1155
1350
|
className: "options no-hover",
|
|
@@ -1174,7 +1369,7 @@ ${Y}
|
|
|
1174
1369
|
})
|
|
1175
1370
|
]
|
|
1176
1371
|
}),
|
|
1177
|
-
s && a === 2 && /* @__PURE__ */ C(
|
|
1372
|
+
s && a === 2 && /* @__PURE__ */ C(Ae, {
|
|
1178
1373
|
title: "Audio",
|
|
1179
1374
|
tracks: n,
|
|
1180
1375
|
selected: r,
|
|
@@ -1185,7 +1380,7 @@ ${Y}
|
|
|
1185
1380
|
})
|
|
1186
1381
|
]
|
|
1187
1382
|
});
|
|
1188
|
-
},
|
|
1383
|
+
}, Be = h`
|
|
1189
1384
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1190
1385
|
which is the width of the player box, so it can be clamped to it. */
|
|
1191
1386
|
position: static;
|
|
@@ -1201,15 +1396,15 @@ position: static;
|
|
|
1201
1396
|
}
|
|
1202
1397
|
}
|
|
1203
1398
|
|
|
1204
|
-
${
|
|
1205
|
-
`,
|
|
1206
|
-
let e =
|
|
1399
|
+
${X}
|
|
1400
|
+
`, Ve = () => {
|
|
1401
|
+
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
1402
|
if (e.length === 0) return null;
|
|
1208
1403
|
let u = t !== void 0;
|
|
1209
1404
|
return /* @__PURE__ */ w("div", {
|
|
1210
|
-
css:
|
|
1405
|
+
css: Be,
|
|
1211
1406
|
ref: o,
|
|
1212
|
-
children: [/* @__PURE__ */ C(
|
|
1407
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1213
1408
|
id: "subtitles",
|
|
1214
1409
|
disabled: i,
|
|
1215
1410
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1219,10 +1414,10 @@ ${Y}
|
|
|
1219
1414
|
"aria-label": "Subtitles",
|
|
1220
1415
|
"aria-expanded": i,
|
|
1221
1416
|
"aria-pressed": u,
|
|
1222
|
-
children: u ? /* @__PURE__ */ C(
|
|
1417
|
+
children: u ? /* @__PURE__ */ C(De, { className: "captions" }) : /* @__PURE__ */ C(Oe, { className: "captions-off" })
|
|
1223
1418
|
}),
|
|
1224
1419
|
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1225
|
-
}), i && /* @__PURE__ */ C(
|
|
1420
|
+
}), i && /* @__PURE__ */ C(Ae, {
|
|
1226
1421
|
title: "Subtitles",
|
|
1227
1422
|
tracks: e,
|
|
1228
1423
|
selected: t,
|
|
@@ -1232,14 +1427,14 @@ ${Y}
|
|
|
1232
1427
|
failed: c
|
|
1233
1428
|
})]
|
|
1234
1429
|
});
|
|
1235
|
-
},
|
|
1430
|
+
}, He = {
|
|
1236
1431
|
primary: "#EAEBEE",
|
|
1237
1432
|
secondary: "#D0D0D9",
|
|
1238
1433
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1239
1434
|
accent: "#6EA8FE",
|
|
1240
1435
|
borderPrimary: "#384F70",
|
|
1241
1436
|
backgroundTooltip: "#222222"
|
|
1242
|
-
},
|
|
1437
|
+
}, Ue = h`
|
|
1243
1438
|
display: flex;
|
|
1244
1439
|
align-items: center;
|
|
1245
1440
|
|
|
@@ -1282,8 +1477,8 @@ ${Y}
|
|
|
1282
1477
|
width: 10px;
|
|
1283
1478
|
height: 10px;
|
|
1284
1479
|
}
|
|
1285
|
-
`,
|
|
1286
|
-
let n =
|
|
1480
|
+
`, We = ({ value: e, onChange: t }) => {
|
|
1481
|
+
let n = L((e) => e.volume), r = L((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
|
|
1287
1482
|
ref: a,
|
|
1288
1483
|
onChange: t
|
|
1289
1484
|
}), s = (n) => {
|
|
@@ -1297,12 +1492,12 @@ ${Y}
|
|
|
1297
1492
|
e && e.removeEventListener("wheel", s);
|
|
1298
1493
|
};
|
|
1299
1494
|
}, [e]);
|
|
1300
|
-
let c = e * 100, l = f(() => Math.round(r ? 0 :
|
|
1301
|
-
return /* @__PURE__ */ C(
|
|
1495
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
|
|
1496
|
+
return /* @__PURE__ */ C(q, {
|
|
1302
1497
|
id: "volume-slider",
|
|
1303
1498
|
text: /* @__PURE__ */ C("div", {
|
|
1304
1499
|
ref: i,
|
|
1305
|
-
css:
|
|
1500
|
+
css: Ue,
|
|
1306
1501
|
...o,
|
|
1307
1502
|
children: /* @__PURE__ */ C("div", {
|
|
1308
1503
|
ref: a,
|
|
@@ -1321,7 +1516,7 @@ ${Y}
|
|
|
1321
1516
|
children: [l, "%"]
|
|
1322
1517
|
})
|
|
1323
1518
|
});
|
|
1324
|
-
},
|
|
1519
|
+
}, Ge = h`
|
|
1325
1520
|
position: relative;
|
|
1326
1521
|
display: flex;
|
|
1327
1522
|
align-items: center;
|
|
@@ -1346,7 +1541,7 @@ ${Y}
|
|
|
1346
1541
|
border-radius: 4px;
|
|
1347
1542
|
|
|
1348
1543
|
.volume-value {
|
|
1349
|
-
${
|
|
1544
|
+
${V.bMedium.regular};
|
|
1350
1545
|
color: #ffffff;
|
|
1351
1546
|
}
|
|
1352
1547
|
}
|
|
@@ -1384,11 +1579,11 @@ ${Y}
|
|
|
1384
1579
|
}
|
|
1385
1580
|
}
|
|
1386
1581
|
|
|
1387
|
-
`,
|
|
1388
|
-
let t =
|
|
1582
|
+
`, Ke = ({ ref: e }) => {
|
|
1583
|
+
let t = L(), n = L((e) => e.volume), r = L((e) => e.muted), i = f(() => G(n), [n]);
|
|
1389
1584
|
return /* @__PURE__ */ w("div", {
|
|
1390
|
-
css:
|
|
1391
|
-
children: [/* @__PURE__ */ C(
|
|
1585
|
+
css: Ge,
|
|
1586
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1392
1587
|
id: "sound",
|
|
1393
1588
|
text: /* @__PURE__ */ C("button", {
|
|
1394
1589
|
className: "sound",
|
|
@@ -1397,7 +1592,7 @@ ${Y}
|
|
|
1397
1592
|
ref: e,
|
|
1398
1593
|
"aria-label": "Mute",
|
|
1399
1594
|
"aria-pressed": r || n === 0,
|
|
1400
|
-
children: C(r || n === 0 ?
|
|
1595
|
+
children: C(r || n === 0 ? re : n <= .5 ? te : ne, {
|
|
1401
1596
|
size: 18,
|
|
1402
1597
|
color: "#fff"
|
|
1403
1598
|
})
|
|
@@ -1407,16 +1602,16 @@ ${Y}
|
|
|
1407
1602
|
className: "volume-slider-container",
|
|
1408
1603
|
children: /* @__PURE__ */ C("div", {
|
|
1409
1604
|
className: "volume-slider-background",
|
|
1410
|
-
children: /* @__PURE__ */ C(
|
|
1605
|
+
children: /* @__PURE__ */ C(We, {
|
|
1411
1606
|
value: r ? 0 : i,
|
|
1412
1607
|
onChange: (e) => {
|
|
1413
|
-
t.setVolume(
|
|
1608
|
+
t.setVolume(W(e));
|
|
1414
1609
|
}
|
|
1415
1610
|
})
|
|
1416
1611
|
})
|
|
1417
1612
|
})]
|
|
1418
1613
|
});
|
|
1419
|
-
},
|
|
1614
|
+
}, $ = .05, qe = 5, Je = h`
|
|
1420
1615
|
display: flex;
|
|
1421
1616
|
flex-direction: column;
|
|
1422
1617
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1427,7 +1622,7 @@ ${Y}
|
|
|
1427
1622
|
opacity: 0.72;
|
|
1428
1623
|
font-size: 0.9em;
|
|
1429
1624
|
}
|
|
1430
|
-
`,
|
|
1625
|
+
`, Ye = h`
|
|
1431
1626
|
position: absolute;
|
|
1432
1627
|
bottom: 0;
|
|
1433
1628
|
width: 100%;
|
|
@@ -1492,10 +1687,10 @@ ${Y}
|
|
|
1492
1687
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1493
1688
|
*/
|
|
1494
1689
|
button[aria-pressed='true'] svg {
|
|
1495
|
-
stroke: ${
|
|
1690
|
+
stroke: ${He.accent};
|
|
1496
1691
|
}
|
|
1497
1692
|
|
|
1498
|
-
.play, .sound, .time, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1693
|
+
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1499
1694
|
display: flex;
|
|
1500
1695
|
align-items: center;
|
|
1501
1696
|
|
|
@@ -1513,7 +1708,7 @@ ${Y}
|
|
|
1513
1708
|
}
|
|
1514
1709
|
}
|
|
1515
1710
|
|
|
1516
|
-
.play, .sound, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1711
|
+
.play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1517
1712
|
border-radius: 4px;
|
|
1518
1713
|
|
|
1519
1714
|
padding: 8px;
|
|
@@ -1527,7 +1722,7 @@ ${Y}
|
|
|
1527
1722
|
cursor: pointer;
|
|
1528
1723
|
|
|
1529
1724
|
:hover {
|
|
1530
|
-
background-color: ${
|
|
1725
|
+
background-color: ${He.hover};
|
|
1531
1726
|
}
|
|
1532
1727
|
|
|
1533
1728
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1544,7 +1739,7 @@ ${Y}
|
|
|
1544
1739
|
|
|
1545
1740
|
.left {
|
|
1546
1741
|
.time {
|
|
1547
|
-
${
|
|
1742
|
+
${V.bMedium.regular}
|
|
1548
1743
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1549
1744
|
}
|
|
1550
1745
|
}
|
|
@@ -1565,10 +1760,10 @@ ${Y}
|
|
|
1565
1760
|
}
|
|
1566
1761
|
}
|
|
1567
1762
|
}
|
|
1568
|
-
`,
|
|
1569
|
-
let e =
|
|
1570
|
-
let r =
|
|
1571
|
-
e.setVolume(
|
|
1763
|
+
`, Xe = () => {
|
|
1764
|
+
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 }) => {
|
|
1765
|
+
let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1766
|
+
e.setVolume(W(a)), o && !e.muted && e.toggleMuted();
|
|
1572
1767
|
}, [e]);
|
|
1573
1768
|
d(() => {
|
|
1574
1769
|
let t = (t) => {
|
|
@@ -1581,16 +1776,16 @@ ${Y}
|
|
|
1581
1776
|
else if (t.key === "m") e.toggleMuted();
|
|
1582
1777
|
else if (t.key === "ArrowUp") v({
|
|
1583
1778
|
direction: "up",
|
|
1584
|
-
stepSize:
|
|
1779
|
+
stepSize: $
|
|
1585
1780
|
});
|
|
1586
1781
|
else if (t.key === "ArrowDown") v({
|
|
1587
1782
|
direction: "down",
|
|
1588
|
-
stepSize:
|
|
1783
|
+
stepSize: $
|
|
1589
1784
|
});
|
|
1590
1785
|
else if (t.key === "ArrowRight") {
|
|
1591
1786
|
if (!e.duration) return;
|
|
1592
|
-
e.seek(Math.min(e.currentTime +
|
|
1593
|
-
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime -
|
|
1787
|
+
e.seek(Math.min(e.currentTime + qe, e.duration));
|
|
1788
|
+
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - qe, 0)) : r = !1;
|
|
1594
1789
|
r && t.preventDefault();
|
|
1595
1790
|
};
|
|
1596
1791
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
@@ -1598,26 +1793,26 @@ ${Y}
|
|
|
1598
1793
|
let y = u((e) => {
|
|
1599
1794
|
e.preventDefault(), e.deltaY < 0 ? v({
|
|
1600
1795
|
direction: "up",
|
|
1601
|
-
stepSize:
|
|
1796
|
+
stepSize: $
|
|
1602
1797
|
}) : v({
|
|
1603
1798
|
direction: "down",
|
|
1604
|
-
stepSize:
|
|
1799
|
+
stepSize: $
|
|
1605
1800
|
});
|
|
1606
1801
|
}, [v]);
|
|
1607
1802
|
return d(() => {
|
|
1608
1803
|
if (f) return f.addEventListener("wheel", y, { passive: !1 }), () => f.removeEventListener("wheel", y);
|
|
1609
1804
|
}, [f, y]), /* @__PURE__ */ w("div", {
|
|
1610
|
-
css:
|
|
1805
|
+
css: Ye,
|
|
1611
1806
|
style: { ...a ? {
|
|
1612
1807
|
opacity: "0",
|
|
1613
1808
|
pointerEvents: "none"
|
|
1614
1809
|
} : {} },
|
|
1615
|
-
children: [/* @__PURE__ */ C(
|
|
1810
|
+
children: [/* @__PURE__ */ C(Te, {}), /* @__PURE__ */ w("div", {
|
|
1616
1811
|
className: "actions",
|
|
1617
1812
|
children: [/* @__PURE__ */ w("div", {
|
|
1618
1813
|
className: "left",
|
|
1619
1814
|
children: [
|
|
1620
|
-
/* @__PURE__ */ C(
|
|
1815
|
+
/* @__PURE__ */ C(q, {
|
|
1621
1816
|
id: "play",
|
|
1622
1817
|
tooltipPlace: "top-start",
|
|
1623
1818
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1625,22 +1820,23 @@ ${Y}
|
|
|
1625
1820
|
type: "button",
|
|
1626
1821
|
onClick: () => e.togglePaused(),
|
|
1627
1822
|
"aria-label": _ ? "Replay" : t ? "Play" : "Pause",
|
|
1628
|
-
children: C(_ ?
|
|
1823
|
+
children: C(_ ? P : t ? N : M, {})
|
|
1629
1824
|
}),
|
|
1630
1825
|
toolTipText: /* @__PURE__ */ C("span", { children: _ ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1631
1826
|
}),
|
|
1632
|
-
/* @__PURE__ */ C(
|
|
1827
|
+
/* @__PURE__ */ C(Ke, { ref: p }),
|
|
1633
1828
|
/* @__PURE__ */ C("div", {
|
|
1634
1829
|
className: "time",
|
|
1635
|
-
children:
|
|
1830
|
+
children: Se(n, r)
|
|
1636
1831
|
})
|
|
1637
1832
|
]
|
|
1638
1833
|
}), /* @__PURE__ */ w("div", {
|
|
1639
1834
|
className: "right",
|
|
1640
1835
|
children: [
|
|
1641
|
-
/* @__PURE__ */ C(
|
|
1642
|
-
/* @__PURE__ */ C(
|
|
1643
|
-
|
|
1836
|
+
/* @__PURE__ */ C(Fe, {}),
|
|
1837
|
+
/* @__PURE__ */ C(Ve, {}),
|
|
1838
|
+
/* @__PURE__ */ C(ze, {}),
|
|
1839
|
+
o ? /* @__PURE__ */ C(q, {
|
|
1644
1840
|
id: "picture-in-picture",
|
|
1645
1841
|
tooltipPlace: "top-end",
|
|
1646
1842
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1650,13 +1846,13 @@ ${Y}
|
|
|
1650
1846
|
disabled: h && !g,
|
|
1651
1847
|
"aria-label": h ? "Put the subtitles in the video" : "Picture in picture",
|
|
1652
1848
|
"aria-pressed": h ? c : void 0,
|
|
1653
|
-
children: h ? /* @__PURE__ */ C(
|
|
1654
|
-
src:
|
|
1849
|
+
children: h ? /* @__PURE__ */ C(ke, {}) : /* @__PURE__ */ C("img", {
|
|
1850
|
+
src: Ee,
|
|
1655
1851
|
alt: ""
|
|
1656
1852
|
})
|
|
1657
1853
|
}),
|
|
1658
1854
|
toolTipText: /* @__PURE__ */ w("span", {
|
|
1659
|
-
css:
|
|
1855
|
+
css: Je,
|
|
1660
1856
|
children: [/* @__PURE__ */ C("span", {
|
|
1661
1857
|
className: "lead",
|
|
1662
1858
|
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 +1862,7 @@ ${Y}
|
|
|
1666
1862
|
}) : null]
|
|
1667
1863
|
})
|
|
1668
1864
|
}) : null,
|
|
1669
|
-
/* @__PURE__ */ C(
|
|
1865
|
+
/* @__PURE__ */ C(q, {
|
|
1670
1866
|
id: "full-screen",
|
|
1671
1867
|
tooltipPlace: "top-end",
|
|
1672
1868
|
text: /* @__PURE__ */ C("button", {
|
|
@@ -1675,7 +1871,7 @@ ${Y}
|
|
|
1675
1871
|
onClick: () => e.toggleFullscreen(),
|
|
1676
1872
|
"aria-label": "Full screen",
|
|
1677
1873
|
"aria-pressed": i,
|
|
1678
|
-
children: C(i ?
|
|
1874
|
+
children: C(i ? j : A, {})
|
|
1679
1875
|
}),
|
|
1680
1876
|
toolTipText: /* @__PURE__ */ C("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
|
|
1681
1877
|
})
|
|
@@ -1683,7 +1879,7 @@ ${Y}
|
|
|
1683
1879
|
})]
|
|
1684
1880
|
})]
|
|
1685
1881
|
});
|
|
1686
|
-
},
|
|
1882
|
+
}, Ze = 9e3, Qe = h`
|
|
1687
1883
|
position: absolute;
|
|
1688
1884
|
inset: 0;
|
|
1689
1885
|
z-index: 2;
|
|
@@ -1721,12 +1917,12 @@ ${Y}
|
|
|
1721
1917
|
}
|
|
1722
1918
|
|
|
1723
1919
|
.title {
|
|
1724
|
-
${
|
|
1920
|
+
${V.bMedium.bold}
|
|
1725
1921
|
color: #fff;
|
|
1726
1922
|
}
|
|
1727
1923
|
|
|
1728
1924
|
.body {
|
|
1729
|
-
${
|
|
1925
|
+
${V.bSmall.regular}
|
|
1730
1926
|
color: rgba(255, 255, 255, 0.75);
|
|
1731
1927
|
}
|
|
1732
1928
|
|
|
@@ -1737,18 +1933,18 @@ ${Y}
|
|
|
1737
1933
|
line-height: 1;
|
|
1738
1934
|
color: #6EA8FE;
|
|
1739
1935
|
}
|
|
1740
|
-
`,
|
|
1741
|
-
let e =
|
|
1936
|
+
`, $e = () => {
|
|
1937
|
+
let e = L((e) => e.burnedInSubtitles), t = L((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1742
1938
|
return d(() => {
|
|
1743
1939
|
if (t !== "burn-in" || !e) {
|
|
1744
1940
|
r(!1);
|
|
1745
1941
|
return;
|
|
1746
1942
|
}
|
|
1747
1943
|
r(!0);
|
|
1748
|
-
let n = setTimeout(() => r(!1),
|
|
1944
|
+
let n = setTimeout(() => r(!1), Ze);
|
|
1749
1945
|
return () => clearTimeout(n);
|
|
1750
1946
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1751
|
-
css:
|
|
1947
|
+
css: Qe,
|
|
1752
1948
|
className: n ? "show" : "",
|
|
1753
1949
|
role: "status",
|
|
1754
1950
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -1769,7 +1965,7 @@ ${Y}
|
|
|
1769
1965
|
})]
|
|
1770
1966
|
})
|
|
1771
1967
|
});
|
|
1772
|
-
},
|
|
1968
|
+
}, et = 3e3, tt = h`
|
|
1773
1969
|
position: absolute;
|
|
1774
1970
|
inset: 0;
|
|
1775
1971
|
z-index: 2;
|
|
@@ -1780,7 +1976,7 @@ ${Y}
|
|
|
1780
1976
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1781
1977
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1782
1978
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1783
|
-
`,
|
|
1979
|
+
`, nt = h`
|
|
1784
1980
|
position: relative;
|
|
1785
1981
|
background-color: black;
|
|
1786
1982
|
display: flex;
|
|
@@ -1812,20 +2008,20 @@ ${Y}
|
|
|
1812
2008
|
&.hide {
|
|
1813
2009
|
cursor: none;
|
|
1814
2010
|
}
|
|
1815
|
-
`,
|
|
2011
|
+
`, rt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
1816
2012
|
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
1817
|
-
return l(e) && e.type === c ?
|
|
2013
|
+
return l(e) && e.type === c ? rt(e.props.children, `${r}/`) : [{
|
|
1818
2014
|
key: r,
|
|
1819
2015
|
item: e
|
|
1820
2016
|
}];
|
|
1821
|
-
}),
|
|
1822
|
-
let o =
|
|
2017
|
+
}), it = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
2018
|
+
let o = L(), s = L((e) => e.hideUI), c = L((e) => e.setHideUI), l = p(void 0), u = p("mouse");
|
|
1823
2019
|
d(() => () => clearTimeout(l.current), []);
|
|
1824
2020
|
let f = () => {
|
|
1825
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
2021
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), et);
|
|
1826
2022
|
};
|
|
1827
2023
|
return /* @__PURE__ */ w("div", {
|
|
1828
|
-
css:
|
|
2024
|
+
css: nt,
|
|
1829
2025
|
ref: e,
|
|
1830
2026
|
onPointerMove: (e) => {
|
|
1831
2027
|
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
@@ -1841,9 +2037,9 @@ ${Y}
|
|
|
1841
2037
|
},
|
|
1842
2038
|
className: s ? "hide" : "",
|
|
1843
2039
|
children: [
|
|
1844
|
-
/* @__PURE__ */ C(
|
|
1845
|
-
|
|
1846
|
-
css:
|
|
2040
|
+
/* @__PURE__ */ C(xe, { onCanvasRef: n }),
|
|
2041
|
+
rt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2042
|
+
css: tt,
|
|
1847
2043
|
style: { ...s ? {
|
|
1848
2044
|
opacity: "0",
|
|
1849
2045
|
visibility: "hidden",
|
|
@@ -1851,8 +2047,8 @@ ${Y}
|
|
|
1851
2047
|
} : {} },
|
|
1852
2048
|
children: t
|
|
1853
2049
|
}, e)),
|
|
1854
|
-
i === !1 ? null : /* @__PURE__ */ C(
|
|
1855
|
-
/* @__PURE__ */ C(
|
|
2050
|
+
i === !1 ? null : /* @__PURE__ */ C(Xe, {}),
|
|
2051
|
+
/* @__PURE__ */ C($e, {}),
|
|
1856
2052
|
/* @__PURE__ */ w("div", {
|
|
1857
2053
|
className: "video",
|
|
1858
2054
|
onClick: () => {
|
|
@@ -1869,16 +2065,16 @@ ${Y}
|
|
|
1869
2065
|
})
|
|
1870
2066
|
]
|
|
1871
2067
|
});
|
|
1872
|
-
},
|
|
2068
|
+
}, at = ({ options: e, children: t }) => {
|
|
1873
2069
|
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 =
|
|
2070
|
+
d(() => (p?.(S), () => p?.(null)), [S, p]), pe(g, b, r);
|
|
2071
|
+
let w = z({
|
|
1876
2072
|
publicPath: s,
|
|
1877
2073
|
workerUrl: c,
|
|
1878
2074
|
length: f === !1 ? void 0 : a,
|
|
1879
2075
|
read: u ?? l,
|
|
1880
2076
|
downloadedRanges: o
|
|
1881
|
-
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } =
|
|
2077
|
+
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = B(g, b), k = L((e) => e.setSourceState);
|
|
1882
2078
|
d(() => {
|
|
1883
2079
|
k({
|
|
1884
2080
|
title: i,
|
|
@@ -1930,7 +2126,7 @@ ${Y}
|
|
|
1930
2126
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
1931
2127
|
selectAudioTrack: (e) => M.select(String(e))
|
|
1932
2128
|
});
|
|
1933
|
-
}, [k, M]), /* @__PURE__ */ C(
|
|
2129
|
+
}, [k, M]), /* @__PURE__ */ C(it, {
|
|
1934
2130
|
ref: h,
|
|
1935
2131
|
onVideoRef: n ? void 0 : _,
|
|
1936
2132
|
onCanvasRef: x,
|
|
@@ -1938,7 +2134,7 @@ ${Y}
|
|
|
1938
2134
|
controls: e.controls,
|
|
1939
2135
|
children: t
|
|
1940
2136
|
});
|
|
1941
|
-
},
|
|
2137
|
+
}, ot = h`
|
|
1942
2138
|
/**
|
|
1943
2139
|
* The chrome's whole scale, in one place.
|
|
1944
2140
|
*
|
|
@@ -2008,17 +2204,17 @@ ${Y}
|
|
|
2008
2204
|
height: 100%;
|
|
2009
2205
|
width: 100%;
|
|
2010
2206
|
overflow: hidden;
|
|
2011
|
-
`,
|
|
2012
|
-
css:
|
|
2013
|
-
children: /* @__PURE__ */ C(
|
|
2207
|
+
`, st = (e) => /* @__PURE__ */ C("div", {
|
|
2208
|
+
css: ot,
|
|
2209
|
+
children: /* @__PURE__ */ C(I.Provider, { children: /* @__PURE__ */ C(at, {
|
|
2014
2210
|
options: e,
|
|
2015
2211
|
children: e.children
|
|
2016
2212
|
}) })
|
|
2017
|
-
}),
|
|
2213
|
+
}), ct = (e) => !!e && typeof e == "object" && "at" in e, lt = (e) => !!e && typeof e == "object" && "selection" in e, ut = ({ blob: e, name: t }) => ({
|
|
2018
2214
|
length: e.size,
|
|
2019
2215
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2020
2216
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2021
|
-
}),
|
|
2217
|
+
}), dt = async (e, t) => {
|
|
2022
2218
|
let n = await fetch(e, {
|
|
2023
2219
|
headers: { Range: "bytes=0-1" },
|
|
2024
2220
|
credentials: t
|
|
@@ -2028,8 +2224,8 @@ ${Y}
|
|
|
2028
2224
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2029
2225
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2030
2226
|
return i;
|
|
2031
|
-
},
|
|
2032
|
-
let i = t ?? await
|
|
2227
|
+
}, ft = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2228
|
+
let i = t ?? await dt(e, r);
|
|
2033
2229
|
return {
|
|
2034
2230
|
length: i,
|
|
2035
2231
|
name: n,
|
|
@@ -2042,9 +2238,9 @@ ${Y}
|
|
|
2042
2238
|
return a.arrayBuffer();
|
|
2043
2239
|
}
|
|
2044
2240
|
};
|
|
2045
|
-
},
|
|
2046
|
-
if ("blob" in e) return
|
|
2047
|
-
if ("url" in e) return
|
|
2241
|
+
}, pt = async (e) => {
|
|
2242
|
+
if ("blob" in e) return ut(e);
|
|
2243
|
+
if ("url" in e) return ft(e);
|
|
2048
2244
|
if ("read" in e) return {
|
|
2049
2245
|
length: e.length,
|
|
2050
2246
|
name: e.name,
|
|
@@ -2053,4 +2249,4 @@ ${Y}
|
|
|
2053
2249
|
throw Error(`Unknown source type: ${e}`);
|
|
2054
2250
|
};
|
|
2055
2251
|
//#endregion
|
|
2056
|
-
export {
|
|
2252
|
+
export { st as MediaPlayer, st as default, I as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, pt as inputToRemuxerInput, lt as isDelegatedTracks, ct as isExternalThumbnails, F as sourceFeature, i as startPlayback, B as usePictureInPicture, L as usePlayer, z as useSeekThumbnails };
|