@banou/media-player 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +2 -2
- package/dist/engine/playback.d.ts +13 -0
- package/dist/{engine-BwK7ycv0.js → engine-Cownv8gD.js} +134 -98
- package/dist/index.js +377 -351
- package/dist/react/video-player.d.ts +9 -0
- package/package.json +1 -1
- package/src/lib/engine/index.ts +1 -1
- package/src/lib/engine/playback.ts +113 -6
- package/src/lib/react/hooks/use-playback.ts +38 -2
- package/src/lib/react/video-player.tsx +9 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Children as
|
|
3
|
-
import { css as
|
|
4
|
-
import { createPlayer as
|
|
5
|
-
import { definePlayerFeature as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { ChevronLeft as
|
|
1
|
+
import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-Cownv8gD.js";
|
|
2
|
+
import { Children as s, Fragment as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
3
|
+
import { css as h, keyframes as g } from "@emotion/react";
|
|
4
|
+
import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
|
|
5
|
+
import { definePlayerFeature as b, videoFeatures as x } from "@videojs/core/dom";
|
|
6
|
+
import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
|
|
7
|
+
import { ChevronLeft as T, ChevronRight as E, Maximize as D, Minimize as O, Pause as k, Play as A, RotateCcw as j, Settings as M, Volume1 as N, Volume2 as ee, VolumeX as te } from "react-feather";
|
|
8
8
|
import { Tooltip as ne } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
10
|
var re = {
|
|
@@ -24,7 +24,7 @@ var re = {
|
|
|
24
24
|
playbackError: null,
|
|
25
25
|
ready: !1,
|
|
26
26
|
setSourceState: () => {}
|
|
27
|
-
},
|
|
27
|
+
}, P = b({
|
|
28
28
|
name: "source",
|
|
29
29
|
state: () => ({ ...re }),
|
|
30
30
|
attach({ set: e }) {
|
|
@@ -33,10 +33,10 @@ var re = {
|
|
|
33
33
|
setHideUI: (t) => e({ hideUI: t })
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
}),
|
|
37
|
-
features: [...
|
|
36
|
+
}), F = _({
|
|
37
|
+
features: [...x, P],
|
|
38
38
|
displayName: "MediaPlayer"
|
|
39
|
-
}),
|
|
39
|
+
}), I = F.usePlayer, ie = (e) => {
|
|
40
40
|
if (!(!e || e === "und")) try {
|
|
41
41
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
42
42
|
type: "language",
|
|
@@ -45,130 +45,156 @@ var re = {
|
|
|
45
45
|
} catch {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
},
|
|
49
|
-
let t = e.map((e) => ie(e.language) ??
|
|
48
|
+
}, L = (e) => e?.replace(/_/g, " ").trim() || void 0, ae = (e) => {
|
|
49
|
+
let t = e.map((e) => ie(e.language) ?? L(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
50
50
|
...e,
|
|
51
51
|
[t]: (e[t] ?? 0) + 1
|
|
52
52
|
}), {});
|
|
53
53
|
return e.map((e, r) => {
|
|
54
|
-
let i = t[r], a =
|
|
54
|
+
let i = t[r], a = L(e.title);
|
|
55
55
|
return {
|
|
56
56
|
track: e,
|
|
57
57
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
58
58
|
};
|
|
59
59
|
});
|
|
60
|
-
},
|
|
60
|
+
}, oe = (e) => ae(e).map(({ track: e, label: t }) => ({
|
|
61
61
|
id: e.streamIndex,
|
|
62
62
|
label: t
|
|
63
|
-
})),
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
})), se = 3, ce = 6e4, le = (e, t, r) => {
|
|
64
|
+
let a = I(), { 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
|
+
count: 0,
|
|
66
|
+
at: 0
|
|
67
|
+
});
|
|
68
|
+
d(() => {
|
|
69
|
+
w.current = {
|
|
70
|
+
count: 0,
|
|
71
|
+
at: 0
|
|
72
|
+
};
|
|
73
|
+
}, [s]);
|
|
74
|
+
let T = p(null), E = p(null), D = p(!1), O = p(o);
|
|
75
|
+
O.current = o;
|
|
76
|
+
let k = p(r?.onSeek);
|
|
77
|
+
k.current = r?.onSeek;
|
|
78
|
+
let A = p(r?.onPlaybackError);
|
|
79
|
+
A.current = r?.onPlaybackError;
|
|
80
|
+
let j = u((e) => {
|
|
71
81
|
let t = typeof e == "number" ? e : void 0;
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
typeof e == "number" && (
|
|
75
|
-
}, [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
selectSubtitleTrack:
|
|
79
|
-
selectAudioTrack:
|
|
82
|
+
D.current = !0, a.setSourceState({ selectedSubtitleTrack: t }), T.current?.selectSubtitleStream(t);
|
|
83
|
+
}, [a]), M = u((e) => {
|
|
84
|
+
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), x(e));
|
|
85
|
+
}, [a]), N = I((e) => e.setSourceState);
|
|
86
|
+
d(() => {
|
|
87
|
+
N({
|
|
88
|
+
selectSubtitleTrack: j,
|
|
89
|
+
selectAudioTrack: M
|
|
80
90
|
});
|
|
81
91
|
}, [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
]),
|
|
86
|
-
if (!
|
|
92
|
+
N,
|
|
93
|
+
j,
|
|
94
|
+
M
|
|
95
|
+
]), d(() => {
|
|
96
|
+
if (!e || !t || !s || !o) return;
|
|
87
97
|
let r = !1;
|
|
88
|
-
|
|
98
|
+
a.setSourceState({
|
|
89
99
|
playbackError: null,
|
|
90
100
|
ready: !1
|
|
91
101
|
});
|
|
92
|
-
let
|
|
93
|
-
|
|
102
|
+
let u = (e) => {
|
|
103
|
+
if (!r) {
|
|
104
|
+
if (n(e)) {
|
|
105
|
+
let t = performance.now();
|
|
106
|
+
if (t - w.current.at > ce && (w.current = {
|
|
107
|
+
count: 0,
|
|
108
|
+
at: t
|
|
109
|
+
}), w.current.count < se) {
|
|
110
|
+
w.current = {
|
|
111
|
+
count: w.current.count + 1,
|
|
112
|
+
at: t
|
|
113
|
+
}, console.warn("the media element failed; rebuilding the pipeline", e), C((e) => e + 1);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), A.current?.(e);
|
|
118
|
+
}
|
|
94
119
|
};
|
|
95
120
|
return (async () => {
|
|
96
121
|
try {
|
|
97
|
-
let
|
|
98
|
-
videoElement:
|
|
99
|
-
canvasElement:
|
|
100
|
-
read: (e, t) =>
|
|
101
|
-
length:
|
|
102
|
-
publicPath:
|
|
103
|
-
libavWorkerUrl:
|
|
104
|
-
jassubWorkerUrl:
|
|
105
|
-
jassubWasmUrl:
|
|
106
|
-
jassubLegacyWasmUrl:
|
|
107
|
-
defaultFontUrl:
|
|
108
|
-
bufferSize:
|
|
109
|
-
audioStreamIndex:
|
|
122
|
+
let n = await i({
|
|
123
|
+
videoElement: e,
|
|
124
|
+
canvasElement: t,
|
|
125
|
+
read: (e, t) => O.current(e, t),
|
|
126
|
+
length: s,
|
|
127
|
+
publicPath: c,
|
|
128
|
+
libavWorkerUrl: l,
|
|
129
|
+
jassubWorkerUrl: f,
|
|
130
|
+
jassubWasmUrl: h,
|
|
131
|
+
jassubLegacyWasmUrl: g,
|
|
132
|
+
defaultFontUrl: _,
|
|
133
|
+
bufferSize: v,
|
|
134
|
+
audioStreamIndex: b,
|
|
110
135
|
onReady: () => {
|
|
111
136
|
if (r) return;
|
|
112
|
-
|
|
113
|
-
let
|
|
114
|
-
|
|
137
|
+
a.setSourceState({ ready: !0 });
|
|
138
|
+
let t = E.current;
|
|
139
|
+
E.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
115
140
|
},
|
|
116
|
-
onError:
|
|
141
|
+
onError: u,
|
|
117
142
|
onRecovered: () => {
|
|
118
|
-
r ||
|
|
143
|
+
r || a.setSourceState({ playbackError: null });
|
|
119
144
|
},
|
|
120
|
-
onSeek: (e) =>
|
|
145
|
+
onSeek: (e) => k.current?.(e),
|
|
121
146
|
onSubtitleStreams: (e) => {
|
|
122
|
-
r ||
|
|
123
|
-
subtitleTracks:
|
|
124
|
-
...
|
|
147
|
+
r || a.setSourceState({
|
|
148
|
+
subtitleTracks: oe(e),
|
|
149
|
+
...D.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
125
150
|
});
|
|
126
151
|
},
|
|
127
152
|
onAudioStreams: (e, t) => {
|
|
128
|
-
r ||
|
|
129
|
-
audioTracks:
|
|
153
|
+
r || a.setSourceState({
|
|
154
|
+
audioTracks: oe(e),
|
|
130
155
|
selectedAudioTrack: t
|
|
131
156
|
});
|
|
132
157
|
}
|
|
133
158
|
});
|
|
134
159
|
if (r) {
|
|
135
|
-
|
|
160
|
+
n.destroy();
|
|
136
161
|
return;
|
|
137
162
|
}
|
|
138
|
-
|
|
139
|
-
let
|
|
140
|
-
typeof
|
|
163
|
+
T.current = n, a.setSourceState({ indexes: n.indexes });
|
|
164
|
+
let o = a.selectedSubtitleTrack;
|
|
165
|
+
typeof o == "number" && n.selectSubtitleStream(o);
|
|
141
166
|
} catch (e) {
|
|
142
|
-
|
|
167
|
+
u(e);
|
|
143
168
|
}
|
|
144
169
|
})(), () => {
|
|
145
|
-
r = !0,
|
|
146
|
-
time:
|
|
147
|
-
size:
|
|
148
|
-
},
|
|
170
|
+
r = !0, E.current = {
|
|
171
|
+
time: e.currentTime,
|
|
172
|
+
size: s
|
|
173
|
+
}, T.current?.destroy(), T.current = null, a.setSourceState({ ready: !1 });
|
|
149
174
|
};
|
|
150
175
|
}, [
|
|
151
|
-
|
|
176
|
+
a,
|
|
177
|
+
e,
|
|
152
178
|
t,
|
|
153
|
-
n,
|
|
154
|
-
o,
|
|
155
179
|
s,
|
|
156
180
|
c,
|
|
157
|
-
|
|
158
|
-
|
|
181
|
+
l,
|
|
182
|
+
f,
|
|
159
183
|
h,
|
|
160
184
|
g,
|
|
161
185
|
_,
|
|
186
|
+
v,
|
|
187
|
+
b,
|
|
162
188
|
y,
|
|
163
|
-
|
|
189
|
+
S
|
|
164
190
|
]);
|
|
165
|
-
},
|
|
166
|
-
let [o, s] =
|
|
191
|
+
}, ue = 5e3, de = 6e4, R = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
192
|
+
let [o, s] = m([]), c = p(null), l = p(i);
|
|
167
193
|
l.current = i;
|
|
168
|
-
let
|
|
169
|
-
return h.current =
|
|
194
|
+
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
195
|
+
return h.current = u, d(() => {
|
|
170
196
|
if (!n || !i || !e || !t) return;
|
|
171
|
-
let a = !1, o = null, u, d =
|
|
197
|
+
let a = !1, o = null, u, d = ue, f = () => {
|
|
172
198
|
r({
|
|
173
199
|
publicPath: e,
|
|
174
200
|
workerUrl: t,
|
|
@@ -184,7 +210,7 @@ var re = {
|
|
|
184
210
|
}
|
|
185
211
|
o = e, c.current = e, e.update(h.current);
|
|
186
212
|
}, () => {
|
|
187
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
213
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, de));
|
|
188
214
|
});
|
|
189
215
|
};
|
|
190
216
|
return f(), () => {
|
|
@@ -194,34 +220,34 @@ var re = {
|
|
|
194
220
|
n,
|
|
195
221
|
e,
|
|
196
222
|
t
|
|
197
|
-
]),
|
|
198
|
-
c.current?.update(
|
|
199
|
-
}, [
|
|
200
|
-
}, z = (e,
|
|
201
|
-
let r =
|
|
202
|
-
|
|
203
|
-
if (!e || !
|
|
204
|
-
let
|
|
223
|
+
]), d(() => {
|
|
224
|
+
c.current?.update(u);
|
|
225
|
+
}, [u]), o;
|
|
226
|
+
}, z = (e, n) => {
|
|
227
|
+
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
228
|
+
d(() => {
|
|
229
|
+
if (!e || !n || !s) return;
|
|
230
|
+
let t = a({
|
|
205
231
|
video: e,
|
|
206
|
-
canvas:
|
|
232
|
+
canvas: n,
|
|
207
233
|
mode: s,
|
|
208
234
|
onBurnedInChange: o
|
|
209
235
|
});
|
|
210
|
-
return r.current =
|
|
211
|
-
|
|
236
|
+
return r.current = t, () => {
|
|
237
|
+
t.destroy(), r.current = null, o(!1);
|
|
212
238
|
};
|
|
213
239
|
}, [
|
|
214
240
|
e,
|
|
215
|
-
|
|
241
|
+
n,
|
|
216
242
|
s
|
|
217
243
|
]);
|
|
218
|
-
let c =
|
|
244
|
+
let c = u(() => {
|
|
219
245
|
r.current?.toggle().catch((e) => {
|
|
220
246
|
console.warn("picture in picture was refused", e);
|
|
221
247
|
});
|
|
222
248
|
}, []);
|
|
223
249
|
return {
|
|
224
|
-
toggle: e &&
|
|
250
|
+
toggle: e && n && s ? c : null,
|
|
225
251
|
mode: s,
|
|
226
252
|
burnedIn: i
|
|
227
253
|
};
|
|
@@ -252,14 +278,14 @@ var re = {
|
|
|
252
278
|
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 ",
|
|
253
279
|
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 "
|
|
254
280
|
}
|
|
255
|
-
},
|
|
281
|
+
}, fe = h`
|
|
256
282
|
top: unset !important;
|
|
257
283
|
left: unset !important;
|
|
258
284
|
width: 100%;
|
|
259
285
|
height: 100%;
|
|
260
286
|
margin: auto;
|
|
261
287
|
pointer-events: none;
|
|
262
|
-
`,
|
|
288
|
+
`, pe = h`
|
|
263
289
|
position: absolute;
|
|
264
290
|
top: 0;
|
|
265
291
|
left: 0;
|
|
@@ -288,7 +314,7 @@ var re = {
|
|
|
288
314
|
|
|
289
315
|
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%);
|
|
290
316
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
291
|
-
`,
|
|
317
|
+
`, me = h`
|
|
292
318
|
position: absolute;
|
|
293
319
|
inset: 0;
|
|
294
320
|
z-index: 2;
|
|
@@ -304,11 +330,11 @@ var re = {
|
|
|
304
330
|
border-radius: 50%;
|
|
305
331
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
306
332
|
border-top-color: #fff;
|
|
307
|
-
animation: ${
|
|
333
|
+
animation: ${g`
|
|
308
334
|
to { transform: rotate(360deg); }
|
|
309
335
|
`} 0.8s linear infinite;
|
|
310
336
|
}
|
|
311
|
-
`,
|
|
337
|
+
`, he = h`
|
|
312
338
|
position: absolute;
|
|
313
339
|
inset: auto 0 20%;
|
|
314
340
|
z-index: 3;
|
|
@@ -318,33 +344,33 @@ var re = {
|
|
|
318
344
|
${B.bLarge.regular}
|
|
319
345
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
320
346
|
pointer-events: none;
|
|
321
|
-
`,
|
|
322
|
-
let t =
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
t ? /* @__PURE__ */
|
|
347
|
+
`, ge = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", _e = ({ onCanvasRef: e }) => {
|
|
348
|
+
let t = I((e) => e.title), n = I((e) => e.hideUI), r = I((e) => e.playbackError), i = I((e) => e.ready), a = I((e) => e.size), o = I((e) => e.waiting);
|
|
349
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
350
|
+
t ? /* @__PURE__ */ C("div", {
|
|
325
351
|
className: "title",
|
|
326
|
-
css:
|
|
352
|
+
css: pe,
|
|
327
353
|
style: { ...n ? {
|
|
328
354
|
opacity: "0",
|
|
329
355
|
pointerEvents: "none"
|
|
330
356
|
} : {} },
|
|
331
357
|
children: t
|
|
332
358
|
}) : void 0,
|
|
333
|
-
(a ? !i : o) && !r ? /* @__PURE__ */
|
|
334
|
-
r ? /* @__PURE__ */
|
|
335
|
-
css:
|
|
336
|
-
children:
|
|
359
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: me }) : void 0,
|
|
360
|
+
r ? /* @__PURE__ */ C("div", {
|
|
361
|
+
css: he,
|
|
362
|
+
children: ge(r)
|
|
337
363
|
}) : void 0,
|
|
338
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ C("canvas", {
|
|
339
365
|
ref: e,
|
|
340
|
-
css:
|
|
366
|
+
css: fe
|
|
341
367
|
})
|
|
342
368
|
] });
|
|
343
369
|
}, V = 1e-4, H = 1, U = (e) => Math.max(V, Math.min(H, e)) ** 2, W = (e) => Math.max(V, Math.min(H, e)) ** (H / 2), G = (e) => {
|
|
344
370
|
if (e === void 0) return "0:00";
|
|
345
371
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
346
372
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
347
|
-
},
|
|
373
|
+
}, ve = (e, t) => `${G(e)} / ${G(t)}`, ye = (e) => h`
|
|
348
374
|
display: flex;
|
|
349
375
|
justify-content: flex-end;
|
|
350
376
|
|
|
@@ -357,16 +383,16 @@ var re = {
|
|
|
357
383
|
${B.bMedium.regular}
|
|
358
384
|
}
|
|
359
385
|
|
|
360
|
-
${e === "sm" &&
|
|
386
|
+
${e === "sm" && h`
|
|
361
387
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
362
388
|
`}
|
|
363
|
-
${e === "md" &&
|
|
389
|
+
${e === "md" && h`
|
|
364
390
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
365
391
|
`}
|
|
366
|
-
${e === "lg" &&
|
|
392
|
+
${e === "lg" && h`
|
|
367
393
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
368
394
|
`}
|
|
369
|
-
`, K = ({ 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__ */
|
|
395
|
+
`, K = ({ 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", {
|
|
370
396
|
"data-tooltip-id": e,
|
|
371
397
|
"data-open": !0,
|
|
372
398
|
"data-tooltip-offset": a,
|
|
@@ -374,39 +400,39 @@ var re = {
|
|
|
374
400
|
"data-tooltip-delay-hide": i,
|
|
375
401
|
"data-tooltip-place": o,
|
|
376
402
|
children: n
|
|
377
|
-
}), !s && /* @__PURE__ */
|
|
378
|
-
css:
|
|
403
|
+
}), !s && /* @__PURE__ */ C(ne, {
|
|
404
|
+
css: ye(c),
|
|
379
405
|
id: e,
|
|
380
406
|
noArrow: !0,
|
|
381
407
|
children: t
|
|
382
408
|
})] }), q = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
383
|
-
let [i, a] =
|
|
409
|
+
let [i, a] = m(!1), o = p(t);
|
|
384
410
|
o.current = t;
|
|
385
|
-
let s =
|
|
411
|
+
let s = p(null), c = u((t, r) => {
|
|
386
412
|
let i = e.current;
|
|
387
413
|
if (!i) return 0;
|
|
388
414
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
389
415
|
return Math.min(Math.max(l, 0), 1);
|
|
390
|
-
}, [e, n]),
|
|
416
|
+
}, [e, n]), l = u((e) => {
|
|
391
417
|
r || e.button > 0 || (s.current = e.pointerId, e.currentTarget.setPointerCapture?.(e.pointerId), a(!0), o.current(c(e.clientX, e.clientY)));
|
|
392
|
-
}, [r, c]),
|
|
418
|
+
}, [r, c]), f = u((e) => {
|
|
393
419
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
394
|
-
}, [c]), h =
|
|
420
|
+
}, [c]), h = u((e) => {
|
|
395
421
|
s.current === e.pointerId && (s.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), a(!1));
|
|
396
422
|
}, []);
|
|
397
|
-
return
|
|
423
|
+
return d(() => {
|
|
398
424
|
r && (s.current = null, a(!1));
|
|
399
425
|
}, [r]), {
|
|
400
426
|
dragging: i,
|
|
401
427
|
handlers: {
|
|
402
|
-
onPointerDown:
|
|
403
|
-
onPointerMove:
|
|
428
|
+
onPointerDown: l,
|
|
429
|
+
onPointerMove: f,
|
|
404
430
|
onPointerUp: h,
|
|
405
431
|
onPointerCancel: h,
|
|
406
432
|
style: { touchAction: "none" }
|
|
407
433
|
}
|
|
408
434
|
};
|
|
409
|
-
},
|
|
435
|
+
}, be = h`
|
|
410
436
|
position: relative;
|
|
411
437
|
height: calc(.4 * var(--mp-unit));
|
|
412
438
|
|
|
@@ -577,30 +603,30 @@ var re = {
|
|
|
577
603
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
578
604
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
579
605
|
}
|
|
580
|
-
`,
|
|
581
|
-
let e =
|
|
606
|
+
`, xe = () => {
|
|
607
|
+
let e = I(), t = I((e) => e.currentTime), n = I((e) => e.duration), r = I((e) => e.size), i = I((e) => e.downloadedRanges), a = I((e) => e.indexes), o = I((e) => e.thumbnails), s = I((e) => e.thumbnailAt), c = p(null), [l, u] = m(void 0), [h, g] = m(void 0), _ = p(void 0), { dragging: v, handlers: y } = q({
|
|
582
608
|
ref: c,
|
|
583
609
|
onChange: (e) => {
|
|
584
|
-
|
|
610
|
+
u(e), _.current !== "mouse" && g(e * n);
|
|
585
611
|
}
|
|
586
612
|
}), b = (e) => {
|
|
587
613
|
_.current = e.pointerType, y.onPointerDown(e);
|
|
588
614
|
}, x = (e) => {
|
|
589
615
|
y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
|
|
590
|
-
},
|
|
616
|
+
}, S = (e) => {
|
|
591
617
|
if (!c.current) return;
|
|
592
618
|
let { left: t, right: r } = c.current.getBoundingClientRect();
|
|
593
619
|
return Math.min(Math.max((e - t) / (r - t), 0), 1) * n;
|
|
594
620
|
}, T = (e) => {
|
|
595
|
-
g(
|
|
621
|
+
g(S(e.clientX));
|
|
596
622
|
}, E = () => {
|
|
597
623
|
c.current && g(void 0);
|
|
598
|
-
}, D = (e) => n ? e / n * 100 : 0, O =
|
|
624
|
+
}, D = (e) => n ? e / n * 100 : 0, O = f(() => i?.map((e, t) => {
|
|
599
625
|
if (!r || !n) return null;
|
|
600
626
|
let i = a.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), o = i.at(0), s = i.at(-1);
|
|
601
627
|
if (!o || !s) return null;
|
|
602
628
|
let c = o.timestamp / n, l = s.timestamp / n, u = Number((l - c).toFixed(2)), d = c * 100;
|
|
603
|
-
return /* @__PURE__ */
|
|
629
|
+
return /* @__PURE__ */ C("div", {
|
|
604
630
|
className: "loaded-part",
|
|
605
631
|
style: {
|
|
606
632
|
transform: `scaleX(${u})`,
|
|
@@ -611,12 +637,12 @@ var re = {
|
|
|
611
637
|
n,
|
|
612
638
|
a.length,
|
|
613
639
|
i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
614
|
-
]), k =
|
|
640
|
+
]), k = f(() => {
|
|
615
641
|
if (!h || h < 0) return;
|
|
616
642
|
let e = Math.floor(h / 3600), t = Math.floor((h - e * 3600) / 60), n = Math.floor(h - e * 3600 - t * 60);
|
|
617
643
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
618
644
|
}, [h]);
|
|
619
|
-
|
|
645
|
+
d(() => {
|
|
620
646
|
if (l === void 0 || !n) return;
|
|
621
647
|
let t = l * n;
|
|
622
648
|
e.seek(t);
|
|
@@ -625,7 +651,7 @@ var re = {
|
|
|
625
651
|
l,
|
|
626
652
|
n
|
|
627
653
|
]);
|
|
628
|
-
let A =
|
|
654
|
+
let A = f(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = f(() => {
|
|
629
655
|
if (h) {
|
|
630
656
|
if (s) return s(h);
|
|
631
657
|
if (o.length) return o.find(({ startTime: e, endTime: t }) => e <= h && h < t);
|
|
@@ -635,49 +661,49 @@ var re = {
|
|
|
635
661
|
s,
|
|
636
662
|
h
|
|
637
663
|
]);
|
|
638
|
-
return /* @__PURE__ */
|
|
639
|
-
css:
|
|
664
|
+
return /* @__PURE__ */ w("div", {
|
|
665
|
+
css: be,
|
|
640
666
|
ref: c,
|
|
641
667
|
className: v ? "progress-bar dragging" : "progress-bar",
|
|
642
668
|
onMouseMove: T,
|
|
643
669
|
onMouseOut: E,
|
|
644
670
|
children: [
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
h ? /* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
672
|
+
h ? /* @__PURE__ */ C("div", {
|
|
647
673
|
className: "cursor-time",
|
|
648
674
|
style: { left: `clamp(calc(3 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
649
675
|
children: k
|
|
650
676
|
}) : void 0,
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
677
|
+
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
678
|
+
/* @__PURE__ */ C("div", {
|
|
653
679
|
className: "loaded",
|
|
654
680
|
children: O
|
|
655
681
|
}),
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
683
|
+
/* @__PURE__ */ C("div", {
|
|
658
684
|
className: "play-container",
|
|
659
|
-
children: /* @__PURE__ */
|
|
685
|
+
children: /* @__PURE__ */ C("div", {
|
|
660
686
|
className: "play",
|
|
661
687
|
style: { transform: `scaleX(${A})` }
|
|
662
688
|
})
|
|
663
689
|
}),
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
691
|
+
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
692
|
+
/* @__PURE__ */ C("div", {
|
|
667
693
|
className: "padding",
|
|
668
694
|
...y,
|
|
669
695
|
onPointerDown: b,
|
|
670
696
|
onPointerUp: x,
|
|
671
697
|
onPointerCancel: x
|
|
672
698
|
}),
|
|
673
|
-
/* @__PURE__ */
|
|
699
|
+
/* @__PURE__ */ C("div", {
|
|
674
700
|
className: "thumbnail",
|
|
675
701
|
style: { left: `clamp(var(--thumbnail-half), ${D(h ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
676
|
-
children: j?.url ? /* @__PURE__ */
|
|
702
|
+
children: j?.url ? /* @__PURE__ */ C("img", { src: j.url }) : void 0
|
|
677
703
|
})
|
|
678
704
|
]
|
|
679
705
|
});
|
|
680
|
-
},
|
|
706
|
+
}, Se = "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", J = {
|
|
681
707
|
xmlns: "http://www.w3.org/2000/svg",
|
|
682
708
|
width: 24,
|
|
683
709
|
height: 24,
|
|
@@ -687,22 +713,22 @@ var re = {
|
|
|
687
713
|
strokeWidth: 2,
|
|
688
714
|
strokeLinecap: "round",
|
|
689
715
|
strokeLinejoin: "round"
|
|
690
|
-
},
|
|
716
|
+
}, Ce = (e) => /* @__PURE__ */ w("svg", {
|
|
691
717
|
...J,
|
|
692
718
|
...e,
|
|
693
|
-
children: [/* @__PURE__ */
|
|
719
|
+
children: [/* @__PURE__ */ C("rect", {
|
|
694
720
|
x: "3",
|
|
695
721
|
y: "5",
|
|
696
722
|
width: "18",
|
|
697
723
|
height: "14",
|
|
698
724
|
rx: "2",
|
|
699
725
|
ry: "2"
|
|
700
|
-
}), /* @__PURE__ */
|
|
701
|
-
}),
|
|
726
|
+
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
727
|
+
}), we = (e) => /* @__PURE__ */ w("svg", {
|
|
702
728
|
...J,
|
|
703
729
|
...e,
|
|
704
730
|
children: [
|
|
705
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ C("rect", {
|
|
706
732
|
x: "3",
|
|
707
733
|
y: "5",
|
|
708
734
|
width: "18",
|
|
@@ -710,20 +736,20 @@ var re = {
|
|
|
710
736
|
rx: "2",
|
|
711
737
|
ry: "2"
|
|
712
738
|
}),
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
|
|
740
|
+
/* @__PURE__ */ C("line", {
|
|
715
741
|
x1: "2",
|
|
716
742
|
y1: "2",
|
|
717
743
|
x2: "22",
|
|
718
744
|
y2: "22"
|
|
719
745
|
})
|
|
720
746
|
]
|
|
721
|
-
}),
|
|
747
|
+
}), Te = (e) => /* @__PURE__ */ w("svg", {
|
|
722
748
|
...J,
|
|
723
749
|
...e,
|
|
724
750
|
children: [
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
751
|
+
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
752
|
+
/* @__PURE__ */ C("rect", {
|
|
727
753
|
x: "12",
|
|
728
754
|
y: "13",
|
|
729
755
|
width: "10",
|
|
@@ -731,9 +757,9 @@ var re = {
|
|
|
731
757
|
rx: "1",
|
|
732
758
|
ry: "1"
|
|
733
759
|
}),
|
|
734
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
735
761
|
]
|
|
736
|
-
}),
|
|
762
|
+
}), Ee = h`
|
|
737
763
|
display: flex;
|
|
738
764
|
align-items: center;
|
|
739
765
|
justify-content: center;
|
|
@@ -786,42 +812,42 @@ width: 100%;
|
|
|
786
812
|
}
|
|
787
813
|
}
|
|
788
814
|
}
|
|
789
|
-
`,
|
|
790
|
-
let e =
|
|
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({
|
|
791
817
|
ref: r,
|
|
792
818
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
793
|
-
}),
|
|
819
|
+
}), f = (t) => {
|
|
794
820
|
t.preventDefault();
|
|
795
821
|
let n = .05, r = s;
|
|
796
822
|
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
797
823
|
};
|
|
798
|
-
|
|
824
|
+
d(() => {
|
|
799
825
|
let e = n.current;
|
|
800
|
-
return e && e.addEventListener("wheel",
|
|
801
|
-
e && e.removeEventListener("wheel",
|
|
826
|
+
return e && e.addEventListener("wheel", f, { passive: !1 }), () => {
|
|
827
|
+
e && e.removeEventListener("wheel", f);
|
|
802
828
|
};
|
|
803
829
|
}, [t]);
|
|
804
830
|
let m = c(s);
|
|
805
|
-
return /* @__PURE__ */
|
|
806
|
-
css:
|
|
807
|
-
children: [/* @__PURE__ */
|
|
831
|
+
return /* @__PURE__ */ w("div", {
|
|
832
|
+
css: Ee,
|
|
833
|
+
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
808
834
|
className: "playback-slider",
|
|
809
835
|
ref: n,
|
|
810
|
-
...
|
|
811
|
-
children: /* @__PURE__ */
|
|
836
|
+
...u,
|
|
837
|
+
children: /* @__PURE__ */ C("div", {
|
|
812
838
|
ref: r,
|
|
813
839
|
style: { background: `linear-gradient(to right,
|
|
814
840
|
#fff 0% ${m}%,
|
|
815
841
|
#3A3A3A ${m}% 100%
|
|
816
842
|
)` },
|
|
817
|
-
children: /* @__PURE__ */
|
|
843
|
+
children: /* @__PURE__ */ C("div", {
|
|
818
844
|
className: "playback-handle",
|
|
819
845
|
style: { left: `${m}%` }
|
|
820
846
|
})
|
|
821
847
|
})
|
|
822
848
|
})]
|
|
823
849
|
});
|
|
824
|
-
}, Y =
|
|
850
|
+
}, Y = h`
|
|
825
851
|
.popover {
|
|
826
852
|
position: absolute;
|
|
827
853
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -951,23 +977,23 @@ width: 100%;
|
|
|
951
977
|
`, X = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
952
978
|
let c = o !== void 0, l = (e, i, a) => {
|
|
953
979
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
954
|
-
return /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ w("div", {
|
|
955
981
|
onClick: () => {
|
|
956
982
|
l || r(e ?? void 0);
|
|
957
983
|
},
|
|
958
984
|
className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
959
|
-
children: [/* @__PURE__ */
|
|
985
|
+
children: [/* @__PURE__ */ C("span", { children: i }), /* @__PURE__ */ C("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
960
986
|
}, e ?? "__off__");
|
|
961
987
|
};
|
|
962
|
-
return /* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ w("div", {
|
|
963
989
|
className: "popover track-list",
|
|
964
990
|
children: [
|
|
965
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ w("div", {
|
|
966
992
|
className: i ? "back" : "back no-hover",
|
|
967
993
|
onClick: i,
|
|
968
|
-
children: [i ? /* @__PURE__ */
|
|
994
|
+
children: [i ? /* @__PURE__ */ C(T, {}) : null, /* @__PURE__ */ C("span", { children: e })]
|
|
969
995
|
}),
|
|
970
|
-
s ? /* @__PURE__ */
|
|
996
|
+
s ? /* @__PURE__ */ C("div", {
|
|
971
997
|
className: "no-hover failed",
|
|
972
998
|
children: "Could not switch. Try again."
|
|
973
999
|
}) : null,
|
|
@@ -976,12 +1002,12 @@ width: 100%;
|
|
|
976
1002
|
]
|
|
977
1003
|
});
|
|
978
1004
|
}, Z = ({ onReset: e } = {}) => {
|
|
979
|
-
let t =
|
|
1005
|
+
let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
|
|
980
1006
|
c.current = e;
|
|
981
1007
|
let l = () => {
|
|
982
1008
|
r(!1), c.current?.();
|
|
983
1009
|
};
|
|
984
|
-
return
|
|
1010
|
+
return d(() => {
|
|
985
1011
|
let e = (e) => {
|
|
986
1012
|
n && t.current && !t.current.contains(e.target) && l();
|
|
987
1013
|
};
|
|
@@ -1016,7 +1042,7 @@ width: 100%;
|
|
|
1016
1042
|
});
|
|
1017
1043
|
}
|
|
1018
1044
|
};
|
|
1019
|
-
},
|
|
1045
|
+
}, Oe = h`
|
|
1020
1046
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1021
1047
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1022
1048
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1075,80 +1101,80 @@ ${Y}
|
|
|
1075
1101
|
}
|
|
1076
1102
|
}
|
|
1077
1103
|
|
|
1078
|
-
`,
|
|
1079
|
-
let e =
|
|
1104
|
+
`, ke = () => {
|
|
1105
|
+
let e = I(), t = I((e) => e.playbackRate), n = I((e) => e.audioTracks), r = I((e) => e.selectedAudioTrack), i = I((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) => {
|
|
1080
1106
|
e.setPlaybackRate(t), o(0);
|
|
1081
1107
|
}, h = (e) => {
|
|
1082
1108
|
e !== void 0 && f(e, () => i(e));
|
|
1083
1109
|
}, g = (e) => () => {
|
|
1084
1110
|
o(e);
|
|
1085
1111
|
};
|
|
1086
|
-
return /* @__PURE__ */
|
|
1087
|
-
css:
|
|
1112
|
+
return /* @__PURE__ */ w("div", {
|
|
1113
|
+
css: Oe,
|
|
1088
1114
|
ref: l,
|
|
1089
1115
|
children: [
|
|
1090
|
-
/* @__PURE__ */
|
|
1116
|
+
/* @__PURE__ */ C(K, {
|
|
1091
1117
|
id: "settings",
|
|
1092
1118
|
disabled: s,
|
|
1093
|
-
text: /* @__PURE__ */
|
|
1119
|
+
text: /* @__PURE__ */ C("button", {
|
|
1094
1120
|
className: "settings",
|
|
1095
1121
|
type: "button",
|
|
1096
1122
|
onClick: c,
|
|
1097
1123
|
"aria-label": "Settings",
|
|
1098
1124
|
"aria-expanded": s,
|
|
1099
|
-
children: /* @__PURE__ */
|
|
1125
|
+
children: /* @__PURE__ */ C(M, {})
|
|
1100
1126
|
}),
|
|
1101
|
-
toolTipText: /* @__PURE__ */
|
|
1127
|
+
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1102
1128
|
}),
|
|
1103
|
-
s && a === 0 && /* @__PURE__ */
|
|
1129
|
+
s && a === 0 && /* @__PURE__ */ w("div", {
|
|
1104
1130
|
className: "popover menu",
|
|
1105
|
-
children: [n.length > 1 ? /* @__PURE__ */
|
|
1131
|
+
children: [n.length > 1 ? /* @__PURE__ */ w("div", {
|
|
1106
1132
|
onClick: g(2),
|
|
1107
|
-
children: [/* @__PURE__ */
|
|
1108
|
-
}) : null, /* @__PURE__ */
|
|
1133
|
+
children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(E, {}) })]
|
|
1134
|
+
}) : null, /* @__PURE__ */ w("div", {
|
|
1109
1135
|
onClick: g(1),
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1136
|
+
children: [/* @__PURE__ */ C("div", { children: "Playback speed" }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("span", {
|
|
1111
1137
|
className: "secondary",
|
|
1112
1138
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
1113
|
-
}), /* @__PURE__ */
|
|
1139
|
+
}), /* @__PURE__ */ C(E, {})] })]
|
|
1114
1140
|
})]
|
|
1115
1141
|
}),
|
|
1116
|
-
s && a === 1 && /* @__PURE__ */
|
|
1142
|
+
s && a === 1 && /* @__PURE__ */ w("div", {
|
|
1117
1143
|
className: "popover playback-rate",
|
|
1118
1144
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ w("div", {
|
|
1120
1146
|
className: "back",
|
|
1121
1147
|
onClick: g(0),
|
|
1122
|
-
children: [/* @__PURE__ */
|
|
1148
|
+
children: [/* @__PURE__ */ C(T, {}), /* @__PURE__ */ C("span", { children: "Playback speed" })]
|
|
1123
1149
|
}),
|
|
1124
|
-
/* @__PURE__ */
|
|
1150
|
+
/* @__PURE__ */ C("div", {
|
|
1125
1151
|
className: "slider no-hover",
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1152
|
+
children: /* @__PURE__ */ C(De, {})
|
|
1127
1153
|
}),
|
|
1128
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ w("div", {
|
|
1129
1155
|
className: "options no-hover",
|
|
1130
1156
|
children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
onClick: () =>
|
|
1157
|
+
/* @__PURE__ */ C("div", {
|
|
1158
|
+
onClick: () => p(.5),
|
|
1133
1159
|
children: "0.5x"
|
|
1134
1160
|
}),
|
|
1135
|
-
/* @__PURE__ */
|
|
1136
|
-
onClick: () =>
|
|
1161
|
+
/* @__PURE__ */ C("div", {
|
|
1162
|
+
onClick: () => p(1),
|
|
1137
1163
|
children: "1x"
|
|
1138
1164
|
}),
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
onClick: () =>
|
|
1165
|
+
/* @__PURE__ */ C("div", {
|
|
1166
|
+
onClick: () => p(1.5),
|
|
1141
1167
|
children: "1.5x"
|
|
1142
1168
|
}),
|
|
1143
|
-
/* @__PURE__ */
|
|
1144
|
-
onClick: () =>
|
|
1169
|
+
/* @__PURE__ */ C("div", {
|
|
1170
|
+
onClick: () => p(2),
|
|
1145
1171
|
children: "2x"
|
|
1146
1172
|
})
|
|
1147
1173
|
]
|
|
1148
1174
|
})
|
|
1149
1175
|
]
|
|
1150
1176
|
}),
|
|
1151
|
-
s && a === 2 && /* @__PURE__ */
|
|
1177
|
+
s && a === 2 && /* @__PURE__ */ C(X, {
|
|
1152
1178
|
title: "Audio",
|
|
1153
1179
|
tracks: n,
|
|
1154
1180
|
selected: r,
|
|
@@ -1159,7 +1185,7 @@ ${Y}
|
|
|
1159
1185
|
})
|
|
1160
1186
|
]
|
|
1161
1187
|
});
|
|
1162
|
-
},
|
|
1188
|
+
}, Ae = h`
|
|
1163
1189
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1164
1190
|
which is the width of the player box, so it can be clamped to it. */
|
|
1165
1191
|
position: static;
|
|
@@ -1176,27 +1202,27 @@ position: static;
|
|
|
1176
1202
|
}
|
|
1177
1203
|
|
|
1178
1204
|
${Y}
|
|
1179
|
-
`,
|
|
1180
|
-
let e =
|
|
1205
|
+
`, je = () => {
|
|
1206
|
+
let e = I((e) => e.subtitleTracks), t = I((e) => e.selectedSubtitleTrack), n = I((e) => e.selectSubtitleTrack), r = I((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
|
|
1181
1207
|
if (e.length === 0) return null;
|
|
1182
1208
|
let u = t !== void 0;
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
css:
|
|
1209
|
+
return /* @__PURE__ */ w("div", {
|
|
1210
|
+
css: Ae,
|
|
1185
1211
|
ref: o,
|
|
1186
|
-
children: [/* @__PURE__ */
|
|
1212
|
+
children: [/* @__PURE__ */ C(K, {
|
|
1187
1213
|
id: "subtitles",
|
|
1188
1214
|
disabled: i,
|
|
1189
|
-
text: /* @__PURE__ */
|
|
1215
|
+
text: /* @__PURE__ */ C("button", {
|
|
1190
1216
|
className: "subtitles",
|
|
1191
1217
|
type: "button",
|
|
1192
1218
|
onClick: a,
|
|
1193
1219
|
"aria-label": "Subtitles",
|
|
1194
1220
|
"aria-expanded": i,
|
|
1195
1221
|
"aria-pressed": u,
|
|
1196
|
-
children: u ? /* @__PURE__ */
|
|
1222
|
+
children: u ? /* @__PURE__ */ C(Ce, { className: "captions" }) : /* @__PURE__ */ C(we, { className: "captions-off" })
|
|
1197
1223
|
}),
|
|
1198
|
-
toolTipText: /* @__PURE__ */
|
|
1199
|
-
}), i && /* @__PURE__ */
|
|
1224
|
+
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1225
|
+
}), i && /* @__PURE__ */ C(X, {
|
|
1200
1226
|
title: "Subtitles",
|
|
1201
1227
|
tracks: e,
|
|
1202
1228
|
selected: t,
|
|
@@ -1206,14 +1232,14 @@ ${Y}
|
|
|
1206
1232
|
failed: c
|
|
1207
1233
|
})]
|
|
1208
1234
|
});
|
|
1209
|
-
},
|
|
1235
|
+
}, Me = {
|
|
1210
1236
|
primary: "#EAEBEE",
|
|
1211
1237
|
secondary: "#D0D0D9",
|
|
1212
1238
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1213
1239
|
accent: "#6EA8FE",
|
|
1214
1240
|
borderPrimary: "#384F70",
|
|
1215
1241
|
backgroundTooltip: "#222222"
|
|
1216
|
-
},
|
|
1242
|
+
}, Ne = h`
|
|
1217
1243
|
display: flex;
|
|
1218
1244
|
align-items: center;
|
|
1219
1245
|
|
|
@@ -1256,8 +1282,8 @@ ${Y}
|
|
|
1256
1282
|
width: 10px;
|
|
1257
1283
|
height: 10px;
|
|
1258
1284
|
}
|
|
1259
|
-
`,
|
|
1260
|
-
let n =
|
|
1285
|
+
`, Pe = ({ value: e, onChange: t }) => {
|
|
1286
|
+
let n = I((e) => e.volume), r = I((e) => e.muted), i = p(null), a = p(null), { handlers: o } = q({
|
|
1261
1287
|
ref: a,
|
|
1262
1288
|
onChange: t
|
|
1263
1289
|
}), s = (n) => {
|
|
@@ -1265,37 +1291,37 @@ ${Y}
|
|
|
1265
1291
|
let r = .05, i = e;
|
|
1266
1292
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
1267
1293
|
};
|
|
1268
|
-
|
|
1294
|
+
d(() => {
|
|
1269
1295
|
let e = i.current;
|
|
1270
1296
|
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
1271
1297
|
e && e.removeEventListener("wheel", s);
|
|
1272
1298
|
};
|
|
1273
1299
|
}, [e]);
|
|
1274
|
-
let c = e * 100, l =
|
|
1275
|
-
return /* @__PURE__ */
|
|
1300
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : W(n) * 100), [n, r]);
|
|
1301
|
+
return /* @__PURE__ */ C(K, {
|
|
1276
1302
|
id: "volume-slider",
|
|
1277
|
-
text: /* @__PURE__ */
|
|
1303
|
+
text: /* @__PURE__ */ C("div", {
|
|
1278
1304
|
ref: i,
|
|
1279
|
-
css:
|
|
1305
|
+
css: Ne,
|
|
1280
1306
|
...o,
|
|
1281
|
-
children: /* @__PURE__ */
|
|
1307
|
+
children: /* @__PURE__ */ C("div", {
|
|
1282
1308
|
ref: a,
|
|
1283
1309
|
style: { background: `linear-gradient(to right,
|
|
1284
1310
|
#fff 0% ${c}%,
|
|
1285
1311
|
#3A3A3A ${c}% 100%
|
|
1286
1312
|
)` },
|
|
1287
|
-
children: /* @__PURE__ */
|
|
1313
|
+
children: /* @__PURE__ */ C("div", {
|
|
1288
1314
|
className: "volume-handle",
|
|
1289
1315
|
style: { left: `${e * 100}%` }
|
|
1290
1316
|
})
|
|
1291
1317
|
})
|
|
1292
1318
|
}),
|
|
1293
|
-
toolTipText: /* @__PURE__ */
|
|
1319
|
+
toolTipText: /* @__PURE__ */ w("div", {
|
|
1294
1320
|
className: "volume-value",
|
|
1295
1321
|
children: [l, "%"]
|
|
1296
1322
|
})
|
|
1297
1323
|
});
|
|
1298
|
-
},
|
|
1324
|
+
}, Fe = h`
|
|
1299
1325
|
position: relative;
|
|
1300
1326
|
display: flex;
|
|
1301
1327
|
align-items: center;
|
|
@@ -1358,30 +1384,30 @@ ${Y}
|
|
|
1358
1384
|
}
|
|
1359
1385
|
}
|
|
1360
1386
|
|
|
1361
|
-
`,
|
|
1362
|
-
let t =
|
|
1363
|
-
return /* @__PURE__ */
|
|
1364
|
-
css:
|
|
1365
|
-
children: [/* @__PURE__ */
|
|
1387
|
+
`, Ie = ({ ref: e }) => {
|
|
1388
|
+
let t = I(), n = I((e) => e.volume), r = I((e) => e.muted), i = f(() => W(n), [n]);
|
|
1389
|
+
return /* @__PURE__ */ w("div", {
|
|
1390
|
+
css: Fe,
|
|
1391
|
+
children: [/* @__PURE__ */ C(K, {
|
|
1366
1392
|
id: "sound",
|
|
1367
|
-
text: /* @__PURE__ */
|
|
1393
|
+
text: /* @__PURE__ */ C("button", {
|
|
1368
1394
|
className: "sound",
|
|
1369
1395
|
type: "button",
|
|
1370
1396
|
onClick: () => t.toggleMuted(),
|
|
1371
1397
|
ref: e,
|
|
1372
1398
|
"aria-label": "Mute",
|
|
1373
1399
|
"aria-pressed": r || n === 0,
|
|
1374
|
-
children:
|
|
1400
|
+
children: C(r || n === 0 ? te : n <= .5 ? N : ee, {
|
|
1375
1401
|
size: 18,
|
|
1376
1402
|
color: "#fff"
|
|
1377
1403
|
})
|
|
1378
1404
|
}),
|
|
1379
|
-
toolTipText: /* @__PURE__ */
|
|
1380
|
-
}), /* @__PURE__ */
|
|
1405
|
+
toolTipText: /* @__PURE__ */ C("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
1406
|
+
}), /* @__PURE__ */ C("div", {
|
|
1381
1407
|
className: "volume-slider-container",
|
|
1382
|
-
children: /* @__PURE__ */
|
|
1408
|
+
children: /* @__PURE__ */ C("div", {
|
|
1383
1409
|
className: "volume-slider-background",
|
|
1384
|
-
children: /* @__PURE__ */
|
|
1410
|
+
children: /* @__PURE__ */ C(Pe, {
|
|
1385
1411
|
value: r ? 0 : i,
|
|
1386
1412
|
onChange: (e) => {
|
|
1387
1413
|
t.setVolume(U(e));
|
|
@@ -1390,7 +1416,7 @@ ${Y}
|
|
|
1390
1416
|
})
|
|
1391
1417
|
})]
|
|
1392
1418
|
});
|
|
1393
|
-
},
|
|
1419
|
+
}, Q = .05, Le = 5, Re = h`
|
|
1394
1420
|
display: flex;
|
|
1395
1421
|
flex-direction: column;
|
|
1396
1422
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1401,7 +1427,7 @@ ${Y}
|
|
|
1401
1427
|
opacity: 0.72;
|
|
1402
1428
|
font-size: 0.9em;
|
|
1403
1429
|
}
|
|
1404
|
-
`,
|
|
1430
|
+
`, ze = h`
|
|
1405
1431
|
position: absolute;
|
|
1406
1432
|
bottom: 0;
|
|
1407
1433
|
width: 100%;
|
|
@@ -1466,7 +1492,7 @@ ${Y}
|
|
|
1466
1492
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1467
1493
|
*/
|
|
1468
1494
|
button[aria-pressed='true'] svg {
|
|
1469
|
-
stroke: ${
|
|
1495
|
+
stroke: ${Me.accent};
|
|
1470
1496
|
}
|
|
1471
1497
|
|
|
1472
1498
|
.play, .sound, .time, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
@@ -1501,7 +1527,7 @@ ${Y}
|
|
|
1501
1527
|
cursor: pointer;
|
|
1502
1528
|
|
|
1503
1529
|
:hover {
|
|
1504
|
-
background-color: ${
|
|
1530
|
+
background-color: ${Me.hover};
|
|
1505
1531
|
}
|
|
1506
1532
|
|
|
1507
1533
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1539,12 +1565,12 @@ ${Y}
|
|
|
1539
1565
|
}
|
|
1540
1566
|
}
|
|
1541
1567
|
}
|
|
1542
|
-
`,
|
|
1543
|
-
let e =
|
|
1568
|
+
`, Be = () => {
|
|
1569
|
+
let e = I(), t = I((e) => e.paused), n = I((e) => e.currentTime), r = I((e) => e.duration), i = I((e) => e.fullscreen), a = I((e) => e.hideUI), o = I((e) => e.togglePictureInPicture), s = I((e) => e.pictureInPictureMode), c = I((e) => e.burnedInSubtitles), l = I((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 }) => {
|
|
1544
1570
|
let r = W(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1545
1571
|
e.setVolume(U(a)), o && !e.muted && e.toggleMuted();
|
|
1546
1572
|
}, [e]);
|
|
1547
|
-
|
|
1573
|
+
d(() => {
|
|
1548
1574
|
let t = (t) => {
|
|
1549
1575
|
let n = t.target;
|
|
1550
1576
|
if (n?.isContentEditable || /^(input|textarea|select)$/i.test(n?.tagName ?? "")) return;
|
|
@@ -1555,109 +1581,109 @@ ${Y}
|
|
|
1555
1581
|
else if (t.key === "m") e.toggleMuted();
|
|
1556
1582
|
else if (t.key === "ArrowUp") v({
|
|
1557
1583
|
direction: "up",
|
|
1558
|
-
stepSize:
|
|
1584
|
+
stepSize: Q
|
|
1559
1585
|
});
|
|
1560
1586
|
else if (t.key === "ArrowDown") v({
|
|
1561
1587
|
direction: "down",
|
|
1562
|
-
stepSize:
|
|
1588
|
+
stepSize: Q
|
|
1563
1589
|
});
|
|
1564
1590
|
else if (t.key === "ArrowRight") {
|
|
1565
1591
|
if (!e.duration) return;
|
|
1566
|
-
e.seek(Math.min(e.currentTime +
|
|
1567
|
-
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime -
|
|
1592
|
+
e.seek(Math.min(e.currentTime + Le, e.duration));
|
|
1593
|
+
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Le, 0)) : r = !1;
|
|
1568
1594
|
r && t.preventDefault();
|
|
1569
1595
|
};
|
|
1570
1596
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1571
1597
|
}, [e, v]);
|
|
1572
|
-
let y =
|
|
1598
|
+
let y = u((e) => {
|
|
1573
1599
|
e.preventDefault(), e.deltaY < 0 ? v({
|
|
1574
1600
|
direction: "up",
|
|
1575
|
-
stepSize:
|
|
1601
|
+
stepSize: Q
|
|
1576
1602
|
}) : v({
|
|
1577
1603
|
direction: "down",
|
|
1578
|
-
stepSize:
|
|
1604
|
+
stepSize: Q
|
|
1579
1605
|
});
|
|
1580
1606
|
}, [v]);
|
|
1581
|
-
return
|
|
1607
|
+
return d(() => {
|
|
1582
1608
|
if (f) return f.addEventListener("wheel", y, { passive: !1 }), () => f.removeEventListener("wheel", y);
|
|
1583
|
-
}, [f, y]), /* @__PURE__ */
|
|
1584
|
-
css:
|
|
1609
|
+
}, [f, y]), /* @__PURE__ */ w("div", {
|
|
1610
|
+
css: ze,
|
|
1585
1611
|
style: { ...a ? {
|
|
1586
1612
|
opacity: "0",
|
|
1587
1613
|
pointerEvents: "none"
|
|
1588
1614
|
} : {} },
|
|
1589
|
-
children: [/* @__PURE__ */
|
|
1615
|
+
children: [/* @__PURE__ */ C(xe, {}), /* @__PURE__ */ w("div", {
|
|
1590
1616
|
className: "actions",
|
|
1591
|
-
children: [/* @__PURE__ */
|
|
1617
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1592
1618
|
className: "left",
|
|
1593
1619
|
children: [
|
|
1594
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ C(K, {
|
|
1595
1621
|
id: "play",
|
|
1596
1622
|
tooltipPlace: "top-start",
|
|
1597
|
-
text: /* @__PURE__ */
|
|
1623
|
+
text: /* @__PURE__ */ C("button", {
|
|
1598
1624
|
className: "play",
|
|
1599
1625
|
type: "button",
|
|
1600
1626
|
onClick: () => e.togglePaused(),
|
|
1601
1627
|
"aria-label": _ ? "Replay" : t ? "Play" : "Pause",
|
|
1602
|
-
children:
|
|
1628
|
+
children: C(_ ? j : t ? A : k, {})
|
|
1603
1629
|
}),
|
|
1604
|
-
toolTipText: /* @__PURE__ */
|
|
1630
|
+
toolTipText: /* @__PURE__ */ C("span", { children: _ ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1605
1631
|
}),
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1632
|
+
/* @__PURE__ */ C(Ie, { ref: p }),
|
|
1633
|
+
/* @__PURE__ */ C("div", {
|
|
1608
1634
|
className: "time",
|
|
1609
|
-
children:
|
|
1635
|
+
children: ve(n, r)
|
|
1610
1636
|
})
|
|
1611
1637
|
]
|
|
1612
|
-
}), /* @__PURE__ */
|
|
1638
|
+
}), /* @__PURE__ */ w("div", {
|
|
1613
1639
|
className: "right",
|
|
1614
1640
|
children: [
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
o ? /* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ C(je, {}),
|
|
1642
|
+
/* @__PURE__ */ C(ke, {}),
|
|
1643
|
+
o ? /* @__PURE__ */ C(K, {
|
|
1618
1644
|
id: "picture-in-picture",
|
|
1619
1645
|
tooltipPlace: "top-end",
|
|
1620
|
-
text: /* @__PURE__ */
|
|
1646
|
+
text: /* @__PURE__ */ C("button", {
|
|
1621
1647
|
className: "picture-in-picture",
|
|
1622
1648
|
type: "button",
|
|
1623
1649
|
onClick: o,
|
|
1624
1650
|
disabled: h && !g,
|
|
1625
1651
|
"aria-label": h ? "Put the subtitles in the video" : "Picture in picture",
|
|
1626
1652
|
"aria-pressed": h ? c : void 0,
|
|
1627
|
-
children: h ? /* @__PURE__ */
|
|
1628
|
-
src:
|
|
1653
|
+
children: h ? /* @__PURE__ */ C(Te, {}) : /* @__PURE__ */ C("img", {
|
|
1654
|
+
src: Se,
|
|
1629
1655
|
alt: ""
|
|
1630
1656
|
})
|
|
1631
1657
|
}),
|
|
1632
|
-
toolTipText: /* @__PURE__ */
|
|
1633
|
-
css:
|
|
1634
|
-
children: [/* @__PURE__ */
|
|
1658
|
+
toolTipText: /* @__PURE__ */ w("span", {
|
|
1659
|
+
css: Re,
|
|
1660
|
+
children: [/* @__PURE__ */ C("span", {
|
|
1635
1661
|
className: "lead",
|
|
1636
1662
|
children: h ? g ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
|
|
1637
|
-
}), h && g ? /* @__PURE__ */
|
|
1663
|
+
}), h && g ? /* @__PURE__ */ C("span", {
|
|
1638
1664
|
className: "hint",
|
|
1639
1665
|
children: "Then hover the video and click your browser's own pop out button"
|
|
1640
1666
|
}) : null]
|
|
1641
1667
|
})
|
|
1642
1668
|
}) : null,
|
|
1643
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ C(K, {
|
|
1644
1670
|
id: "full-screen",
|
|
1645
1671
|
tooltipPlace: "top-end",
|
|
1646
|
-
text: /* @__PURE__ */
|
|
1672
|
+
text: /* @__PURE__ */ C("button", {
|
|
1647
1673
|
className: "full-screen",
|
|
1648
1674
|
type: "button",
|
|
1649
1675
|
onClick: () => e.toggleFullscreen(),
|
|
1650
1676
|
"aria-label": "Full screen",
|
|
1651
1677
|
"aria-pressed": i,
|
|
1652
|
-
children:
|
|
1678
|
+
children: C(i ? O : D, {})
|
|
1653
1679
|
}),
|
|
1654
|
-
toolTipText: /* @__PURE__ */
|
|
1680
|
+
toolTipText: /* @__PURE__ */ C("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
|
|
1655
1681
|
})
|
|
1656
1682
|
]
|
|
1657
1683
|
})]
|
|
1658
1684
|
})]
|
|
1659
1685
|
});
|
|
1660
|
-
},
|
|
1686
|
+
}, Ve = 9e3, He = h`
|
|
1661
1687
|
position: absolute;
|
|
1662
1688
|
inset: 0;
|
|
1663
1689
|
z-index: 2;
|
|
@@ -1711,39 +1737,39 @@ ${Y}
|
|
|
1711
1737
|
line-height: 1;
|
|
1712
1738
|
color: #6EA8FE;
|
|
1713
1739
|
}
|
|
1714
|
-
`,
|
|
1715
|
-
let e =
|
|
1716
|
-
return
|
|
1740
|
+
`, Ue = () => {
|
|
1741
|
+
let e = I((e) => e.burnedInSubtitles), t = I((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1742
|
+
return d(() => {
|
|
1717
1743
|
if (t !== "burn-in" || !e) {
|
|
1718
1744
|
r(!1);
|
|
1719
1745
|
return;
|
|
1720
1746
|
}
|
|
1721
1747
|
r(!0);
|
|
1722
|
-
let n = setTimeout(() => r(!1),
|
|
1748
|
+
let n = setTimeout(() => r(!1), Ve);
|
|
1723
1749
|
return () => clearTimeout(n);
|
|
1724
|
-
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */
|
|
1725
|
-
css:
|
|
1750
|
+
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1751
|
+
css: He,
|
|
1726
1752
|
className: n ? "show" : "",
|
|
1727
1753
|
role: "status",
|
|
1728
|
-
children: /* @__PURE__ */
|
|
1754
|
+
children: /* @__PURE__ */ w("div", {
|
|
1729
1755
|
className: "card",
|
|
1730
|
-
children: [/* @__PURE__ */
|
|
1756
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1731
1757
|
className: "words",
|
|
1732
|
-
children: [/* @__PURE__ */
|
|
1758
|
+
children: [/* @__PURE__ */ C("div", {
|
|
1733
1759
|
className: "title",
|
|
1734
1760
|
children: "Subtitles are in the picture"
|
|
1735
|
-
}), /* @__PURE__ */
|
|
1761
|
+
}), /* @__PURE__ */ C("div", {
|
|
1736
1762
|
className: "body",
|
|
1737
1763
|
children: "Now hover the video and click your browser's own pop out button"
|
|
1738
1764
|
})]
|
|
1739
|
-
}), /* @__PURE__ */
|
|
1765
|
+
}), /* @__PURE__ */ C("div", {
|
|
1740
1766
|
className: "arrow",
|
|
1741
1767
|
"aria-hidden": "true",
|
|
1742
1768
|
children: "→"
|
|
1743
1769
|
})]
|
|
1744
1770
|
})
|
|
1745
1771
|
});
|
|
1746
|
-
},
|
|
1772
|
+
}, We = 3e3, Ge = h`
|
|
1747
1773
|
position: absolute;
|
|
1748
1774
|
inset: 0;
|
|
1749
1775
|
z-index: 2;
|
|
@@ -1754,7 +1780,7 @@ ${Y}
|
|
|
1754
1780
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1755
1781
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1756
1782
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1757
|
-
`,
|
|
1783
|
+
`, Ke = h`
|
|
1758
1784
|
position: relative;
|
|
1759
1785
|
background-color: black;
|
|
1760
1786
|
display: flex;
|
|
@@ -1786,26 +1812,26 @@ ${Y}
|
|
|
1786
1812
|
&.hide {
|
|
1787
1813
|
cursor: none;
|
|
1788
1814
|
}
|
|
1789
|
-
`,
|
|
1790
|
-
let r = `${t}${
|
|
1791
|
-
return
|
|
1815
|
+
`, qe = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
1816
|
+
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
1817
|
+
return l(e) && e.type === c ? qe(e.props.children, `${r}/`) : [{
|
|
1792
1818
|
key: r,
|
|
1793
1819
|
item: e
|
|
1794
1820
|
}];
|
|
1795
|
-
}),
|
|
1796
|
-
let o =
|
|
1797
|
-
|
|
1798
|
-
let
|
|
1799
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
1821
|
+
}), Je = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
1822
|
+
let o = I(), s = I((e) => e.hideUI), c = I((e) => e.setHideUI), l = p(void 0), u = p("mouse");
|
|
1823
|
+
d(() => () => clearTimeout(l.current), []);
|
|
1824
|
+
let f = () => {
|
|
1825
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), We);
|
|
1800
1826
|
};
|
|
1801
|
-
return /* @__PURE__ */
|
|
1802
|
-
css:
|
|
1827
|
+
return /* @__PURE__ */ w("div", {
|
|
1828
|
+
css: Ke,
|
|
1803
1829
|
ref: e,
|
|
1804
1830
|
onPointerMove: (e) => {
|
|
1805
|
-
|
|
1831
|
+
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
1806
1832
|
},
|
|
1807
1833
|
onPointerDown: (e) => {
|
|
1808
|
-
|
|
1834
|
+
u.current = e.pointerType;
|
|
1809
1835
|
},
|
|
1810
1836
|
onMouseOut: (e) => {
|
|
1811
1837
|
let t = e.relatedTarget;
|
|
@@ -1815,9 +1841,9 @@ ${Y}
|
|
|
1815
1841
|
},
|
|
1816
1842
|
className: s ? "hide" : "",
|
|
1817
1843
|
children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
|
|
1820
|
-
css:
|
|
1844
|
+
/* @__PURE__ */ C(_e, { onCanvasRef: n }),
|
|
1845
|
+
qe(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
1846
|
+
css: Ge,
|
|
1821
1847
|
style: { ...s ? {
|
|
1822
1848
|
opacity: "0",
|
|
1823
1849
|
visibility: "hidden",
|
|
@@ -1825,35 +1851,35 @@ ${Y}
|
|
|
1825
1851
|
} : {} },
|
|
1826
1852
|
children: t
|
|
1827
1853
|
}, e)),
|
|
1828
|
-
i === !1 ? null : /* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1854
|
+
i === !1 ? null : /* @__PURE__ */ C(Be, {}),
|
|
1855
|
+
/* @__PURE__ */ C(Ue, {}),
|
|
1856
|
+
/* @__PURE__ */ w("div", {
|
|
1831
1857
|
className: "video",
|
|
1832
1858
|
onClick: () => {
|
|
1833
|
-
if (
|
|
1859
|
+
if (u.current === "mouse") {
|
|
1834
1860
|
o.togglePaused();
|
|
1835
1861
|
return;
|
|
1836
1862
|
}
|
|
1837
|
-
s ?
|
|
1863
|
+
s ? f() : (clearTimeout(l.current), c(!0));
|
|
1838
1864
|
},
|
|
1839
|
-
children: [t ? /* @__PURE__ */
|
|
1865
|
+
children: [t ? /* @__PURE__ */ C("video", {
|
|
1840
1866
|
ref: t,
|
|
1841
1867
|
playsInline: !0
|
|
1842
1868
|
}) : null, a]
|
|
1843
1869
|
})
|
|
1844
1870
|
]
|
|
1845
1871
|
});
|
|
1846
|
-
},
|
|
1847
|
-
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:
|
|
1848
|
-
|
|
1872
|
+
}, Ye = ({ options: e, children: t }) => {
|
|
1873
|
+
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]), le(g, b, r);
|
|
1849
1875
|
let w = R({
|
|
1850
1876
|
publicPath: s,
|
|
1851
1877
|
workerUrl: c,
|
|
1852
1878
|
length: f === !1 ? void 0 : a,
|
|
1853
|
-
read:
|
|
1879
|
+
read: u ?? l,
|
|
1854
1880
|
downloadedRanges: o
|
|
1855
|
-
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = z(g, b), k =
|
|
1856
|
-
|
|
1881
|
+
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = z(g, b), k = I((e) => e.setSourceState);
|
|
1882
|
+
d(() => {
|
|
1857
1883
|
k({
|
|
1858
1884
|
title: i,
|
|
1859
1885
|
size: a,
|
|
@@ -1866,7 +1892,7 @@ ${Y}
|
|
|
1866
1892
|
o
|
|
1867
1893
|
]);
|
|
1868
1894
|
let A = n?.thumbnails?.at;
|
|
1869
|
-
|
|
1895
|
+
d(() => {
|
|
1870
1896
|
k({
|
|
1871
1897
|
thumbnails: T,
|
|
1872
1898
|
thumbnailAt: A,
|
|
@@ -1883,7 +1909,7 @@ ${Y}
|
|
|
1883
1909
|
O
|
|
1884
1910
|
]);
|
|
1885
1911
|
let j = n?.subtitles?.selection, M = n?.audioTracks?.selection;
|
|
1886
|
-
return
|
|
1912
|
+
return d(() => {
|
|
1887
1913
|
j && k({
|
|
1888
1914
|
subtitleTracks: j.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
1889
1915
|
id: e,
|
|
@@ -1894,7 +1920,7 @@ ${Y}
|
|
|
1894
1920
|
selectSubtitleTrack: (e) => j.select(e == null ? null : String(e)),
|
|
1895
1921
|
subtitleOffLabel: j.offLabel
|
|
1896
1922
|
});
|
|
1897
|
-
}, [k, j]),
|
|
1923
|
+
}, [k, j]), d(() => {
|
|
1898
1924
|
M && k({
|
|
1899
1925
|
audioTracks: M.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
1900
1926
|
id: e,
|
|
@@ -1904,15 +1930,15 @@ ${Y}
|
|
|
1904
1930
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
1905
1931
|
selectAudioTrack: (e) => M.select(String(e))
|
|
1906
1932
|
});
|
|
1907
|
-
}, [k, M]), /* @__PURE__ */
|
|
1933
|
+
}, [k, M]), /* @__PURE__ */ C(Je, {
|
|
1908
1934
|
ref: h,
|
|
1909
|
-
onVideoRef: n ? void 0 :
|
|
1935
|
+
onVideoRef: n ? void 0 : _,
|
|
1910
1936
|
onCanvasRef: x,
|
|
1911
1937
|
overlay: e.overlay,
|
|
1912
1938
|
controls: e.controls,
|
|
1913
1939
|
children: t
|
|
1914
1940
|
});
|
|
1915
|
-
},
|
|
1941
|
+
}, Xe = h`
|
|
1916
1942
|
/**
|
|
1917
1943
|
* The chrome's whole scale, in one place.
|
|
1918
1944
|
*
|
|
@@ -1982,17 +2008,17 @@ ${Y}
|
|
|
1982
2008
|
height: 100%;
|
|
1983
2009
|
width: 100%;
|
|
1984
2010
|
overflow: hidden;
|
|
1985
|
-
`,
|
|
1986
|
-
css:
|
|
1987
|
-
children: /* @__PURE__ */
|
|
2011
|
+
`, $ = (e) => /* @__PURE__ */ C("div", {
|
|
2012
|
+
css: Xe,
|
|
2013
|
+
children: /* @__PURE__ */ C(F.Provider, { children: /* @__PURE__ */ C(Ye, {
|
|
1988
2014
|
options: e,
|
|
1989
2015
|
children: e.children
|
|
1990
2016
|
}) })
|
|
1991
|
-
}),
|
|
2017
|
+
}), Ze = (e) => !!e && typeof e == "object" && "at" in e, Qe = (e) => !!e && typeof e == "object" && "selection" in e, $e = ({ blob: e, name: t }) => ({
|
|
1992
2018
|
length: e.size,
|
|
1993
2019
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
1994
2020
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
1995
|
-
}),
|
|
2021
|
+
}), et = async (e, t) => {
|
|
1996
2022
|
let n = await fetch(e, {
|
|
1997
2023
|
headers: { Range: "bytes=0-1" },
|
|
1998
2024
|
credentials: t
|
|
@@ -2002,8 +2028,8 @@ ${Y}
|
|
|
2002
2028
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2003
2029
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2004
2030
|
return i;
|
|
2005
|
-
},
|
|
2006
|
-
let i = t ?? await
|
|
2031
|
+
}, tt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2032
|
+
let i = t ?? await et(e, r);
|
|
2007
2033
|
return {
|
|
2008
2034
|
length: i,
|
|
2009
2035
|
name: n,
|
|
@@ -2016,9 +2042,9 @@ ${Y}
|
|
|
2016
2042
|
return a.arrayBuffer();
|
|
2017
2043
|
}
|
|
2018
2044
|
};
|
|
2019
|
-
},
|
|
2020
|
-
if ("blob" in e) return
|
|
2021
|
-
if ("url" in e) return
|
|
2045
|
+
}, nt = async (e) => {
|
|
2046
|
+
if ("blob" in e) return $e(e);
|
|
2047
|
+
if ("url" in e) return tt(e);
|
|
2022
2048
|
if ("read" in e) return {
|
|
2023
2049
|
length: e.length,
|
|
2024
2050
|
name: e.name,
|
|
@@ -2027,4 +2053,4 @@ ${Y}
|
|
|
2027
2053
|
throw Error(`Unknown source type: ${e}`);
|
|
2028
2054
|
};
|
|
2029
2055
|
//#endregion
|
|
2030
|
-
export {
|
|
2056
|
+
export { $ as MediaPlayer, $ as default, F as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, nt as inputToRemuxerInput, Qe as isDelegatedTracks, Ze as isExternalThumbnails, P as sourceFeature, i as startPlayback, z as usePictureInPicture, I as usePlayer, R as useSeekThumbnails };
|