@banou/media-player 0.8.2 → 0.8.4
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 +430 -393
- package/dist/react/components/chrome.d.ts +4 -2
- package/dist/react/components/overlay.d.ts +2 -6
- package/dist/react/player.d.ts +3 -2
- package/dist/react/source-feature.d.ts +33 -4
- package/dist/react/video-player.d.ts +49 -7
- package/package.json +1 -1
- package/src/lib/react/components/chrome.tsx +60 -5
- package/src/lib/react/components/overlay.tsx +22 -67
- package/src/lib/react/components/settings.tsx +117 -39
- package/src/lib/react/source-feature.ts +20 -2
- package/src/lib/react/video-player.tsx +57 -9
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 M, VolumeX as ee } from "react-feather";
|
|
8
|
+
import { Tooltip as te } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var ne = {
|
|
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
|
-
},
|
|
25
|
+
}, N = v({
|
|
26
26
|
name: "source",
|
|
27
|
-
state: () => ({ ...
|
|
27
|
+
state: () => ({ ...ne }),
|
|
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
|
-
}),
|
|
35
|
-
features: [...
|
|
34
|
+
}), P = h({
|
|
35
|
+
features: [...y, N],
|
|
36
36
|
displayName: "MediaPlayer"
|
|
37
|
-
}),
|
|
37
|
+
}), F = P.usePlayer, re = (e) => {
|
|
38
38
|
if (!(!e || e === "und")) try {
|
|
39
39
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
40
40
|
type: "language",
|
|
@@ -43,35 +43,35 @@ var ee = {
|
|
|
43
43
|
} catch {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
},
|
|
47
|
-
let t = e.map((e) =>
|
|
46
|
+
}, I = (e) => e?.replace(/_/g, " ").trim() || void 0, L = (e) => {
|
|
47
|
+
let t = e.map((e) => re(e.language) ?? I(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
48
48
|
...e,
|
|
49
49
|
[t]: (e[t] ?? 0) + 1
|
|
50
50
|
}), {});
|
|
51
51
|
return e.map((e, r) => {
|
|
52
|
-
let i = t[r], a =
|
|
52
|
+
let i = t[r], a = I(e.title);
|
|
53
53
|
return {
|
|
54
54
|
track: e,
|
|
55
55
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
|
-
},
|
|
58
|
+
}, R = (e) => L(e).map(({ track: e, label: t }) => ({
|
|
59
59
|
id: e.streamIndex,
|
|
60
60
|
label: t
|
|
61
|
-
})),
|
|
62
|
-
let i =
|
|
63
|
-
w.current =
|
|
64
|
-
let T =
|
|
61
|
+
})), ie = (t, n, r) => {
|
|
62
|
+
let i = F(), { 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
|
-
}, [i]), k =
|
|
74
|
-
|
|
73
|
+
}, [i]), k = F((e) => e.setSourceState);
|
|
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,33 +108,33 @@ 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
|
},
|
|
115
115
|
onSeek: (e) => T.current?.(e),
|
|
116
116
|
onSubtitleStreams: (e) => {
|
|
117
117
|
r || i.setSourceState({
|
|
118
|
-
subtitleTracks:
|
|
118
|
+
subtitleTracks: R(e),
|
|
119
119
|
...C.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
120
120
|
});
|
|
121
121
|
},
|
|
122
122
|
onAudioStreams: (e, t) => {
|
|
123
123
|
r || i.setSourceState({
|
|
124
|
-
audioTracks:
|
|
124
|
+
audioTracks: R(e),
|
|
125
125
|
selectedAudioTrack: t
|
|
126
126
|
});
|
|
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
|
+
}, ae = 5e3, oe = 6e4, z = ({ 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 = ae, 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, oe));
|
|
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]),
|
|
189
|
+
]), l(() => {
|
|
190
|
+
c.current?.update(m);
|
|
191
|
+
}, [m]), o;
|
|
192
192
|
}, B = (e, t) => {
|
|
193
|
-
let n =
|
|
194
|
-
|
|
193
|
+
let n = F(), r = d(null);
|
|
194
|
+
l(() => {
|
|
195
195
|
if (!e || !t) return;
|
|
196
196
|
let a = i({
|
|
197
197
|
video: e,
|
|
@@ -206,12 +206,12 @@ 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 ?
|
|
214
|
+
return e && t ? a : null;
|
|
215
215
|
}, V = {
|
|
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 ",
|
|
@@ -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
|
+
}, se = 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
|
+
`, ce = 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
|
+
${V.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
|
+
`, le = p`
|
|
311
279
|
position: absolute;
|
|
312
280
|
inset: 0;
|
|
313
281
|
z-index: 2;
|
|
@@ -323,11 +291,11 @@ 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
|
+
`, ue = p`
|
|
331
299
|
position: absolute;
|
|
332
300
|
inset: auto 0 20%;
|
|
333
301
|
z-index: 3;
|
|
@@ -337,39 +305,33 @@ var ee = {
|
|
|
337
305
|
${V.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
|
+
`, de = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", fe = ({ onCanvasRef: e }) => {
|
|
309
|
+
let t = F((e) => e.title), n = F((e) => e.hideUI), r = F((e) => e.playbackError), i = F((e) => e.ready), a = F((e) => e.size), o = F((e) => e.waiting);
|
|
310
|
+
return /* @__PURE__ */ S(b, { children: [
|
|
311
|
+
t ? /* @__PURE__ */ x("div", {
|
|
312
|
+
className: "title",
|
|
313
|
+
css: ce,
|
|
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: le }) : void 0,
|
|
321
|
+
r ? /* @__PURE__ */ x("div", {
|
|
322
|
+
css: ue,
|
|
323
|
+
children: de(r)
|
|
362
324
|
}) : void 0,
|
|
363
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ x("canvas", {
|
|
364
326
|
ref: e,
|
|
365
|
-
css:
|
|
327
|
+
css: se
|
|
366
328
|
})
|
|
367
329
|
] });
|
|
368
330
|
}, H = 1e-4, U = 1, W = (e) => Math.max(H, Math.min(U, e)) ** 2, G = (e) => Math.max(H, Math.min(U, e)) ** (U / 2), K = (e) => {
|
|
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
|
+
}, pe = (e, t) => `${K(e)} / ${K(t)}`, me = (e) => p`
|
|
373
335
|
display: flex;
|
|
374
336
|
justify-content: flex-end;
|
|
375
337
|
|
|
@@ -382,16 +344,16 @@ var ee = {
|
|
|
382
344
|
${V.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
|
-
`, q = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */
|
|
356
|
+
`, q = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ 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(te, {
|
|
365
|
+
css: me(c),
|
|
404
366
|
id: e,
|
|
405
367
|
noArrow: !0,
|
|
406
368
|
children: t
|
|
407
369
|
})] }), J = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
408
|
-
let [i,
|
|
409
|
-
|
|
410
|
-
let
|
|
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
|
+
}, he = p`
|
|
435
397
|
position: relative;
|
|
436
398
|
height: calc(.4 * var(--mp-unit));
|
|
437
399
|
|
|
@@ -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 =
|
|
593
|
-
ref:
|
|
553
|
+
`, ge = () => {
|
|
554
|
+
let e = F(), t = F((e) => e.currentTime), n = F((e) => e.duration), r = F((e) => e.size), i = F((e) => e.downloadedRanges), a = F((e) => e.indexes), o = F((e) => e.thumbnails), s = F((e) => e.thumbnailAt), c = d(null), [p, m] = f(void 0), [h, g] = f(void 0), _ = d(void 0), { dragging: v, handlers: y } = J({
|
|
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: he,
|
|
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 =
|
|
706
|
+
`, ye = () => {
|
|
707
|
+
let e = F(), t = F((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 } = J({
|
|
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 {
|
|
@@ -924,138 +886,186 @@ position: relative;
|
|
|
924
886
|
.description {
|
|
925
887
|
word-break: break-word;
|
|
926
888
|
}
|
|
889
|
+
|
|
890
|
+
/* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
|
|
891
|
+
saying the track exists, and dropping the row would read as the source having nothing. */
|
|
892
|
+
.unavailable {
|
|
893
|
+
opacity: 0.5;
|
|
894
|
+
cursor: default;
|
|
895
|
+
:hover {
|
|
896
|
+
background-color: transparent;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.failed {
|
|
901
|
+
border-bottom: 1px solid #4D4D4E;
|
|
902
|
+
color: #f66;
|
|
903
|
+
${V.bSmall.regular}
|
|
904
|
+
}
|
|
927
905
|
}
|
|
928
|
-
`, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
children: [/* @__PURE__ */ v("span", { children: "Disable" }), /* @__PURE__ */ v("span", { children: n === void 0 ? "✓" : "" })]
|
|
939
|
-
}) : null,
|
|
940
|
-
t.map(({ id: e, label: t }) => /* @__PURE__ */ y("div", {
|
|
941
|
-
onClick: () => r(e),
|
|
942
|
-
className: "description",
|
|
943
|
-
children: [/* @__PURE__ */ v("span", { children: t }), /* @__PURE__ */ v("span", { children: n === e ? "✓" : "" })]
|
|
944
|
-
}, e))
|
|
945
|
-
]
|
|
946
|
-
}), ve = () => {
|
|
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), s = P((e) => e.selectedAudioTrack), u = P((e) => e.selectAudioTrack), [d, f] = l(!1), [p, m] = l(0), h = c(null), g = () => {
|
|
948
|
-
f(!d), m(0);
|
|
949
|
-
}, _ = (t) => {
|
|
950
|
-
e.setPlaybackRate(t), m(0);
|
|
906
|
+
`, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
907
|
+
let c = o !== void 0, l = (e, i, a) => {
|
|
908
|
+
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
909
|
+
return /* @__PURE__ */ S("div", {
|
|
910
|
+
onClick: () => {
|
|
911
|
+
l || r(e ?? void 0);
|
|
912
|
+
},
|
|
913
|
+
className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
914
|
+
children: [/* @__PURE__ */ x("span", { children: i }), /* @__PURE__ */ x("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
915
|
+
}, e ?? "__off__");
|
|
951
916
|
};
|
|
952
|
-
|
|
917
|
+
return /* @__PURE__ */ S("div", {
|
|
918
|
+
className: "popover track-list",
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ S("div", {
|
|
921
|
+
className: "back",
|
|
922
|
+
onClick: i,
|
|
923
|
+
children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: e })]
|
|
924
|
+
}),
|
|
925
|
+
s ? /* @__PURE__ */ x("div", {
|
|
926
|
+
className: "no-hover failed",
|
|
927
|
+
children: "Could not switch. Try again."
|
|
928
|
+
}) : null,
|
|
929
|
+
a ? l(null, a) : null,
|
|
930
|
+
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
931
|
+
]
|
|
932
|
+
});
|
|
933
|
+
}, xe = () => {
|
|
934
|
+
let e = F(), t = F((e) => e.playbackRate), n = F((e) => e.subtitleTracks), r = F((e) => e.selectedSubtitleTrack), i = F((e) => e.selectSubtitleTrack), a = F((e) => e.audioTracks), o = F((e) => e.selectedAudioTrack), s = F((e) => e.selectAudioTrack), c = F((e) => e.subtitleOffLabel), [u, p] = f(!1), [m, h] = f(0), g = d(null), [_, v] = f(void 0), [y, b] = f(!1), T = () => {
|
|
935
|
+
p(!u), h(0), b(!1);
|
|
936
|
+
}, E = () => {
|
|
937
|
+
p(!1), h(0);
|
|
938
|
+
}, D = (t) => {
|
|
939
|
+
e.setPlaybackRate(t), h(0);
|
|
940
|
+
};
|
|
941
|
+
l(() => {
|
|
953
942
|
let e = (e) => {
|
|
954
|
-
|
|
943
|
+
u && g.current && !g.current.contains(e.target) && T();
|
|
955
944
|
};
|
|
956
945
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
957
|
-
}, [
|
|
958
|
-
let
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
946
|
+
}, [u]);
|
|
947
|
+
let O = (e, t) => {
|
|
948
|
+
if (_ !== void 0) return;
|
|
949
|
+
b(!1);
|
|
950
|
+
let n;
|
|
951
|
+
try {
|
|
952
|
+
n = t();
|
|
953
|
+
} catch (e) {
|
|
954
|
+
console.warn("[media-player] track selection failed:", e), b(!0);
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
if (!(n instanceof Promise)) {
|
|
958
|
+
E();
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
v(e), n.then(() => {
|
|
962
|
+
v(void 0), E();
|
|
963
|
+
}, (e) => {
|
|
964
|
+
console.warn("[media-player] track selection failed:", e), v(void 0), b(!0);
|
|
965
|
+
});
|
|
966
|
+
}, k = (e) => O(e ?? null, () => i(e)), j = (e) => {
|
|
967
|
+
e !== void 0 && O(e, () => s(e));
|
|
968
|
+
}, M = (e) => () => {
|
|
969
|
+
h(e);
|
|
964
970
|
};
|
|
965
|
-
return /* @__PURE__ */
|
|
966
|
-
css:
|
|
967
|
-
ref:
|
|
971
|
+
return /* @__PURE__ */ S("div", {
|
|
972
|
+
css: be,
|
|
973
|
+
ref: g,
|
|
968
974
|
children: [
|
|
969
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ x(q, {
|
|
970
976
|
id: "settings",
|
|
971
|
-
disabled:
|
|
972
|
-
text: /* @__PURE__ */
|
|
977
|
+
disabled: u,
|
|
978
|
+
text: /* @__PURE__ */ x("button", {
|
|
973
979
|
className: "settings",
|
|
974
980
|
type: "button",
|
|
975
|
-
onClick:
|
|
976
|
-
children: /* @__PURE__ */
|
|
981
|
+
onClick: T,
|
|
982
|
+
children: /* @__PURE__ */ x(A, {})
|
|
977
983
|
}),
|
|
978
|
-
toolTipText: /* @__PURE__ */
|
|
984
|
+
toolTipText: /* @__PURE__ */ x("span", { children: "Settings" })
|
|
979
985
|
}),
|
|
980
|
-
|
|
986
|
+
u && m === 0 && /* @__PURE__ */ S("div", {
|
|
981
987
|
className: "popover menu",
|
|
982
988
|
children: [
|
|
983
|
-
a.length > 1 ? /* @__PURE__ */
|
|
984
|
-
onClick:
|
|
985
|
-
children: [/* @__PURE__ */
|
|
989
|
+
a.length > 1 ? /* @__PURE__ */ S("div", {
|
|
990
|
+
onClick: M(3),
|
|
991
|
+
children: [/* @__PURE__ */ x("div", { children: "Audio" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
|
|
986
992
|
}) : null,
|
|
987
|
-
n.length > 0 ? /* @__PURE__ */
|
|
988
|
-
onClick:
|
|
989
|
-
children: [/* @__PURE__ */
|
|
993
|
+
n.length > 0 ? /* @__PURE__ */ S("div", {
|
|
994
|
+
onClick: M(2),
|
|
995
|
+
children: [/* @__PURE__ */ x("div", { children: "Subtitles" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
|
|
990
996
|
}) : null,
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
onClick:
|
|
993
|
-
children: [/* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ S("div", {
|
|
998
|
+
onClick: M(1),
|
|
999
|
+
children: [/* @__PURE__ */ x("div", { children: "Playback speed" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
|
|
994
1000
|
className: "secondary",
|
|
995
1001
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
996
|
-
}), /* @__PURE__ */
|
|
1002
|
+
}), /* @__PURE__ */ x(w, {})] })]
|
|
997
1003
|
})
|
|
998
1004
|
]
|
|
999
1005
|
}),
|
|
1000
|
-
|
|
1006
|
+
u && m === 1 && /* @__PURE__ */ S("div", {
|
|
1001
1007
|
className: "popover playback-rate",
|
|
1002
1008
|
children: [
|
|
1003
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ S("div", {
|
|
1004
1010
|
className: "back",
|
|
1005
|
-
onClick:
|
|
1006
|
-
children: [/* @__PURE__ */
|
|
1011
|
+
onClick: M(0),
|
|
1012
|
+
children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: "Playback speed" })]
|
|
1007
1013
|
}),
|
|
1008
|
-
/* @__PURE__ */
|
|
1014
|
+
/* @__PURE__ */ x("div", {
|
|
1009
1015
|
className: "slider no-hover",
|
|
1010
|
-
children: /* @__PURE__ */
|
|
1016
|
+
children: /* @__PURE__ */ x(ye, {})
|
|
1011
1017
|
}),
|
|
1012
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ S("div", {
|
|
1013
1019
|
className: "options no-hover",
|
|
1014
1020
|
children: [
|
|
1015
|
-
/* @__PURE__ */
|
|
1016
|
-
onClick: () =>
|
|
1021
|
+
/* @__PURE__ */ x("div", {
|
|
1022
|
+
onClick: () => D(.5),
|
|
1017
1023
|
children: "0.5x"
|
|
1018
1024
|
}),
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
onClick: () =>
|
|
1025
|
+
/* @__PURE__ */ x("div", {
|
|
1026
|
+
onClick: () => D(1),
|
|
1021
1027
|
children: "1x"
|
|
1022
1028
|
}),
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
onClick: () =>
|
|
1029
|
+
/* @__PURE__ */ x("div", {
|
|
1030
|
+
onClick: () => D(1.5),
|
|
1025
1031
|
children: "1.5x"
|
|
1026
1032
|
}),
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
onClick: () =>
|
|
1033
|
+
/* @__PURE__ */ x("div", {
|
|
1034
|
+
onClick: () => D(2),
|
|
1029
1035
|
children: "2x"
|
|
1030
1036
|
})
|
|
1031
1037
|
]
|
|
1032
1038
|
})
|
|
1033
1039
|
]
|
|
1034
1040
|
}),
|
|
1035
|
-
|
|
1041
|
+
u && m === 2 && /* @__PURE__ */ x(Y, {
|
|
1036
1042
|
title: "Subtitles",
|
|
1037
1043
|
tracks: n,
|
|
1038
1044
|
selected: r,
|
|
1039
|
-
onSelect:
|
|
1040
|
-
onBack:
|
|
1041
|
-
|
|
1045
|
+
onSelect: k,
|
|
1046
|
+
onBack: M(0),
|
|
1047
|
+
offLabel: c ?? "Disable",
|
|
1048
|
+
pending: _,
|
|
1049
|
+
failed: y
|
|
1042
1050
|
}),
|
|
1043
|
-
|
|
1051
|
+
u && m === 3 && /* @__PURE__ */ x(Y, {
|
|
1044
1052
|
title: "Audio",
|
|
1045
1053
|
tracks: a,
|
|
1046
|
-
selected:
|
|
1047
|
-
onSelect:
|
|
1048
|
-
onBack:
|
|
1054
|
+
selected: o,
|
|
1055
|
+
onSelect: j,
|
|
1056
|
+
onBack: M(0),
|
|
1057
|
+
pending: _,
|
|
1058
|
+
failed: y
|
|
1049
1059
|
})
|
|
1050
1060
|
]
|
|
1051
1061
|
});
|
|
1052
|
-
},
|
|
1062
|
+
}, Se = {
|
|
1053
1063
|
primary: "#EAEBEE",
|
|
1054
1064
|
secondary: "#D0D0D9",
|
|
1055
1065
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1056
1066
|
borderPrimary: "#384F70",
|
|
1057
1067
|
backgroundTooltip: "#222222"
|
|
1058
|
-
},
|
|
1068
|
+
}, Ce = p`
|
|
1059
1069
|
display: flex;
|
|
1060
1070
|
align-items: center;
|
|
1061
1071
|
|
|
@@ -1098,46 +1108,46 @@ position: relative;
|
|
|
1098
1108
|
width: 10px;
|
|
1099
1109
|
height: 10px;
|
|
1100
1110
|
}
|
|
1101
|
-
`,
|
|
1102
|
-
let n =
|
|
1111
|
+
`, we = ({ value: e, onChange: t }) => {
|
|
1112
|
+
let n = F((e) => e.volume), r = F((e) => e.muted), i = d(null), a = d(null), { handlers: o } = J({
|
|
1103
1113
|
ref: a,
|
|
1104
1114
|
onChange: t
|
|
1105
|
-
}),
|
|
1115
|
+
}), s = (n) => {
|
|
1106
1116
|
n.preventDefault();
|
|
1107
1117
|
let r = .05, i = e;
|
|
1108
1118
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
1109
1119
|
};
|
|
1110
|
-
|
|
1120
|
+
l(() => {
|
|
1111
1121
|
let e = i.current;
|
|
1112
|
-
return e && e.addEventListener("wheel",
|
|
1113
|
-
e && e.removeEventListener("wheel",
|
|
1122
|
+
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
1123
|
+
e && e.removeEventListener("wheel", s);
|
|
1114
1124
|
};
|
|
1115
1125
|
}, [e]);
|
|
1116
|
-
let
|
|
1117
|
-
return /* @__PURE__ */
|
|
1126
|
+
let c = e * 100, f = u(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
|
|
1127
|
+
return /* @__PURE__ */ x(q, {
|
|
1118
1128
|
id: "volume-slider",
|
|
1119
|
-
text: /* @__PURE__ */
|
|
1129
|
+
text: /* @__PURE__ */ x("div", {
|
|
1120
1130
|
ref: i,
|
|
1121
|
-
css:
|
|
1122
|
-
...
|
|
1123
|
-
children: /* @__PURE__ */
|
|
1131
|
+
css: Ce,
|
|
1132
|
+
...o,
|
|
1133
|
+
children: /* @__PURE__ */ x("div", {
|
|
1124
1134
|
ref: a,
|
|
1125
1135
|
style: { background: `linear-gradient(to right,
|
|
1126
|
-
#fff 0% ${
|
|
1127
|
-
#3A3A3A ${
|
|
1136
|
+
#fff 0% ${c}%,
|
|
1137
|
+
#3A3A3A ${c}% 100%
|
|
1128
1138
|
)` },
|
|
1129
|
-
children: /* @__PURE__ */
|
|
1139
|
+
children: /* @__PURE__ */ x("div", {
|
|
1130
1140
|
className: "volume-handle",
|
|
1131
1141
|
style: { left: `${e * 100}%` }
|
|
1132
1142
|
})
|
|
1133
1143
|
})
|
|
1134
1144
|
}),
|
|
1135
|
-
toolTipText: /* @__PURE__ */
|
|
1145
|
+
toolTipText: /* @__PURE__ */ S("div", {
|
|
1136
1146
|
className: "volume-value",
|
|
1137
1147
|
children: [f, "%"]
|
|
1138
1148
|
})
|
|
1139
1149
|
});
|
|
1140
|
-
},
|
|
1150
|
+
}, Te = p`
|
|
1141
1151
|
position: relative;
|
|
1142
1152
|
display: flex;
|
|
1143
1153
|
align-items: center;
|
|
@@ -1200,28 +1210,28 @@ position: relative;
|
|
|
1200
1210
|
}
|
|
1201
1211
|
}
|
|
1202
1212
|
|
|
1203
|
-
`,
|
|
1204
|
-
let t =
|
|
1205
|
-
return /* @__PURE__ */
|
|
1206
|
-
css:
|
|
1207
|
-
children: [/* @__PURE__ */
|
|
1213
|
+
`, Ee = ({ ref: e }) => {
|
|
1214
|
+
let t = F(), n = F((e) => e.volume), r = F((e) => e.muted), i = u(() => G(n), [n]);
|
|
1215
|
+
return /* @__PURE__ */ S("div", {
|
|
1216
|
+
css: Te,
|
|
1217
|
+
children: [/* @__PURE__ */ x(q, {
|
|
1208
1218
|
id: "sound",
|
|
1209
|
-
text: /* @__PURE__ */
|
|
1219
|
+
text: /* @__PURE__ */ x("button", {
|
|
1210
1220
|
className: "sound",
|
|
1211
1221
|
type: "button",
|
|
1212
1222
|
onClick: () => t.toggleMuted(),
|
|
1213
1223
|
ref: e,
|
|
1214
|
-
children:
|
|
1224
|
+
children: x(r || n === 0 ? ee : n <= .5 ? j : M, {
|
|
1215
1225
|
size: 18,
|
|
1216
1226
|
color: "#fff"
|
|
1217
1227
|
})
|
|
1218
1228
|
}),
|
|
1219
|
-
toolTipText: /* @__PURE__ */
|
|
1220
|
-
}), /* @__PURE__ */
|
|
1229
|
+
toolTipText: /* @__PURE__ */ x("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
1230
|
+
}), /* @__PURE__ */ x("div", {
|
|
1221
1231
|
className: "volume-slider-container",
|
|
1222
|
-
children: /* @__PURE__ */
|
|
1232
|
+
children: /* @__PURE__ */ x("div", {
|
|
1223
1233
|
className: "volume-slider-background",
|
|
1224
|
-
children: /* @__PURE__ */
|
|
1234
|
+
children: /* @__PURE__ */ x(we, {
|
|
1225
1235
|
value: r ? 0 : i,
|
|
1226
1236
|
onChange: (e) => {
|
|
1227
1237
|
t.setVolume(W(e));
|
|
@@ -1230,7 +1240,7 @@ position: relative;
|
|
|
1230
1240
|
})
|
|
1231
1241
|
})]
|
|
1232
1242
|
});
|
|
1233
|
-
}, X = .05, Z = 5,
|
|
1243
|
+
}, X = .05, Z = 5, De = p`
|
|
1234
1244
|
position: absolute;
|
|
1235
1245
|
bottom: 0;
|
|
1236
1246
|
width: 100%;
|
|
@@ -1314,7 +1324,7 @@ position: relative;
|
|
|
1314
1324
|
cursor: pointer;
|
|
1315
1325
|
|
|
1316
1326
|
:hover {
|
|
1317
|
-
background-color: ${
|
|
1327
|
+
background-color: ${Se.hover};
|
|
1318
1328
|
}
|
|
1319
1329
|
|
|
1320
1330
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1352,12 +1362,12 @@ position: relative;
|
|
|
1352
1362
|
}
|
|
1353
1363
|
}
|
|
1354
1364
|
}
|
|
1355
|
-
`,
|
|
1356
|
-
let e =
|
|
1365
|
+
`, Oe = () => {
|
|
1366
|
+
let e = F(), t = F((e) => e.paused), n = F((e) => e.currentTime), r = F((e) => e.duration), i = F((e) => e.fullscreen), a = F((e) => e.hideUI), o = F((e) => e.togglePictureInPicture), [s, u] = f(null), d = r > 0 && n === r, p = c(({ direction: t, stepSize: n }) => {
|
|
1357
1367
|
let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1358
1368
|
e.setVolume(W(a)), o && !e.muted && e.toggleMuted();
|
|
1359
1369
|
}, [e]);
|
|
1360
|
-
|
|
1370
|
+
l(() => {
|
|
1361
1371
|
let t = (t) => {
|
|
1362
1372
|
let n = t.target;
|
|
1363
1373
|
if (n?.isContentEditable || /^(input|textarea|select)$/i.test(n?.tagName ?? "")) return;
|
|
@@ -1382,7 +1392,7 @@ position: relative;
|
|
|
1382
1392
|
};
|
|
1383
1393
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1384
1394
|
}, [e, p]);
|
|
1385
|
-
let m =
|
|
1395
|
+
let m = c((e) => {
|
|
1386
1396
|
e.preventDefault(), e.deltaY < 0 ? p({
|
|
1387
1397
|
direction: "up",
|
|
1388
1398
|
stepSize: X
|
|
@@ -1391,66 +1401,77 @@ position: relative;
|
|
|
1391
1401
|
stepSize: X
|
|
1392
1402
|
});
|
|
1393
1403
|
}, [p]);
|
|
1394
|
-
return
|
|
1395
|
-
if (
|
|
1396
|
-
}, [
|
|
1397
|
-
css:
|
|
1398
|
-
style: { ...
|
|
1404
|
+
return l(() => {
|
|
1405
|
+
if (s) return s.addEventListener("wheel", m, { passive: !1 }), () => s.removeEventListener("wheel", m);
|
|
1406
|
+
}, [s, m]), /* @__PURE__ */ S("div", {
|
|
1407
|
+
css: De,
|
|
1408
|
+
style: { ...a ? {
|
|
1399
1409
|
opacity: "0",
|
|
1400
1410
|
pointerEvents: "none"
|
|
1401
1411
|
} : {} },
|
|
1402
|
-
children: [/* @__PURE__ */
|
|
1412
|
+
children: [/* @__PURE__ */ x(ge, {}), /* @__PURE__ */ S("div", {
|
|
1403
1413
|
className: "actions",
|
|
1404
|
-
children: [/* @__PURE__ */
|
|
1414
|
+
children: [/* @__PURE__ */ S("div", {
|
|
1405
1415
|
className: "left",
|
|
1406
1416
|
children: [
|
|
1407
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ x(q, {
|
|
1408
1418
|
id: "play",
|
|
1409
1419
|
tooltipPlace: "top-start",
|
|
1410
|
-
text: /* @__PURE__ */
|
|
1420
|
+
text: /* @__PURE__ */ x("button", {
|
|
1411
1421
|
className: "play",
|
|
1412
1422
|
type: "button",
|
|
1413
1423
|
onClick: () => e.togglePaused(),
|
|
1414
|
-
children:
|
|
1424
|
+
children: x(d ? k : t ? O : D, {})
|
|
1415
1425
|
}),
|
|
1416
|
-
toolTipText: /* @__PURE__ */
|
|
1426
|
+
toolTipText: /* @__PURE__ */ x("span", { children: d ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1417
1427
|
}),
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */
|
|
1428
|
+
/* @__PURE__ */ x(Ee, { ref: u }),
|
|
1429
|
+
/* @__PURE__ */ x("div", {
|
|
1420
1430
|
className: "time",
|
|
1421
|
-
children:
|
|
1431
|
+
children: pe(n, r)
|
|
1422
1432
|
})
|
|
1423
1433
|
]
|
|
1424
|
-
}), /* @__PURE__ */
|
|
1434
|
+
}), /* @__PURE__ */ S("div", {
|
|
1425
1435
|
className: "right",
|
|
1426
1436
|
children: [
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
|
|
1437
|
+
/* @__PURE__ */ x(xe, {}),
|
|
1438
|
+
o ? /* @__PURE__ */ x(q, {
|
|
1429
1439
|
id: "picture-in-picture",
|
|
1430
|
-
text: /* @__PURE__ */
|
|
1440
|
+
text: /* @__PURE__ */ x("button", {
|
|
1431
1441
|
className: "picture-in-picture",
|
|
1432
1442
|
type: "button",
|
|
1433
|
-
onClick:
|
|
1434
|
-
children: /* @__PURE__ */
|
|
1443
|
+
onClick: o,
|
|
1444
|
+
children: /* @__PURE__ */ x("img", { src: _e })
|
|
1435
1445
|
}),
|
|
1436
|
-
toolTipText: /* @__PURE__ */
|
|
1446
|
+
toolTipText: /* @__PURE__ */ x("span", { children: "Picture in picture" })
|
|
1437
1447
|
}) : null,
|
|
1438
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ x(q, {
|
|
1439
1449
|
id: "full-screen",
|
|
1440
1450
|
tooltipPlace: "top-end",
|
|
1441
|
-
text: /* @__PURE__ */
|
|
1451
|
+
text: /* @__PURE__ */ x("button", {
|
|
1442
1452
|
className: "full-screen",
|
|
1443
1453
|
type: "button",
|
|
1444
1454
|
onClick: () => e.toggleFullscreen(),
|
|
1445
|
-
children:
|
|
1455
|
+
children: x(i ? E : T, {})
|
|
1446
1456
|
}),
|
|
1447
|
-
toolTipText: /* @__PURE__ */
|
|
1457
|
+
toolTipText: /* @__PURE__ */ x("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
|
|
1448
1458
|
})
|
|
1449
1459
|
]
|
|
1450
1460
|
})]
|
|
1451
1461
|
})]
|
|
1452
1462
|
});
|
|
1453
|
-
},
|
|
1463
|
+
}, ke = 3e3, Ae = p`
|
|
1464
|
+
position: absolute;
|
|
1465
|
+
inset: 0;
|
|
1466
|
+
z-index: 2;
|
|
1467
|
+
/* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
|
|
1468
|
+
pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
|
|
1469
|
+
pointer-events: none;
|
|
1470
|
+
/* visibility, not only opacity: an item that took pointer events back would otherwise stay
|
|
1471
|
+
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1472
|
+
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1473
|
+
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1474
|
+
`, je = p`
|
|
1454
1475
|
position: relative;
|
|
1455
1476
|
background-color: black;
|
|
1456
1477
|
display: flex;
|
|
@@ -1482,74 +1503,86 @@ position: relative;
|
|
|
1482
1503
|
&.hide {
|
|
1483
1504
|
cursor: none;
|
|
1484
1505
|
}
|
|
1485
|
-
`,
|
|
1486
|
-
let
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1506
|
+
`, Q = (e, t = "") => a.toArray(e).flatMap((e, n) => {
|
|
1507
|
+
let r = `${t}${s(e) && e.key != null ? e.key : n}`;
|
|
1508
|
+
return s(e) && e.type === o ? Q(e.props.children, `${r}/`) : [{
|
|
1509
|
+
key: r,
|
|
1510
|
+
item: e
|
|
1511
|
+
}];
|
|
1512
|
+
}), Me = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
1513
|
+
let o = F(), s = F((e) => e.hideUI), c = F((e) => e.setHideUI), u = d(void 0), f = d("mouse");
|
|
1514
|
+
l(() => () => clearTimeout(u.current), []);
|
|
1515
|
+
let p = () => {
|
|
1516
|
+
c(!1), clearTimeout(u.current), u.current = setTimeout(() => c(!0), ke);
|
|
1490
1517
|
};
|
|
1491
|
-
return /* @__PURE__ */
|
|
1492
|
-
css:
|
|
1518
|
+
return /* @__PURE__ */ S("div", {
|
|
1519
|
+
css: je,
|
|
1493
1520
|
ref: e,
|
|
1494
1521
|
onPointerMove: (e) => {
|
|
1495
|
-
|
|
1522
|
+
f.current = e.pointerType, e.pointerType === "mouse" && p();
|
|
1496
1523
|
},
|
|
1497
1524
|
onPointerDown: (e) => {
|
|
1498
|
-
|
|
1525
|
+
f.current = e.pointerType;
|
|
1499
1526
|
},
|
|
1500
1527
|
onMouseOut: (e) => {
|
|
1501
1528
|
let t = e.relatedTarget;
|
|
1502
1529
|
if (t && e.currentTarget.contains(t)) return;
|
|
1503
1530
|
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(u.current),
|
|
1531
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), c(!0));
|
|
1505
1532
|
},
|
|
1506
1533
|
className: s ? "hide" : "",
|
|
1507
1534
|
children: [
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1535
|
+
/* @__PURE__ */ x(fe, { onCanvasRef: n }),
|
|
1536
|
+
Q(r).map(({ key: e, item: t }) => /* @__PURE__ */ x("div", {
|
|
1537
|
+
css: Ae,
|
|
1538
|
+
style: { ...s ? {
|
|
1539
|
+
opacity: "0",
|
|
1540
|
+
visibility: "hidden",
|
|
1541
|
+
pointerEvents: "none"
|
|
1542
|
+
} : {} },
|
|
1543
|
+
children: t
|
|
1544
|
+
}, e)),
|
|
1545
|
+
i === !1 ? null : /* @__PURE__ */ x(Oe, {}),
|
|
1546
|
+
/* @__PURE__ */ S("div", {
|
|
1514
1547
|
className: "video",
|
|
1515
1548
|
onClick: () => {
|
|
1516
|
-
if (
|
|
1517
|
-
|
|
1549
|
+
if (f.current === "mouse") {
|
|
1550
|
+
o.togglePaused();
|
|
1518
1551
|
return;
|
|
1519
1552
|
}
|
|
1520
|
-
s ?
|
|
1553
|
+
s ? p() : (clearTimeout(u.current), c(!0));
|
|
1521
1554
|
},
|
|
1522
|
-
children: [t ? /* @__PURE__ */
|
|
1555
|
+
children: [t ? /* @__PURE__ */ x("video", {
|
|
1523
1556
|
ref: t,
|
|
1524
1557
|
playsInline: !0
|
|
1525
|
-
}) : null,
|
|
1558
|
+
}) : null, a]
|
|
1526
1559
|
})
|
|
1527
1560
|
]
|
|
1528
1561
|
});
|
|
1529
|
-
},
|
|
1530
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges:
|
|
1531
|
-
|
|
1562
|
+
}, Ne = ({ options: e, children: t }) => {
|
|
1563
|
+
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;
|
|
1564
|
+
l(() => (m?.(C), () => m?.(null)), [C, m]), ie(v, b, r);
|
|
1532
1565
|
let w = z({
|
|
1533
|
-
publicPath:
|
|
1534
|
-
workerUrl:
|
|
1535
|
-
length:
|
|
1536
|
-
read:
|
|
1537
|
-
downloadedRanges:
|
|
1538
|
-
}), T = n?.thumbnails?.all ?? w, E = B(
|
|
1539
|
-
|
|
1566
|
+
publicPath: s,
|
|
1567
|
+
workerUrl: c,
|
|
1568
|
+
length: p === !1 ? void 0 : a,
|
|
1569
|
+
read: d ?? u,
|
|
1570
|
+
downloadedRanges: o
|
|
1571
|
+
}), T = n?.thumbnails?.all ?? w, E = B(v, b), D = F((e) => e.setSourceState);
|
|
1572
|
+
l(() => {
|
|
1540
1573
|
D({
|
|
1541
1574
|
title: i,
|
|
1542
1575
|
size: a,
|
|
1543
|
-
downloadedRanges:
|
|
1576
|
+
downloadedRanges: o
|
|
1544
1577
|
});
|
|
1545
1578
|
}, [
|
|
1546
1579
|
D,
|
|
1547
1580
|
i,
|
|
1548
1581
|
a,
|
|
1549
|
-
|
|
1582
|
+
o
|
|
1550
1583
|
]);
|
|
1551
1584
|
let O = n?.thumbnails?.at;
|
|
1552
|
-
|
|
1585
|
+
l(() => {
|
|
1553
1586
|
D({
|
|
1554
1587
|
thumbnails: T,
|
|
1555
1588
|
thumbnailAt: O,
|
|
@@ -1562,32 +1595,36 @@ position: relative;
|
|
|
1562
1595
|
E
|
|
1563
1596
|
]);
|
|
1564
1597
|
let k = n?.subtitles?.selection, A = n?.audioTracks?.selection;
|
|
1565
|
-
return
|
|
1598
|
+
return l(() => {
|
|
1566
1599
|
k && D({
|
|
1567
|
-
subtitleTracks: k.options.map(({ id: e, label: t }) => ({
|
|
1600
|
+
subtitleTracks: k.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
1568
1601
|
id: e,
|
|
1569
|
-
label: t
|
|
1602
|
+
label: t,
|
|
1603
|
+
disabled: n
|
|
1570
1604
|
})),
|
|
1571
1605
|
selectedSubtitleTrack: k.selectedId ?? void 0,
|
|
1572
|
-
selectSubtitleTrack: (e) => k.select(e == null ? null : String(e))
|
|
1606
|
+
selectSubtitleTrack: (e) => k.select(e == null ? null : String(e)),
|
|
1607
|
+
subtitleOffLabel: k.offLabel
|
|
1573
1608
|
});
|
|
1574
|
-
}, [D, k]),
|
|
1609
|
+
}, [D, k]), l(() => {
|
|
1575
1610
|
A && D({
|
|
1576
|
-
audioTracks: A.options.map(({ id: e, label: t }) => ({
|
|
1611
|
+
audioTracks: A.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
1577
1612
|
id: e,
|
|
1578
|
-
label: t
|
|
1613
|
+
label: t,
|
|
1614
|
+
disabled: n
|
|
1579
1615
|
})),
|
|
1580
1616
|
selectedAudioTrack: A.selectedId ?? void 0,
|
|
1581
1617
|
selectAudioTrack: (e) => A.select(String(e))
|
|
1582
1618
|
});
|
|
1583
|
-
}, [D, A]), /* @__PURE__ */
|
|
1584
|
-
ref:
|
|
1585
|
-
onVideoRef: n ? void 0 :
|
|
1619
|
+
}, [D, A]), /* @__PURE__ */ x(Me, {
|
|
1620
|
+
ref: h,
|
|
1621
|
+
onVideoRef: n ? void 0 : y,
|
|
1586
1622
|
onCanvasRef: S,
|
|
1587
1623
|
overlay: e.overlay,
|
|
1624
|
+
controls: e.controls,
|
|
1588
1625
|
children: t
|
|
1589
1626
|
});
|
|
1590
|
-
},
|
|
1627
|
+
}, Pe = p`
|
|
1591
1628
|
/**
|
|
1592
1629
|
* The chrome's whole scale, in one place.
|
|
1593
1630
|
*
|
|
@@ -1618,17 +1655,17 @@ position: relative;
|
|
|
1618
1655
|
height: 100%;
|
|
1619
1656
|
width: 100%;
|
|
1620
1657
|
overflow: hidden;
|
|
1621
|
-
`, $ = (e) => /* @__PURE__ */
|
|
1622
|
-
css:
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1658
|
+
`, $ = (e) => /* @__PURE__ */ x("div", {
|
|
1659
|
+
css: Pe,
|
|
1660
|
+
children: /* @__PURE__ */ x(P.Provider, { children: /* @__PURE__ */ x(Ne, {
|
|
1624
1661
|
options: e,
|
|
1625
1662
|
children: e.children
|
|
1626
1663
|
}) })
|
|
1627
|
-
}),
|
|
1664
|
+
}), Fe = (e) => !!e && typeof e == "object" && "at" in e, Ie = (e) => !!e && typeof e == "object" && "selection" in e, Le = ({ blob: e, name: t }) => ({
|
|
1628
1665
|
length: e.size,
|
|
1629
1666
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
1630
1667
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
1631
|
-
}),
|
|
1668
|
+
}), Re = async (e, t) => {
|
|
1632
1669
|
let n = await fetch(e, {
|
|
1633
1670
|
headers: { Range: "bytes=0-1" },
|
|
1634
1671
|
credentials: t
|
|
@@ -1638,8 +1675,8 @@ position: relative;
|
|
|
1638
1675
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
1639
1676
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
1640
1677
|
return i;
|
|
1641
|
-
},
|
|
1642
|
-
let i = t ?? await
|
|
1678
|
+
}, ze = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
1679
|
+
let i = t ?? await Re(e, r);
|
|
1643
1680
|
return {
|
|
1644
1681
|
length: i,
|
|
1645
1682
|
name: n,
|
|
@@ -1652,9 +1689,9 @@ position: relative;
|
|
|
1652
1689
|
return a.arrayBuffer();
|
|
1653
1690
|
}
|
|
1654
1691
|
};
|
|
1655
|
-
},
|
|
1656
|
-
if ("blob" in e) return
|
|
1657
|
-
if ("url" in e) return
|
|
1692
|
+
}, Be = async (e) => {
|
|
1693
|
+
if ("blob" in e) return Le(e);
|
|
1694
|
+
if ("url" in e) return ze(e);
|
|
1658
1695
|
if ("read" in e) return {
|
|
1659
1696
|
length: e.length,
|
|
1660
1697
|
name: e.name,
|
|
@@ -1663,4 +1700,4 @@ position: relative;
|
|
|
1663
1700
|
throw Error(`Unknown source type: ${e}`);
|
|
1664
1701
|
};
|
|
1665
1702
|
//#endregion
|
|
1666
|
-
export { $ as MediaPlayer, $ as default,
|
|
1703
|
+
export { $ as MediaPlayer, $ as default, P as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, Be as inputToRemuxerInput, Ie as isDelegatedTracks, Fe as isExternalThumbnails, N as sourceFeature, e as startPlayback, B as usePictureInPicture, F as usePlayer, z as useSeekThumbnails };
|