@banou/media-player 0.8.2 → 0.8.3
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.js +360 -375
- package/dist/react/components/chrome.d.ts +1 -1
- package/dist/react/components/overlay.d.ts +2 -6
- package/dist/react/video-player.d.ts +19 -6
- package/package.json +1 -1
- package/src/lib/react/components/chrome.tsx +56 -3
- package/src/lib/react/components/overlay.tsx +22 -67
- package/src/lib/react/video-player.tsx +19 -6
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { i as e, n as t, o as n, s as r, t as i } from "./engine-Dmc7JSd9.js";
|
|
2
|
-
import {
|
|
3
|
-
import { css as
|
|
4
|
-
import { createPlayer as
|
|
5
|
-
import { definePlayerFeature as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { ChevronLeft as
|
|
8
|
-
import { Tooltip as
|
|
2
|
+
import { Children as a, Fragment as o, isValidElement as s, useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
3
|
+
import { css as p, keyframes as m } from "@emotion/react";
|
|
4
|
+
import { createPlayer as h, useContainerAttach as g, useMediaAttach as _ } from "@videojs/react";
|
|
5
|
+
import { definePlayerFeature as v, videoFeatures as y } from "@videojs/core/dom";
|
|
6
|
+
import { Fragment as b, jsx as x, jsxs as S } from "@emotion/react/jsx-runtime";
|
|
7
|
+
import { ChevronLeft as C, ChevronRight as w, Maximize as T, Minimize as E, Pause as D, Play as O, RotateCcw as k, Settings as A, Volume1 as j, Volume2 as ee, VolumeX as te } from "react-feather";
|
|
8
|
+
import { Tooltip as ne } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var re = {
|
|
11
11
|
indexes: [],
|
|
12
12
|
thumbnails: [],
|
|
13
13
|
subtitleTracks: [],
|
|
@@ -22,19 +22,19 @@ var ee = {
|
|
|
22
22
|
playbackError: null,
|
|
23
23
|
ready: !1,
|
|
24
24
|
setSourceState: () => {}
|
|
25
|
-
}, M =
|
|
25
|
+
}, M = v({
|
|
26
26
|
name: "source",
|
|
27
|
-
state: () => ({ ...
|
|
27
|
+
state: () => ({ ...re }),
|
|
28
28
|
attach({ set: e }) {
|
|
29
29
|
e({
|
|
30
30
|
setSourceState: (t) => e(t),
|
|
31
31
|
setHideUI: (t) => e({ hideUI: t })
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
}), N =
|
|
35
|
-
features: [...
|
|
34
|
+
}), N = h({
|
|
35
|
+
features: [...y, M],
|
|
36
36
|
displayName: "MediaPlayer"
|
|
37
|
-
}), P = N.usePlayer,
|
|
37
|
+
}), P = N.usePlayer, ie = (e) => {
|
|
38
38
|
if (!(!e || e === "und")) try {
|
|
39
39
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
40
40
|
type: "language",
|
|
@@ -43,8 +43,8 @@ var ee = {
|
|
|
43
43
|
} catch {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
}, F = (e) => e?.replace(/_/g, " ").trim() || void 0,
|
|
47
|
-
let t = e.map((e) =>
|
|
46
|
+
}, F = (e) => e?.replace(/_/g, " ").trim() || void 0, ae = (e) => {
|
|
47
|
+
let t = e.map((e) => ie(e.language) ?? F(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
48
48
|
...e,
|
|
49
49
|
[t]: (e[t] ?? 0) + 1
|
|
50
50
|
}), {});
|
|
@@ -55,23 +55,23 @@ var ee = {
|
|
|
55
55
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
|
-
}, I = (e) =>
|
|
58
|
+
}, I = (e) => ae(e).map(({ track: e, label: t }) => ({
|
|
59
59
|
id: e.streamIndex,
|
|
60
60
|
label: t
|
|
61
|
-
})),
|
|
62
|
-
let i = P(), { read:
|
|
63
|
-
w.current =
|
|
64
|
-
let T =
|
|
61
|
+
})), oe = (t, n, r) => {
|
|
62
|
+
let i = P(), { read: a, size: o, publicPath: s = "", libavWorkerUrl: u = "", jassubWorkerUrl: p = "", jassubWasmUrl: m = "", jassubLegacyWasmUrl: h, defaultFontUrl: g, bufferSize: _, autoplay: v = !1 } = r ?? {}, [y, b] = f(void 0), x = d(null), S = d(0), C = d(!1), w = d(a);
|
|
63
|
+
w.current = a;
|
|
64
|
+
let T = d(r?.onSeek);
|
|
65
65
|
T.current = r?.onSeek;
|
|
66
|
-
let E =
|
|
66
|
+
let E = d(r?.onPlaybackError);
|
|
67
67
|
E.current = r?.onPlaybackError;
|
|
68
|
-
let D =
|
|
68
|
+
let D = c((e) => {
|
|
69
69
|
let t = typeof e == "number" ? e : void 0;
|
|
70
70
|
C.current = !0, i.setSourceState({ selectedSubtitleTrack: t }), x.current?.selectSubtitleStream(t);
|
|
71
|
-
}, [i]), O =
|
|
71
|
+
}, [i]), O = c((e) => {
|
|
72
72
|
typeof e == "number" && (i.setSourceState({ selectedAudioTrack: e }), b(e));
|
|
73
73
|
}, [i]), k = P((e) => e.setSourceState);
|
|
74
|
-
|
|
74
|
+
l(() => {
|
|
75
75
|
k({
|
|
76
76
|
selectSubtitleTrack: D,
|
|
77
77
|
selectAudioTrack: O
|
|
@@ -80,25 +80,25 @@ var ee = {
|
|
|
80
80
|
k,
|
|
81
81
|
D,
|
|
82
82
|
O
|
|
83
|
-
]),
|
|
84
|
-
if (!t || !n || !
|
|
83
|
+
]), l(() => {
|
|
84
|
+
if (!t || !n || !o || !a) return;
|
|
85
85
|
let r = !1;
|
|
86
86
|
i.setSourceState({
|
|
87
87
|
playbackError: null,
|
|
88
88
|
ready: !1
|
|
89
89
|
});
|
|
90
|
-
let
|
|
90
|
+
let c = (e) => {
|
|
91
91
|
r || (console.error("playback failed", e), i.setSourceState({ playbackError: e }), E.current?.(e));
|
|
92
92
|
};
|
|
93
93
|
return (async () => {
|
|
94
94
|
try {
|
|
95
|
-
let
|
|
95
|
+
let a = await e({
|
|
96
96
|
videoElement: t,
|
|
97
97
|
canvasElement: n,
|
|
98
98
|
read: (e, t) => w.current(e, t),
|
|
99
|
-
length:
|
|
100
|
-
publicPath:
|
|
101
|
-
libavWorkerUrl:
|
|
99
|
+
length: o,
|
|
100
|
+
publicPath: s,
|
|
101
|
+
libavWorkerUrl: u,
|
|
102
102
|
jassubWorkerUrl: p,
|
|
103
103
|
jassubWasmUrl: m,
|
|
104
104
|
jassubLegacyWasmUrl: h,
|
|
@@ -108,7 +108,7 @@ var ee = {
|
|
|
108
108
|
onReady: () => {
|
|
109
109
|
r || (i.setSourceState({ ready: !0 }), S.current > 0 && (t.currentTime = S.current, S.current = 0), v && t.play().catch(() => {}));
|
|
110
110
|
},
|
|
111
|
-
onError:
|
|
111
|
+
onError: c,
|
|
112
112
|
onRecovered: () => {
|
|
113
113
|
r || i.setSourceState({ playbackError: null });
|
|
114
114
|
},
|
|
@@ -127,14 +127,14 @@ var ee = {
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
if (r) {
|
|
130
|
-
|
|
130
|
+
a.destroy();
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
x.current =
|
|
134
|
-
let
|
|
135
|
-
typeof
|
|
133
|
+
x.current = a, i.setSourceState({ indexes: a.indexes });
|
|
134
|
+
let l = i.selectedSubtitleTrack;
|
|
135
|
+
typeof l == "number" && a.selectSubtitleStream(l);
|
|
136
136
|
} catch (e) {
|
|
137
|
-
|
|
137
|
+
c(e);
|
|
138
138
|
}
|
|
139
139
|
})(), () => {
|
|
140
140
|
r = !0, S.current = t.currentTime, x.current?.destroy(), x.current = null, i.setSourceState({ ready: !1 });
|
|
@@ -143,9 +143,9 @@ var ee = {
|
|
|
143
143
|
i,
|
|
144
144
|
t,
|
|
145
145
|
n,
|
|
146
|
+
o,
|
|
147
|
+
s,
|
|
146
148
|
u,
|
|
147
|
-
d,
|
|
148
|
-
f,
|
|
149
149
|
p,
|
|
150
150
|
m,
|
|
151
151
|
h,
|
|
@@ -154,44 +154,44 @@ var ee = {
|
|
|
154
154
|
y,
|
|
155
155
|
v
|
|
156
156
|
]);
|
|
157
|
-
},
|
|
158
|
-
let [
|
|
157
|
+
}, se = 5e3, ce = 6e4, L = ({ publicPath: e, workerUrl: n, length: r, read: i, downloadedRanges: a }) => {
|
|
158
|
+
let [o, s] = f([]), c = d(null), p = d(i);
|
|
159
159
|
p.current = i;
|
|
160
|
-
let m =
|
|
161
|
-
return h.current = m,
|
|
160
|
+
let m = u(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = d(m);
|
|
161
|
+
return h.current = m, l(() => {
|
|
162
162
|
if (!r || !i || !e || !n) return;
|
|
163
|
-
let a = !1, o = null,
|
|
163
|
+
let a = !1, o = null, l, u = se, d = () => {
|
|
164
164
|
t({
|
|
165
165
|
publicPath: e,
|
|
166
166
|
workerUrl: n,
|
|
167
167
|
length: r,
|
|
168
168
|
read: (e, t) => p.current(e, t),
|
|
169
169
|
onThumbnails: (e) => {
|
|
170
|
-
a ||
|
|
170
|
+
a || s(e);
|
|
171
171
|
}
|
|
172
172
|
}).then((e) => {
|
|
173
173
|
if (a) {
|
|
174
174
|
e.destroy();
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
o = e,
|
|
177
|
+
o = e, c.current = e, e.update(h.current);
|
|
178
178
|
}, () => {
|
|
179
|
-
a || (
|
|
179
|
+
a || (l = setTimeout(d, u), u = Math.min(u * 2, ce));
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
|
-
return
|
|
183
|
-
a = !0, clearTimeout(
|
|
182
|
+
return d(), () => {
|
|
183
|
+
a = !0, clearTimeout(l), c.current = null, o?.destroy(), s([]);
|
|
184
184
|
};
|
|
185
185
|
}, [
|
|
186
186
|
r,
|
|
187
187
|
e,
|
|
188
188
|
n
|
|
189
|
-
]),
|
|
190
|
-
|
|
191
|
-
}, [m]),
|
|
192
|
-
},
|
|
193
|
-
let n = P(), r =
|
|
194
|
-
|
|
189
|
+
]), l(() => {
|
|
190
|
+
c.current?.update(m);
|
|
191
|
+
}, [m]), o;
|
|
192
|
+
}, R = (e, t) => {
|
|
193
|
+
let n = P(), r = d(null);
|
|
194
|
+
l(() => {
|
|
195
195
|
if (!e || !t) return;
|
|
196
196
|
let a = i({
|
|
197
197
|
video: e,
|
|
@@ -206,13 +206,13 @@ var ee = {
|
|
|
206
206
|
t,
|
|
207
207
|
n
|
|
208
208
|
]);
|
|
209
|
-
let
|
|
209
|
+
let a = c(() => {
|
|
210
210
|
r.current?.toggle().catch((e) => {
|
|
211
211
|
console.warn("picture in picture was refused", e);
|
|
212
212
|
});
|
|
213
213
|
}, []);
|
|
214
|
-
return e && t ?
|
|
215
|
-
},
|
|
214
|
+
return e && t ? a : null;
|
|
215
|
+
}, z = {
|
|
216
216
|
headings: {
|
|
217
217
|
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 ",
|
|
218
218
|
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 ",
|
|
@@ -239,75 +239,43 @@ var ee = {
|
|
|
239
239
|
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 ",
|
|
240
240
|
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 "
|
|
241
241
|
}
|
|
242
|
-
},
|
|
242
|
+
}, le = p`
|
|
243
243
|
top: unset !important;
|
|
244
244
|
left: unset !important;
|
|
245
245
|
width: 100%;
|
|
246
246
|
height: 100%;
|
|
247
247
|
margin: auto;
|
|
248
248
|
pointer-events: none;
|
|
249
|
-
`,
|
|
249
|
+
`, ue = p`
|
|
250
250
|
position: absolute;
|
|
251
251
|
top: 0;
|
|
252
252
|
left: 0;
|
|
253
253
|
width: 100%;
|
|
254
|
+
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
255
|
+
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
256
|
+
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
257
|
+
${z.headings.small}
|
|
258
|
+
color: white;
|
|
259
|
+
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
254
260
|
z-index: 2;
|
|
255
|
-
/* the video underneath keeps the click that toggles playback; anything in the slot that needs a
|
|
256
|
-
pointer takes it back for itself */
|
|
257
261
|
pointer-events: none;
|
|
258
262
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
sits in, so a shorthand in a media query would override the longhands above it and silently
|
|
265
|
-
drop the safe-area insets. Those clear a notch once the player is fullscreen and resolve to
|
|
266
|
-
zero everywhere else. */
|
|
267
|
-
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
268
|
-
padding-bottom: calc(1.2 * var(--mp-unit));
|
|
269
|
-
padding-left: calc(calc(1.6 * var(--mp-unit)) + env(safe-area-inset-left, 0px));
|
|
270
|
-
padding-right: calc(calc(1.6 * var(--mp-unit)) + env(safe-area-inset-right, 0px));
|
|
263
|
+
/* one line with an ellipsis until there is width to wrap, since a release filename would
|
|
264
|
+
otherwise run to four lines on a phone */
|
|
265
|
+
white-space: nowrap;
|
|
266
|
+
overflow: hidden;
|
|
267
|
+
text-overflow: ellipsis;
|
|
271
268
|
|
|
272
269
|
@media (min-width: 768px) {
|
|
270
|
+
padding: calc(2.4 * var(--mp-unit));
|
|
273
271
|
padding-top: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
padding-right: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-right, 0px));
|
|
272
|
+
white-space: normal;
|
|
273
|
+
overflow: visible;
|
|
277
274
|
}
|
|
278
275
|
|
|
279
276
|
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%);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
does not, and transitioning it holds the element visible for the length of the fade. */
|
|
283
|
-
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
284
|
-
|
|
285
|
-
.title {
|
|
286
|
-
${V.headings.small}
|
|
287
|
-
color: white;
|
|
288
|
-
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
289
|
-
|
|
290
|
-
/* one line with an ellipsis until there is width to wrap, since a release filename would
|
|
291
|
-
otherwise run to four lines on a phone */
|
|
292
|
-
flex: 1;
|
|
293
|
-
min-width: 0;
|
|
294
|
-
white-space: nowrap;
|
|
295
|
-
overflow: hidden;
|
|
296
|
-
text-overflow: ellipsis;
|
|
297
|
-
|
|
298
|
-
@media (min-width: 768px) {
|
|
299
|
-
white-space: normal;
|
|
300
|
-
overflow: visible;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/* pinned right with or without a title, so an app's readout does not jump sideways when a
|
|
305
|
-
filename arrives late */
|
|
306
|
-
.app-slot {
|
|
307
|
-
margin-left: auto;
|
|
308
|
-
flex: none;
|
|
309
|
-
}
|
|
310
|
-
`, oe = u`
|
|
277
|
+
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
278
|
+
`, de = p`
|
|
311
279
|
position: absolute;
|
|
312
280
|
inset: 0;
|
|
313
281
|
z-index: 2;
|
|
@@ -323,53 +291,47 @@ var ee = {
|
|
|
323
291
|
border-radius: 50%;
|
|
324
292
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
325
293
|
border-top-color: #fff;
|
|
326
|
-
animation: ${
|
|
294
|
+
animation: ${m`
|
|
327
295
|
to { transform: rotate(360deg); }
|
|
328
296
|
`} 0.8s linear infinite;
|
|
329
297
|
}
|
|
330
|
-
`,
|
|
298
|
+
`, fe = p`
|
|
331
299
|
position: absolute;
|
|
332
300
|
inset: auto 0 20%;
|
|
333
301
|
z-index: 3;
|
|
334
302
|
padding: 0 calc(2 * var(--mp-unit));
|
|
335
303
|
text-align: center;
|
|
336
304
|
color: #fff;
|
|
337
|
-
${
|
|
305
|
+
${z.bLarge.regular}
|
|
338
306
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
339
307
|
pointer-events: none;
|
|
340
|
-
`,
|
|
341
|
-
let
|
|
342
|
-
return /* @__PURE__ */
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
308
|
+
`, pe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", B = ({ onCanvasRef: e }) => {
|
|
309
|
+
let t = P((e) => e.title), n = P((e) => e.hideUI), r = P((e) => e.playbackError), i = P((e) => e.ready), a = P((e) => e.size), o = P((e) => e.waiting);
|
|
310
|
+
return /* @__PURE__ */ S(b, { children: [
|
|
311
|
+
t ? /* @__PURE__ */ x("div", {
|
|
312
|
+
className: "title",
|
|
313
|
+
css: ue,
|
|
314
|
+
style: { ...n ? {
|
|
346
315
|
opacity: "0",
|
|
347
|
-
visibility: "hidden",
|
|
348
316
|
pointerEvents: "none"
|
|
349
317
|
} : {} },
|
|
350
|
-
children:
|
|
351
|
-
className: "title",
|
|
352
|
-
children: n
|
|
353
|
-
}) : void 0, t ? /* @__PURE__ */ v("div", {
|
|
354
|
-
className: "app-slot",
|
|
355
|
-
children: t
|
|
356
|
-
}) : void 0]
|
|
318
|
+
children: t
|
|
357
319
|
}) : void 0,
|
|
358
|
-
(
|
|
359
|
-
|
|
360
|
-
css:
|
|
361
|
-
children:
|
|
320
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ x("div", { css: de }) : void 0,
|
|
321
|
+
r ? /* @__PURE__ */ x("div", {
|
|
322
|
+
css: fe,
|
|
323
|
+
children: pe(r)
|
|
362
324
|
}) : void 0,
|
|
363
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ x("canvas", {
|
|
364
326
|
ref: e,
|
|
365
|
-
css:
|
|
327
|
+
css: le
|
|
366
328
|
})
|
|
367
329
|
] });
|
|
368
|
-
},
|
|
330
|
+
}, 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) => {
|
|
369
331
|
if (e === void 0) return "0:00";
|
|
370
332
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
371
333
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
372
|
-
},
|
|
334
|
+
}, me = (e, t) => `${G(e)} / ${G(t)}`, he = (e) => p`
|
|
373
335
|
display: flex;
|
|
374
336
|
justify-content: flex-end;
|
|
375
337
|
|
|
@@ -379,19 +341,19 @@ var ee = {
|
|
|
379
341
|
z-index: 3;
|
|
380
342
|
|
|
381
343
|
* {
|
|
382
|
-
${
|
|
344
|
+
${z.bMedium.regular}
|
|
383
345
|
}
|
|
384
346
|
|
|
385
|
-
${e === "sm" &&
|
|
347
|
+
${e === "sm" && p`
|
|
386
348
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
387
349
|
`}
|
|
388
|
-
${e === "md" &&
|
|
350
|
+
${e === "md" && p`
|
|
389
351
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
390
352
|
`}
|
|
391
|
-
${e === "lg" &&
|
|
353
|
+
${e === "lg" && p`
|
|
392
354
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
393
355
|
`}
|
|
394
|
-
`,
|
|
356
|
+
`, 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__ */ S(b, { children: [/* @__PURE__ */ x("div", {
|
|
395
357
|
"data-tooltip-id": e,
|
|
396
358
|
"data-open": !0,
|
|
397
359
|
"data-tooltip-offset": a,
|
|
@@ -399,28 +361,28 @@ var ee = {
|
|
|
399
361
|
"data-tooltip-delay-hide": i,
|
|
400
362
|
"data-tooltip-place": o,
|
|
401
363
|
children: n
|
|
402
|
-
}), !s && /* @__PURE__ */
|
|
403
|
-
css:
|
|
364
|
+
}), !s && /* @__PURE__ */ x(ne, {
|
|
365
|
+
css: he(c),
|
|
404
366
|
id: e,
|
|
405
367
|
noArrow: !0,
|
|
406
368
|
children: t
|
|
407
|
-
})] }),
|
|
408
|
-
let [i,
|
|
409
|
-
|
|
410
|
-
let
|
|
369
|
+
})] }), q = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
370
|
+
let [i, a] = f(!1), o = d(t);
|
|
371
|
+
o.current = t;
|
|
372
|
+
let s = d(null), u = c((t, r) => {
|
|
411
373
|
let i = e.current;
|
|
412
374
|
if (!i) return 0;
|
|
413
375
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
414
376
|
return Math.min(Math.max(l, 0), 1);
|
|
415
|
-
}, [e, n]), p =
|
|
416
|
-
r || e.button > 0 || (
|
|
417
|
-
}, [r,
|
|
418
|
-
|
|
419
|
-
}, [
|
|
420
|
-
|
|
377
|
+
}, [e, n]), p = c((e) => {
|
|
378
|
+
r || e.button > 0 || (s.current = e.pointerId, e.currentTarget.setPointerCapture?.(e.pointerId), a(!0), o.current(u(e.clientX, e.clientY)));
|
|
379
|
+
}, [r, u]), m = c((e) => {
|
|
380
|
+
s.current === e.pointerId && o.current(u(e.clientX, e.clientY));
|
|
381
|
+
}, [u]), h = c((e) => {
|
|
382
|
+
s.current === e.pointerId && (s.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), a(!1));
|
|
421
383
|
}, []);
|
|
422
|
-
return
|
|
423
|
-
r && (
|
|
384
|
+
return l(() => {
|
|
385
|
+
r && (s.current = null, a(!1));
|
|
424
386
|
}, [r]), {
|
|
425
387
|
dragging: i,
|
|
426
388
|
handlers: {
|
|
@@ -431,7 +393,7 @@ var ee = {
|
|
|
431
393
|
style: { touchAction: "none" }
|
|
432
394
|
}
|
|
433
395
|
};
|
|
434
|
-
},
|
|
396
|
+
}, ge = p`
|
|
435
397
|
position: relative;
|
|
436
398
|
height: calc(.4 * var(--mp-unit));
|
|
437
399
|
|
|
@@ -476,7 +438,7 @@ var ee = {
|
|
|
476
438
|
justify-content: center;
|
|
477
439
|
|
|
478
440
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
479
|
-
${
|
|
441
|
+
${z.bMedium.bold}
|
|
480
442
|
|
|
481
443
|
position: absolute;
|
|
482
444
|
top: calc(-2.5 * var(--mp-unit));
|
|
@@ -588,30 +550,30 @@ var ee = {
|
|
|
588
550
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
589
551
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
590
552
|
}
|
|
591
|
-
`,
|
|
592
|
-
let e = P(), t = P((e) => e.currentTime), n = P((e) => e.duration), r = P((e) => e.size), i = P((e) => e.downloadedRanges), a = P((e) => e.indexes),
|
|
593
|
-
ref:
|
|
553
|
+
`, J = () => {
|
|
554
|
+
let e = P(), t = P((e) => e.currentTime), n = P((e) => e.duration), r = P((e) => e.size), i = P((e) => e.downloadedRanges), a = P((e) => e.indexes), o = P((e) => e.thumbnails), s = P((e) => e.thumbnailAt), c = d(null), [p, m] = f(void 0), [h, g] = f(void 0), _ = d(void 0), { dragging: v, handlers: y } = q({
|
|
555
|
+
ref: c,
|
|
594
556
|
onChange: (e) => {
|
|
595
557
|
m(e), _.current !== "mouse" && g(e * n);
|
|
596
558
|
}
|
|
597
|
-
}),
|
|
598
|
-
_.current = e.pointerType,
|
|
559
|
+
}), b = (e) => {
|
|
560
|
+
_.current = e.pointerType, y.onPointerDown(e);
|
|
599
561
|
}, C = (e) => {
|
|
600
|
-
|
|
562
|
+
y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
|
|
601
563
|
}, w = (e) => {
|
|
602
|
-
if (!
|
|
603
|
-
let { left: t, right: r } =
|
|
564
|
+
if (!c.current) return;
|
|
565
|
+
let { left: t, right: r } = c.current.getBoundingClientRect();
|
|
604
566
|
return Math.min(Math.max((e - t) / (r - t), 0), 1) * n;
|
|
605
567
|
}, T = (e) => {
|
|
606
568
|
g(w(e.clientX));
|
|
607
569
|
}, E = () => {
|
|
608
|
-
|
|
609
|
-
}, D = (e) => n ? e / n * 100 : 0, O =
|
|
570
|
+
c.current && g(void 0);
|
|
571
|
+
}, D = (e) => n ? e / n * 100 : 0, O = u(() => i?.map((e, t) => {
|
|
610
572
|
if (!r || !n) return null;
|
|
611
573
|
let i = a.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), o = i.at(0), s = i.at(-1);
|
|
612
574
|
if (!o || !s) return null;
|
|
613
575
|
let c = o.timestamp / n, l = s.timestamp / n, u = Number((l - c).toFixed(2)), d = c * 100;
|
|
614
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ x("div", {
|
|
615
577
|
className: "loaded-part",
|
|
616
578
|
style: {
|
|
617
579
|
transform: `scaleX(${u})`,
|
|
@@ -622,12 +584,12 @@ var ee = {
|
|
|
622
584
|
n,
|
|
623
585
|
a.length,
|
|
624
586
|
i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
625
|
-
]), k =
|
|
587
|
+
]), k = u(() => {
|
|
626
588
|
if (!h || h < 0) return;
|
|
627
589
|
let e = Math.floor(h / 3600), t = Math.floor((h - e * 3600) / 60), n = Math.floor(h - e * 3600 - t * 60);
|
|
628
590
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
629
591
|
}, [h]);
|
|
630
|
-
|
|
592
|
+
l(() => {
|
|
631
593
|
if (p === void 0 || !n) return;
|
|
632
594
|
let t = p * n;
|
|
633
595
|
e.seek(t);
|
|
@@ -636,59 +598,59 @@ var ee = {
|
|
|
636
598
|
p,
|
|
637
599
|
n
|
|
638
600
|
]);
|
|
639
|
-
let A =
|
|
601
|
+
let A = u(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = u(() => {
|
|
640
602
|
if (h) {
|
|
641
|
-
if (
|
|
642
|
-
if (
|
|
603
|
+
if (s) return s(h);
|
|
604
|
+
if (o.length) return o.find(({ startTime: e, endTime: t }) => e <= h && h < t);
|
|
643
605
|
}
|
|
644
606
|
}, [
|
|
645
|
-
|
|
646
|
-
|
|
607
|
+
o,
|
|
608
|
+
s,
|
|
647
609
|
h
|
|
648
610
|
]);
|
|
649
|
-
return /* @__PURE__ */
|
|
650
|
-
css:
|
|
651
|
-
ref:
|
|
652
|
-
className:
|
|
611
|
+
return /* @__PURE__ */ S("div", {
|
|
612
|
+
css: ge,
|
|
613
|
+
ref: c,
|
|
614
|
+
className: v ? "progress-bar dragging" : "progress-bar",
|
|
653
615
|
onMouseMove: T,
|
|
654
616
|
onMouseOut: E,
|
|
655
617
|
children: [
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
h ? /* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ x("div", { className: "background-bar" }),
|
|
619
|
+
h ? /* @__PURE__ */ x("div", {
|
|
658
620
|
className: "cursor-time",
|
|
659
621
|
style: { left: `clamp(calc(1.8 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(1.8 * var(--mp-unit))))` },
|
|
660
622
|
children: k
|
|
661
623
|
}) : void 0,
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ x("div", { className: "progress" }),
|
|
625
|
+
/* @__PURE__ */ x("div", {
|
|
664
626
|
className: "loaded",
|
|
665
627
|
children: O
|
|
666
628
|
}),
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ x("div", { className: "hover" }),
|
|
630
|
+
/* @__PURE__ */ x("div", {
|
|
669
631
|
className: "play-container",
|
|
670
|
-
children: /* @__PURE__ */
|
|
632
|
+
children: /* @__PURE__ */ x("div", {
|
|
671
633
|
className: "play",
|
|
672
634
|
style: { transform: `scaleX(${A})` }
|
|
673
635
|
})
|
|
674
636
|
}),
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ x("div", { className: "chapters" }),
|
|
638
|
+
/* @__PURE__ */ x("div", { className: "scrubber" }),
|
|
639
|
+
/* @__PURE__ */ x("div", {
|
|
678
640
|
className: "padding",
|
|
679
|
-
...
|
|
680
|
-
onPointerDown:
|
|
641
|
+
...y,
|
|
642
|
+
onPointerDown: b,
|
|
681
643
|
onPointerUp: C,
|
|
682
644
|
onPointerCancel: C
|
|
683
645
|
}),
|
|
684
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ x("div", {
|
|
685
647
|
className: "thumbnail",
|
|
686
648
|
style: { left: `clamp(var(--thumbnail-half), ${D(h ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
687
|
-
children: j?.url ? /* @__PURE__ */
|
|
649
|
+
children: j?.url ? /* @__PURE__ */ x("img", { src: j.url }) : void 0
|
|
688
650
|
})
|
|
689
651
|
]
|
|
690
652
|
});
|
|
691
|
-
},
|
|
653
|
+
}, _e = "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", ve = p`
|
|
692
654
|
display: flex;
|
|
693
655
|
align-items: center;
|
|
694
656
|
justify-content: center;
|
|
@@ -741,42 +703,42 @@ width: 100%;
|
|
|
741
703
|
}
|
|
742
704
|
}
|
|
743
705
|
}
|
|
744
|
-
`,
|
|
745
|
-
let e = P(), t = P((e) => e.playbackRate), n =
|
|
706
|
+
`, ye = () => {
|
|
707
|
+
let e = P(), t = P((e) => e.playbackRate), n = d(null), r = d(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, u = (e) => o(i + e * a), { handlers: f } = q({
|
|
746
708
|
ref: r,
|
|
747
|
-
onChange: (t) => e.setPlaybackRate(
|
|
709
|
+
onChange: (t) => e.setPlaybackRate(u(t))
|
|
748
710
|
}), p = (t) => {
|
|
749
711
|
t.preventDefault();
|
|
750
|
-
let n = .05, r =
|
|
712
|
+
let n = .05, r = s;
|
|
751
713
|
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
752
714
|
};
|
|
753
|
-
|
|
715
|
+
l(() => {
|
|
754
716
|
let e = n.current;
|
|
755
717
|
return e && e.addEventListener("wheel", p, { passive: !1 }), () => {
|
|
756
718
|
e && e.removeEventListener("wheel", p);
|
|
757
719
|
};
|
|
758
720
|
}, [t]);
|
|
759
|
-
let m =
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
css:
|
|
762
|
-
children: [/* @__PURE__ */
|
|
721
|
+
let m = c(s);
|
|
722
|
+
return /* @__PURE__ */ S("div", {
|
|
723
|
+
css: ve,
|
|
724
|
+
children: [/* @__PURE__ */ S("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ x("div", {
|
|
763
725
|
className: "playback-slider",
|
|
764
726
|
ref: n,
|
|
765
727
|
...f,
|
|
766
|
-
children: /* @__PURE__ */
|
|
728
|
+
children: /* @__PURE__ */ x("div", {
|
|
767
729
|
ref: r,
|
|
768
730
|
style: { background: `linear-gradient(to right,
|
|
769
731
|
#fff 0% ${m}%,
|
|
770
732
|
#3A3A3A ${m}% 100%
|
|
771
733
|
)` },
|
|
772
|
-
children: /* @__PURE__ */
|
|
734
|
+
children: /* @__PURE__ */ x("div", {
|
|
773
735
|
className: "playback-handle",
|
|
774
736
|
style: { left: `${m}%` }
|
|
775
737
|
})
|
|
776
738
|
})
|
|
777
739
|
})]
|
|
778
740
|
});
|
|
779
|
-
},
|
|
741
|
+
}, be = p`
|
|
780
742
|
position: relative;
|
|
781
743
|
|
|
782
744
|
.settings {
|
|
@@ -814,7 +776,7 @@ position: relative;
|
|
|
814
776
|
|
|
815
777
|
border-radius: 8px;
|
|
816
778
|
background-color: rgba(28,28,28,0.95);
|
|
817
|
-
${
|
|
779
|
+
${z.bMedium.regular}
|
|
818
780
|
|
|
819
781
|
z-index: 4;
|
|
820
782
|
|
|
@@ -857,7 +819,7 @@ position: relative;
|
|
|
857
819
|
|
|
858
820
|
.secondary {
|
|
859
821
|
color: #eee;
|
|
860
|
-
${
|
|
822
|
+
${z.bSmall.regular}
|
|
861
823
|
}
|
|
862
824
|
}
|
|
863
825
|
}
|
|
@@ -925,106 +887,106 @@ position: relative;
|
|
|
925
887
|
word-break: break-word;
|
|
926
888
|
}
|
|
927
889
|
}
|
|
928
|
-
`, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, allowDisable: a }) => /* @__PURE__ */
|
|
890
|
+
`, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, allowDisable: a }) => /* @__PURE__ */ S("div", {
|
|
929
891
|
className: "popover track-list",
|
|
930
892
|
children: [
|
|
931
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ S("div", {
|
|
932
894
|
className: "back",
|
|
933
895
|
onClick: i,
|
|
934
|
-
children: [/* @__PURE__ */
|
|
896
|
+
children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: e })]
|
|
935
897
|
}),
|
|
936
|
-
a ? /* @__PURE__ */
|
|
898
|
+
a ? /* @__PURE__ */ S("div", {
|
|
937
899
|
onClick: () => r(void 0),
|
|
938
|
-
children: [/* @__PURE__ */
|
|
900
|
+
children: [/* @__PURE__ */ x("span", { children: "Disable" }), /* @__PURE__ */ x("span", { children: n === void 0 ? "✓" : "" })]
|
|
939
901
|
}) : null,
|
|
940
|
-
t.map(({ id: e, label: t }) => /* @__PURE__ */
|
|
902
|
+
t.map(({ id: e, label: t }) => /* @__PURE__ */ S("div", {
|
|
941
903
|
onClick: () => r(e),
|
|
942
904
|
className: "description",
|
|
943
|
-
children: [/* @__PURE__ */
|
|
905
|
+
children: [/* @__PURE__ */ x("span", { children: t }), /* @__PURE__ */ x("span", { children: n === e ? "✓" : "" })]
|
|
944
906
|
}, e))
|
|
945
907
|
]
|
|
946
|
-
}),
|
|
947
|
-
let e = P(), t = P((e) => e.playbackRate), n = P((e) => e.subtitleTracks), r = P((e) => e.selectedSubtitleTrack), i = P((e) => e.selectSubtitleTrack), a = P((e) => e.audioTracks),
|
|
948
|
-
|
|
908
|
+
}), xe = () => {
|
|
909
|
+
let e = P(), t = P((e) => e.playbackRate), n = P((e) => e.subtitleTracks), r = P((e) => e.selectedSubtitleTrack), i = P((e) => e.selectSubtitleTrack), a = P((e) => e.audioTracks), o = P((e) => e.selectedAudioTrack), s = P((e) => e.selectAudioTrack), [c, u] = f(!1), [p, m] = f(0), h = d(null), g = () => {
|
|
910
|
+
u(!c), m(0);
|
|
949
911
|
}, _ = (t) => {
|
|
950
912
|
e.setPlaybackRate(t), m(0);
|
|
951
913
|
};
|
|
952
|
-
|
|
914
|
+
l(() => {
|
|
953
915
|
let e = (e) => {
|
|
954
|
-
|
|
916
|
+
c && h.current && !h.current.contains(e.target) && g();
|
|
955
917
|
};
|
|
956
918
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
957
|
-
}, [
|
|
958
|
-
let
|
|
919
|
+
}, [c]);
|
|
920
|
+
let v = (e) => {
|
|
959
921
|
i(e), g();
|
|
960
|
-
},
|
|
961
|
-
e !== void 0 &&
|
|
962
|
-
},
|
|
922
|
+
}, y = (e) => {
|
|
923
|
+
e !== void 0 && s(e), g();
|
|
924
|
+
}, b = (e) => () => {
|
|
963
925
|
m(e);
|
|
964
926
|
};
|
|
965
|
-
return /* @__PURE__ */
|
|
966
|
-
css:
|
|
927
|
+
return /* @__PURE__ */ S("div", {
|
|
928
|
+
css: be,
|
|
967
929
|
ref: h,
|
|
968
930
|
children: [
|
|
969
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ x(K, {
|
|
970
932
|
id: "settings",
|
|
971
|
-
disabled:
|
|
972
|
-
text: /* @__PURE__ */
|
|
933
|
+
disabled: c,
|
|
934
|
+
text: /* @__PURE__ */ x("button", {
|
|
973
935
|
className: "settings",
|
|
974
936
|
type: "button",
|
|
975
937
|
onClick: g,
|
|
976
|
-
children: /* @__PURE__ */
|
|
938
|
+
children: /* @__PURE__ */ x(A, {})
|
|
977
939
|
}),
|
|
978
|
-
toolTipText: /* @__PURE__ */
|
|
940
|
+
toolTipText: /* @__PURE__ */ x("span", { children: "Settings" })
|
|
979
941
|
}),
|
|
980
|
-
|
|
942
|
+
c && p === 0 && /* @__PURE__ */ S("div", {
|
|
981
943
|
className: "popover menu",
|
|
982
944
|
children: [
|
|
983
|
-
a.length > 1 ? /* @__PURE__ */
|
|
984
|
-
onClick:
|
|
985
|
-
children: [/* @__PURE__ */
|
|
945
|
+
a.length > 1 ? /* @__PURE__ */ S("div", {
|
|
946
|
+
onClick: b(3),
|
|
947
|
+
children: [/* @__PURE__ */ x("div", { children: "Audio" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
|
|
986
948
|
}) : null,
|
|
987
|
-
n.length > 0 ? /* @__PURE__ */
|
|
988
|
-
onClick:
|
|
989
|
-
children: [/* @__PURE__ */
|
|
949
|
+
n.length > 0 ? /* @__PURE__ */ S("div", {
|
|
950
|
+
onClick: b(2),
|
|
951
|
+
children: [/* @__PURE__ */ x("div", { children: "Subtitles" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
|
|
990
952
|
}) : null,
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
onClick:
|
|
993
|
-
children: [/* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ S("div", {
|
|
954
|
+
onClick: b(1),
|
|
955
|
+
children: [/* @__PURE__ */ x("div", { children: "Playback speed" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
994
956
|
className: "secondary",
|
|
995
957
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
996
|
-
}), /* @__PURE__ */
|
|
958
|
+
}), /* @__PURE__ */ x(w, {})] })]
|
|
997
959
|
})
|
|
998
960
|
]
|
|
999
961
|
}),
|
|
1000
|
-
|
|
962
|
+
c && p === 1 && /* @__PURE__ */ S("div", {
|
|
1001
963
|
className: "popover playback-rate",
|
|
1002
964
|
children: [
|
|
1003
|
-
/* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ S("div", {
|
|
1004
966
|
className: "back",
|
|
1005
|
-
onClick:
|
|
1006
|
-
children: [/* @__PURE__ */
|
|
967
|
+
onClick: b(0),
|
|
968
|
+
children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: "Playback speed" })]
|
|
1007
969
|
}),
|
|
1008
|
-
/* @__PURE__ */
|
|
970
|
+
/* @__PURE__ */ x("div", {
|
|
1009
971
|
className: "slider no-hover",
|
|
1010
|
-
children: /* @__PURE__ */
|
|
972
|
+
children: /* @__PURE__ */ x(ye, {})
|
|
1011
973
|
}),
|
|
1012
|
-
/* @__PURE__ */
|
|
974
|
+
/* @__PURE__ */ S("div", {
|
|
1013
975
|
className: "options no-hover",
|
|
1014
976
|
children: [
|
|
1015
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ x("div", {
|
|
1016
978
|
onClick: () => _(.5),
|
|
1017
979
|
children: "0.5x"
|
|
1018
980
|
}),
|
|
1019
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ x("div", {
|
|
1020
982
|
onClick: () => _(1),
|
|
1021
983
|
children: "1x"
|
|
1022
984
|
}),
|
|
1023
|
-
/* @__PURE__ */
|
|
985
|
+
/* @__PURE__ */ x("div", {
|
|
1024
986
|
onClick: () => _(1.5),
|
|
1025
987
|
children: "1.5x"
|
|
1026
988
|
}),
|
|
1027
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ x("div", {
|
|
1028
990
|
onClick: () => _(2),
|
|
1029
991
|
children: "2x"
|
|
1030
992
|
})
|
|
@@ -1032,30 +994,30 @@ position: relative;
|
|
|
1032
994
|
})
|
|
1033
995
|
]
|
|
1034
996
|
}),
|
|
1035
|
-
|
|
997
|
+
c && p === 2 && /* @__PURE__ */ x(Y, {
|
|
1036
998
|
title: "Subtitles",
|
|
1037
999
|
tracks: n,
|
|
1038
1000
|
selected: r,
|
|
1039
|
-
onSelect:
|
|
1040
|
-
onBack:
|
|
1001
|
+
onSelect: v,
|
|
1002
|
+
onBack: b(0),
|
|
1041
1003
|
allowDisable: !0
|
|
1042
1004
|
}),
|
|
1043
|
-
|
|
1005
|
+
c && p === 3 && /* @__PURE__ */ x(Y, {
|
|
1044
1006
|
title: "Audio",
|
|
1045
1007
|
tracks: a,
|
|
1046
|
-
selected:
|
|
1047
|
-
onSelect:
|
|
1048
|
-
onBack:
|
|
1008
|
+
selected: o,
|
|
1009
|
+
onSelect: y,
|
|
1010
|
+
onBack: b(0)
|
|
1049
1011
|
})
|
|
1050
1012
|
]
|
|
1051
1013
|
});
|
|
1052
|
-
},
|
|
1014
|
+
}, Se = {
|
|
1053
1015
|
primary: "#EAEBEE",
|
|
1054
1016
|
secondary: "#D0D0D9",
|
|
1055
1017
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1056
1018
|
borderPrimary: "#384F70",
|
|
1057
1019
|
backgroundTooltip: "#222222"
|
|
1058
|
-
},
|
|
1020
|
+
}, Ce = p`
|
|
1059
1021
|
display: flex;
|
|
1060
1022
|
align-items: center;
|
|
1061
1023
|
|
|
@@ -1098,46 +1060,46 @@ position: relative;
|
|
|
1098
1060
|
width: 10px;
|
|
1099
1061
|
height: 10px;
|
|
1100
1062
|
}
|
|
1101
|
-
`,
|
|
1102
|
-
let n = P((e) => e.volume), r = P((e) => e.muted), i =
|
|
1063
|
+
`, we = ({ value: e, onChange: t }) => {
|
|
1064
|
+
let n = P((e) => e.volume), r = P((e) => e.muted), i = d(null), a = d(null), { handlers: o } = q({
|
|
1103
1065
|
ref: a,
|
|
1104
1066
|
onChange: t
|
|
1105
|
-
}),
|
|
1067
|
+
}), s = (n) => {
|
|
1106
1068
|
n.preventDefault();
|
|
1107
1069
|
let r = .05, i = e;
|
|
1108
1070
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
1109
1071
|
};
|
|
1110
|
-
|
|
1072
|
+
l(() => {
|
|
1111
1073
|
let e = i.current;
|
|
1112
|
-
return e && e.addEventListener("wheel",
|
|
1113
|
-
e && e.removeEventListener("wheel",
|
|
1074
|
+
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
1075
|
+
e && e.removeEventListener("wheel", s);
|
|
1114
1076
|
};
|
|
1115
1077
|
}, [e]);
|
|
1116
|
-
let
|
|
1117
|
-
return /* @__PURE__ */
|
|
1078
|
+
let c = e * 100, f = u(() => Math.round(r ? 0 : W(n) * 100), [n, r]);
|
|
1079
|
+
return /* @__PURE__ */ x(K, {
|
|
1118
1080
|
id: "volume-slider",
|
|
1119
|
-
text: /* @__PURE__ */
|
|
1081
|
+
text: /* @__PURE__ */ x("div", {
|
|
1120
1082
|
ref: i,
|
|
1121
|
-
css:
|
|
1122
|
-
...
|
|
1123
|
-
children: /* @__PURE__ */
|
|
1083
|
+
css: Ce,
|
|
1084
|
+
...o,
|
|
1085
|
+
children: /* @__PURE__ */ x("div", {
|
|
1124
1086
|
ref: a,
|
|
1125
1087
|
style: { background: `linear-gradient(to right,
|
|
1126
|
-
#fff 0% ${
|
|
1127
|
-
#3A3A3A ${
|
|
1088
|
+
#fff 0% ${c}%,
|
|
1089
|
+
#3A3A3A ${c}% 100%
|
|
1128
1090
|
)` },
|
|
1129
|
-
children: /* @__PURE__ */
|
|
1091
|
+
children: /* @__PURE__ */ x("div", {
|
|
1130
1092
|
className: "volume-handle",
|
|
1131
1093
|
style: { left: `${e * 100}%` }
|
|
1132
1094
|
})
|
|
1133
1095
|
})
|
|
1134
1096
|
}),
|
|
1135
|
-
toolTipText: /* @__PURE__ */
|
|
1097
|
+
toolTipText: /* @__PURE__ */ S("div", {
|
|
1136
1098
|
className: "volume-value",
|
|
1137
1099
|
children: [f, "%"]
|
|
1138
1100
|
})
|
|
1139
1101
|
});
|
|
1140
|
-
},
|
|
1102
|
+
}, Te = p`
|
|
1141
1103
|
position: relative;
|
|
1142
1104
|
display: flex;
|
|
1143
1105
|
align-items: center;
|
|
@@ -1162,7 +1124,7 @@ position: relative;
|
|
|
1162
1124
|
border-radius: 4px;
|
|
1163
1125
|
|
|
1164
1126
|
.volume-value {
|
|
1165
|
-
${
|
|
1127
|
+
${z.bMedium.regular};
|
|
1166
1128
|
color: #ffffff;
|
|
1167
1129
|
}
|
|
1168
1130
|
}
|
|
@@ -1200,37 +1162,37 @@ position: relative;
|
|
|
1200
1162
|
}
|
|
1201
1163
|
}
|
|
1202
1164
|
|
|
1203
|
-
`,
|
|
1204
|
-
let t = P(), n = P((e) => e.volume), r = P((e) => e.muted), i =
|
|
1205
|
-
return /* @__PURE__ */
|
|
1206
|
-
css:
|
|
1207
|
-
children: [/* @__PURE__ */
|
|
1165
|
+
`, Ee = ({ ref: e }) => {
|
|
1166
|
+
let t = P(), n = P((e) => e.volume), r = P((e) => e.muted), i = u(() => W(n), [n]);
|
|
1167
|
+
return /* @__PURE__ */ S("div", {
|
|
1168
|
+
css: Te,
|
|
1169
|
+
children: [/* @__PURE__ */ x(K, {
|
|
1208
1170
|
id: "sound",
|
|
1209
|
-
text: /* @__PURE__ */
|
|
1171
|
+
text: /* @__PURE__ */ x("button", {
|
|
1210
1172
|
className: "sound",
|
|
1211
1173
|
type: "button",
|
|
1212
1174
|
onClick: () => t.toggleMuted(),
|
|
1213
1175
|
ref: e,
|
|
1214
|
-
children:
|
|
1176
|
+
children: x(r || n === 0 ? te : n <= .5 ? j : ee, {
|
|
1215
1177
|
size: 18,
|
|
1216
1178
|
color: "#fff"
|
|
1217
1179
|
})
|
|
1218
1180
|
}),
|
|
1219
|
-
toolTipText: /* @__PURE__ */
|
|
1220
|
-
}), /* @__PURE__ */
|
|
1181
|
+
toolTipText: /* @__PURE__ */ x("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
1182
|
+
}), /* @__PURE__ */ x("div", {
|
|
1221
1183
|
className: "volume-slider-container",
|
|
1222
|
-
children: /* @__PURE__ */
|
|
1184
|
+
children: /* @__PURE__ */ x("div", {
|
|
1223
1185
|
className: "volume-slider-background",
|
|
1224
|
-
children: /* @__PURE__ */
|
|
1186
|
+
children: /* @__PURE__ */ x(we, {
|
|
1225
1187
|
value: r ? 0 : i,
|
|
1226
1188
|
onChange: (e) => {
|
|
1227
|
-
t.setVolume(
|
|
1189
|
+
t.setVolume(U(e));
|
|
1228
1190
|
}
|
|
1229
1191
|
})
|
|
1230
1192
|
})
|
|
1231
1193
|
})]
|
|
1232
1194
|
});
|
|
1233
|
-
}, X = .05, Z = 5,
|
|
1195
|
+
}, X = .05, Z = 5, De = p`
|
|
1234
1196
|
position: absolute;
|
|
1235
1197
|
bottom: 0;
|
|
1236
1198
|
width: 100%;
|
|
@@ -1314,7 +1276,7 @@ position: relative;
|
|
|
1314
1276
|
cursor: pointer;
|
|
1315
1277
|
|
|
1316
1278
|
:hover {
|
|
1317
|
-
background-color: ${
|
|
1279
|
+
background-color: ${Se.hover};
|
|
1318
1280
|
}
|
|
1319
1281
|
|
|
1320
1282
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1331,7 +1293,7 @@ position: relative;
|
|
|
1331
1293
|
|
|
1332
1294
|
.left {
|
|
1333
1295
|
.time {
|
|
1334
|
-
${
|
|
1296
|
+
${z.bMedium.regular}
|
|
1335
1297
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1336
1298
|
}
|
|
1337
1299
|
}
|
|
@@ -1352,12 +1314,12 @@ position: relative;
|
|
|
1352
1314
|
}
|
|
1353
1315
|
}
|
|
1354
1316
|
}
|
|
1355
|
-
`,
|
|
1356
|
-
let e = P(), t = P((e) => e.paused), n = P((e) => e.currentTime), r = P((e) => e.duration), i = P((e) => e.fullscreen),
|
|
1357
|
-
let r =
|
|
1358
|
-
e.setVolume(
|
|
1317
|
+
`, Oe = () => {
|
|
1318
|
+
let e = P(), t = P((e) => e.paused), n = P((e) => e.currentTime), r = P((e) => e.duration), i = P((e) => e.fullscreen), a = P((e) => e.hideUI), o = P((e) => e.togglePictureInPicture), [s, u] = f(null), d = r > 0 && n === r, p = c(({ direction: t, stepSize: n }) => {
|
|
1319
|
+
let r = W(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1320
|
+
e.setVolume(U(a)), o && !e.muted && e.toggleMuted();
|
|
1359
1321
|
}, [e]);
|
|
1360
|
-
|
|
1322
|
+
l(() => {
|
|
1361
1323
|
let t = (t) => {
|
|
1362
1324
|
let n = t.target;
|
|
1363
1325
|
if (n?.isContentEditable || /^(input|textarea|select)$/i.test(n?.tagName ?? "")) return;
|
|
@@ -1382,7 +1344,7 @@ position: relative;
|
|
|
1382
1344
|
};
|
|
1383
1345
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1384
1346
|
}, [e, p]);
|
|
1385
|
-
let m =
|
|
1347
|
+
let m = c((e) => {
|
|
1386
1348
|
e.preventDefault(), e.deltaY < 0 ? p({
|
|
1387
1349
|
direction: "up",
|
|
1388
1350
|
stepSize: X
|
|
@@ -1391,66 +1353,77 @@ position: relative;
|
|
|
1391
1353
|
stepSize: X
|
|
1392
1354
|
});
|
|
1393
1355
|
}, [p]);
|
|
1394
|
-
return
|
|
1395
|
-
if (
|
|
1396
|
-
}, [
|
|
1397
|
-
css:
|
|
1398
|
-
style: { ...
|
|
1356
|
+
return l(() => {
|
|
1357
|
+
if (s) return s.addEventListener("wheel", m, { passive: !1 }), () => s.removeEventListener("wheel", m);
|
|
1358
|
+
}, [s, m]), /* @__PURE__ */ S("div", {
|
|
1359
|
+
css: De,
|
|
1360
|
+
style: { ...a ? {
|
|
1399
1361
|
opacity: "0",
|
|
1400
1362
|
pointerEvents: "none"
|
|
1401
1363
|
} : {} },
|
|
1402
|
-
children: [/* @__PURE__ */
|
|
1364
|
+
children: [/* @__PURE__ */ x(J, {}), /* @__PURE__ */ S("div", {
|
|
1403
1365
|
className: "actions",
|
|
1404
|
-
children: [/* @__PURE__ */
|
|
1366
|
+
children: [/* @__PURE__ */ S("div", {
|
|
1405
1367
|
className: "left",
|
|
1406
1368
|
children: [
|
|
1407
|
-
/* @__PURE__ */
|
|
1369
|
+
/* @__PURE__ */ x(K, {
|
|
1408
1370
|
id: "play",
|
|
1409
1371
|
tooltipPlace: "top-start",
|
|
1410
|
-
text: /* @__PURE__ */
|
|
1372
|
+
text: /* @__PURE__ */ x("button", {
|
|
1411
1373
|
className: "play",
|
|
1412
1374
|
type: "button",
|
|
1413
1375
|
onClick: () => e.togglePaused(),
|
|
1414
|
-
children:
|
|
1376
|
+
children: x(d ? k : t ? O : D, {})
|
|
1415
1377
|
}),
|
|
1416
|
-
toolTipText: /* @__PURE__ */
|
|
1378
|
+
toolTipText: /* @__PURE__ */ x("span", { children: d ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1417
1379
|
}),
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ x(Ee, { ref: u }),
|
|
1381
|
+
/* @__PURE__ */ x("div", {
|
|
1420
1382
|
className: "time",
|
|
1421
|
-
children:
|
|
1383
|
+
children: me(n, r)
|
|
1422
1384
|
})
|
|
1423
1385
|
]
|
|
1424
|
-
}), /* @__PURE__ */
|
|
1386
|
+
}), /* @__PURE__ */ S("div", {
|
|
1425
1387
|
className: "right",
|
|
1426
1388
|
children: [
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
|
|
1389
|
+
/* @__PURE__ */ x(xe, {}),
|
|
1390
|
+
o ? /* @__PURE__ */ x(K, {
|
|
1429
1391
|
id: "picture-in-picture",
|
|
1430
|
-
text: /* @__PURE__ */
|
|
1392
|
+
text: /* @__PURE__ */ x("button", {
|
|
1431
1393
|
className: "picture-in-picture",
|
|
1432
1394
|
type: "button",
|
|
1433
|
-
onClick:
|
|
1434
|
-
children: /* @__PURE__ */
|
|
1395
|
+
onClick: o,
|
|
1396
|
+
children: /* @__PURE__ */ x("img", { src: _e })
|
|
1435
1397
|
}),
|
|
1436
|
-
toolTipText: /* @__PURE__ */
|
|
1398
|
+
toolTipText: /* @__PURE__ */ x("span", { children: "Picture in picture" })
|
|
1437
1399
|
}) : null,
|
|
1438
|
-
/* @__PURE__ */
|
|
1400
|
+
/* @__PURE__ */ x(K, {
|
|
1439
1401
|
id: "full-screen",
|
|
1440
1402
|
tooltipPlace: "top-end",
|
|
1441
|
-
text: /* @__PURE__ */
|
|
1403
|
+
text: /* @__PURE__ */ x("button", {
|
|
1442
1404
|
className: "full-screen",
|
|
1443
1405
|
type: "button",
|
|
1444
1406
|
onClick: () => e.toggleFullscreen(),
|
|
1445
|
-
children:
|
|
1407
|
+
children: x(i ? E : T, {})
|
|
1446
1408
|
}),
|
|
1447
|
-
toolTipText: /* @__PURE__ */
|
|
1409
|
+
toolTipText: /* @__PURE__ */ x("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
|
|
1448
1410
|
})
|
|
1449
1411
|
]
|
|
1450
1412
|
})]
|
|
1451
1413
|
})]
|
|
1452
1414
|
});
|
|
1453
|
-
},
|
|
1415
|
+
}, ke = 3e3, Ae = p`
|
|
1416
|
+
position: absolute;
|
|
1417
|
+
inset: 0;
|
|
1418
|
+
z-index: 2;
|
|
1419
|
+
/* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
|
|
1420
|
+
pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
|
|
1421
|
+
pointer-events: none;
|
|
1422
|
+
/* visibility, not only opacity: an item that took pointer events back would otherwise stay
|
|
1423
|
+
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1424
|
+
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1425
|
+
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1426
|
+
`, je = p`
|
|
1454
1427
|
position: relative;
|
|
1455
1428
|
background-color: black;
|
|
1456
1429
|
display: flex;
|
|
@@ -1482,74 +1455,86 @@ position: relative;
|
|
|
1482
1455
|
&.hide {
|
|
1483
1456
|
cursor: none;
|
|
1484
1457
|
}
|
|
1485
|
-
`,
|
|
1486
|
-
let
|
|
1487
|
-
|
|
1458
|
+
`, Q = (e, t = "") => a.toArray(e).flatMap((e, n) => {
|
|
1459
|
+
let r = `${t}${s(e) && e.key != null ? e.key : n}`;
|
|
1460
|
+
return s(e) && e.type === o ? Q(e.props.children, `${r}/`) : [{
|
|
1461
|
+
key: r,
|
|
1462
|
+
item: e
|
|
1463
|
+
}];
|
|
1464
|
+
}), Me = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, children: i }) => {
|
|
1465
|
+
let a = P(), o = P((e) => e.hideUI), s = P((e) => e.setHideUI), c = d(void 0), u = d("mouse");
|
|
1466
|
+
l(() => () => clearTimeout(c.current), []);
|
|
1488
1467
|
let f = () => {
|
|
1489
|
-
|
|
1468
|
+
s(!1), clearTimeout(c.current), c.current = setTimeout(() => s(!0), ke);
|
|
1490
1469
|
};
|
|
1491
|
-
return /* @__PURE__ */
|
|
1492
|
-
css:
|
|
1470
|
+
return /* @__PURE__ */ S("div", {
|
|
1471
|
+
css: je,
|
|
1493
1472
|
ref: e,
|
|
1494
1473
|
onPointerMove: (e) => {
|
|
1495
|
-
|
|
1474
|
+
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
1496
1475
|
},
|
|
1497
1476
|
onPointerDown: (e) => {
|
|
1498
|
-
|
|
1477
|
+
u.current = e.pointerType;
|
|
1499
1478
|
},
|
|
1500
1479
|
onMouseOut: (e) => {
|
|
1501
1480
|
let t = e.relatedTarget;
|
|
1502
1481
|
if (t && e.currentTarget.contains(t)) return;
|
|
1503
1482
|
let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
|
|
1504
|
-
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(
|
|
1483
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(c.current), s(!0));
|
|
1505
1484
|
},
|
|
1506
|
-
className:
|
|
1485
|
+
className: o ? "hide" : "",
|
|
1507
1486
|
children: [
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1487
|
+
/* @__PURE__ */ x(B, { onCanvasRef: n }),
|
|
1488
|
+
Q(r).map(({ key: e, item: t }) => /* @__PURE__ */ x("div", {
|
|
1489
|
+
css: Ae,
|
|
1490
|
+
style: { ...o ? {
|
|
1491
|
+
opacity: "0",
|
|
1492
|
+
visibility: "hidden",
|
|
1493
|
+
pointerEvents: "none"
|
|
1494
|
+
} : {} },
|
|
1495
|
+
children: t
|
|
1496
|
+
}, e)),
|
|
1497
|
+
/* @__PURE__ */ x(Oe, {}),
|
|
1498
|
+
/* @__PURE__ */ S("div", {
|
|
1514
1499
|
className: "video",
|
|
1515
1500
|
onClick: () => {
|
|
1516
|
-
if (
|
|
1501
|
+
if (u.current === "mouse") {
|
|
1517
1502
|
a.togglePaused();
|
|
1518
1503
|
return;
|
|
1519
1504
|
}
|
|
1520
|
-
|
|
1505
|
+
o ? f() : (clearTimeout(c.current), s(!0));
|
|
1521
1506
|
},
|
|
1522
|
-
children: [t ? /* @__PURE__ */
|
|
1507
|
+
children: [t ? /* @__PURE__ */ x("video", {
|
|
1523
1508
|
ref: t,
|
|
1524
1509
|
playsInline: !0
|
|
1525
1510
|
}) : null, i]
|
|
1526
1511
|
})
|
|
1527
1512
|
]
|
|
1528
1513
|
});
|
|
1529
|
-
},
|
|
1530
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges:
|
|
1531
|
-
|
|
1532
|
-
let w =
|
|
1533
|
-
publicPath:
|
|
1534
|
-
workerUrl:
|
|
1535
|
-
length:
|
|
1536
|
-
read:
|
|
1537
|
-
downloadedRanges:
|
|
1538
|
-
}), T = n?.thumbnails?.all ?? w, E =
|
|
1539
|
-
|
|
1514
|
+
}, Ne = ({ options: e, children: t }) => {
|
|
1515
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: u, thumbnailRead: d, thumbnailsEnabled: p } = r ?? {}, m = _(), h = g(), [v, y] = f(null), [b, S] = f(null), C = n?.media ?? v;
|
|
1516
|
+
l(() => (m?.(C), () => m?.(null)), [C, m]), oe(v, b, r);
|
|
1517
|
+
let w = L({
|
|
1518
|
+
publicPath: s,
|
|
1519
|
+
workerUrl: c,
|
|
1520
|
+
length: p === !1 ? void 0 : a,
|
|
1521
|
+
read: d ?? u,
|
|
1522
|
+
downloadedRanges: o
|
|
1523
|
+
}), T = n?.thumbnails?.all ?? w, E = R(v, b), D = P((e) => e.setSourceState);
|
|
1524
|
+
l(() => {
|
|
1540
1525
|
D({
|
|
1541
1526
|
title: i,
|
|
1542
1527
|
size: a,
|
|
1543
|
-
downloadedRanges:
|
|
1528
|
+
downloadedRanges: o
|
|
1544
1529
|
});
|
|
1545
1530
|
}, [
|
|
1546
1531
|
D,
|
|
1547
1532
|
i,
|
|
1548
1533
|
a,
|
|
1549
|
-
|
|
1534
|
+
o
|
|
1550
1535
|
]);
|
|
1551
1536
|
let O = n?.thumbnails?.at;
|
|
1552
|
-
|
|
1537
|
+
l(() => {
|
|
1553
1538
|
D({
|
|
1554
1539
|
thumbnails: T,
|
|
1555
1540
|
thumbnailAt: O,
|
|
@@ -1562,7 +1547,7 @@ position: relative;
|
|
|
1562
1547
|
E
|
|
1563
1548
|
]);
|
|
1564
1549
|
let k = n?.subtitles?.selection, A = n?.audioTracks?.selection;
|
|
1565
|
-
return
|
|
1550
|
+
return l(() => {
|
|
1566
1551
|
k && D({
|
|
1567
1552
|
subtitleTracks: k.options.map(({ id: e, label: t }) => ({
|
|
1568
1553
|
id: e,
|
|
@@ -1571,7 +1556,7 @@ position: relative;
|
|
|
1571
1556
|
selectedSubtitleTrack: k.selectedId ?? void 0,
|
|
1572
1557
|
selectSubtitleTrack: (e) => k.select(e == null ? null : String(e))
|
|
1573
1558
|
});
|
|
1574
|
-
}, [D, k]),
|
|
1559
|
+
}, [D, k]), l(() => {
|
|
1575
1560
|
A && D({
|
|
1576
1561
|
audioTracks: A.options.map(({ id: e, label: t }) => ({
|
|
1577
1562
|
id: e,
|
|
@@ -1580,14 +1565,14 @@ position: relative;
|
|
|
1580
1565
|
selectedAudioTrack: A.selectedId ?? void 0,
|
|
1581
1566
|
selectAudioTrack: (e) => A.select(String(e))
|
|
1582
1567
|
});
|
|
1583
|
-
}, [D, A]), /* @__PURE__ */
|
|
1584
|
-
ref:
|
|
1585
|
-
onVideoRef: n ? void 0 :
|
|
1568
|
+
}, [D, A]), /* @__PURE__ */ x(Me, {
|
|
1569
|
+
ref: h,
|
|
1570
|
+
onVideoRef: n ? void 0 : y,
|
|
1586
1571
|
onCanvasRef: S,
|
|
1587
1572
|
overlay: e.overlay,
|
|
1588
1573
|
children: t
|
|
1589
1574
|
});
|
|
1590
|
-
},
|
|
1575
|
+
}, Pe = p`
|
|
1591
1576
|
/**
|
|
1592
1577
|
* The chrome's whole scale, in one place.
|
|
1593
1578
|
*
|
|
@@ -1618,17 +1603,17 @@ position: relative;
|
|
|
1618
1603
|
height: 100%;
|
|
1619
1604
|
width: 100%;
|
|
1620
1605
|
overflow: hidden;
|
|
1621
|
-
`, $ = (e) => /* @__PURE__ */
|
|
1622
|
-
css:
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1606
|
+
`, $ = (e) => /* @__PURE__ */ x("div", {
|
|
1607
|
+
css: Pe,
|
|
1608
|
+
children: /* @__PURE__ */ x(N.Provider, { children: /* @__PURE__ */ x(Ne, {
|
|
1624
1609
|
options: e,
|
|
1625
1610
|
children: e.children
|
|
1626
1611
|
}) })
|
|
1627
|
-
}),
|
|
1612
|
+
}), Fe = (e) => !!e && typeof e == "object" && "at" in e, Ie = (e) => !!e && typeof e == "object" && "selection" in e, Le = ({ blob: e, name: t }) => ({
|
|
1628
1613
|
length: e.size,
|
|
1629
1614
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
1630
1615
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
1631
|
-
}),
|
|
1616
|
+
}), Re = async (e, t) => {
|
|
1632
1617
|
let n = await fetch(e, {
|
|
1633
1618
|
headers: { Range: "bytes=0-1" },
|
|
1634
1619
|
credentials: t
|
|
@@ -1638,8 +1623,8 @@ position: relative;
|
|
|
1638
1623
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
1639
1624
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
1640
1625
|
return i;
|
|
1641
|
-
},
|
|
1642
|
-
let i = t ?? await
|
|
1626
|
+
}, ze = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
1627
|
+
let i = t ?? await Re(e, r);
|
|
1643
1628
|
return {
|
|
1644
1629
|
length: i,
|
|
1645
1630
|
name: n,
|
|
@@ -1652,9 +1637,9 @@ position: relative;
|
|
|
1652
1637
|
return a.arrayBuffer();
|
|
1653
1638
|
}
|
|
1654
1639
|
};
|
|
1655
|
-
},
|
|
1656
|
-
if ("blob" in e) return
|
|
1657
|
-
if ("url" in e) return
|
|
1640
|
+
}, Be = async (e) => {
|
|
1641
|
+
if ("blob" in e) return Le(e);
|
|
1642
|
+
if ("url" in e) return ze(e);
|
|
1658
1643
|
if ("read" in e) return {
|
|
1659
1644
|
length: e.length,
|
|
1660
1645
|
name: e.name,
|
|
@@ -1663,4 +1648,4 @@ position: relative;
|
|
|
1663
1648
|
throw Error(`Unknown source type: ${e}`);
|
|
1664
1649
|
};
|
|
1665
1650
|
//#endregion
|
|
1666
|
-
export { $ as MediaPlayer, $ as default, N as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator,
|
|
1651
|
+
export { $ as MediaPlayer, $ as default, N as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, Be as inputToRemuxerInput, Ie as isDelegatedTracks, Fe as isExternalThumbnails, M as sourceFeature, e as startPlayback, R as usePictureInPicture, P as usePlayer, L as useSeekThumbnails };
|