@banou/media-player 0.8.9 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +2 -2
- package/dist/engine/playback.d.ts +13 -0
- package/dist/{engine-BwK7ycv0.js → engine-Cownv8gD.js} +134 -98
- package/dist/index.d.ts +1 -1
- package/dist/index.js +652 -453
- package/dist/react/components/errors.d.ts +15 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +36 -0
- package/dist/react/video-player.d.ts +9 -0
- package/package.json +1 -1
- package/src/lib/engine/index.ts +1 -1
- package/src/lib/engine/playback.ts +113 -6
- package/src/lib/index.tsx +1 -1
- package/src/lib/react/components/control-bar.tsx +4 -2
- package/src/lib/react/components/errors.tsx +194 -0
- package/src/lib/react/components/track-menu.tsx +2 -2
- package/src/lib/react/hooks/use-playback.ts +105 -2
- package/src/lib/react/source-feature.ts +29 -0
- package/src/lib/react/video-player.tsx +9 -0
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Children as
|
|
3
|
-
import { css as
|
|
4
|
-
import { createPlayer as
|
|
5
|
-
import { definePlayerFeature as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { ChevronLeft as
|
|
8
|
-
import { Tooltip as
|
|
1
|
+
import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-Cownv8gD.js";
|
|
2
|
+
import { Children as s, Fragment as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
3
|
+
import { css as h, keyframes as g } from "@emotion/react";
|
|
4
|
+
import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
|
|
5
|
+
import { definePlayerFeature as b, videoFeatures as x } from "@videojs/core/dom";
|
|
6
|
+
import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
|
|
7
|
+
import { AlertTriangle as T, Check as E, ChevronLeft as D, ChevronRight as O, Copy as k, Maximize as A, Minimize as j, Pause as M, Play as N, RotateCcw as P, Settings as ee, Volume1 as te, Volume2 as ne, VolumeX as re } from "react-feather";
|
|
8
|
+
import { Tooltip as ie } from "react-tooltip";
|
|
9
9
|
//#region src/lib/react/source-feature.ts
|
|
10
|
-
var
|
|
10
|
+
var ae = {
|
|
11
11
|
indexes: [],
|
|
12
12
|
thumbnails: [],
|
|
13
13
|
subtitleTracks: [],
|
|
@@ -22,21 +22,22 @@ var re = {
|
|
|
22
22
|
pictureInPictureMode: null,
|
|
23
23
|
burnedInSubtitles: !1,
|
|
24
24
|
playbackError: null,
|
|
25
|
+
playbackErrors: [],
|
|
25
26
|
ready: !1,
|
|
26
27
|
setSourceState: () => {}
|
|
27
|
-
},
|
|
28
|
+
}, F = b({
|
|
28
29
|
name: "source",
|
|
29
|
-
state: () => ({ ...
|
|
30
|
+
state: () => ({ ...ae }),
|
|
30
31
|
attach({ set: e }) {
|
|
31
32
|
e({
|
|
32
33
|
setSourceState: (t) => e(t),
|
|
33
34
|
setHideUI: (t) => e({ hideUI: t })
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
}),
|
|
37
|
-
features: [...
|
|
37
|
+
}), I = _({
|
|
38
|
+
features: [...x, F],
|
|
38
39
|
displayName: "MediaPlayer"
|
|
39
|
-
}),
|
|
40
|
+
}), L = I.usePlayer, oe = (e) => {
|
|
40
41
|
if (!(!e || e === "und")) try {
|
|
41
42
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
42
43
|
type: "language",
|
|
@@ -45,130 +46,181 @@ var re = {
|
|
|
45
46
|
} catch {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
},
|
|
49
|
-
let t = e.map((e) =>
|
|
49
|
+
}, se = (e) => e?.replace(/_/g, " ").trim() || void 0, ce = (e) => {
|
|
50
|
+
let t = e.map((e) => oe(e.language) ?? se(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
50
51
|
...e,
|
|
51
52
|
[t]: (e[t] ?? 0) + 1
|
|
52
53
|
}), {});
|
|
53
54
|
return e.map((e, r) => {
|
|
54
|
-
let i = t[r], a =
|
|
55
|
+
let i = t[r], a = se(e.title);
|
|
55
56
|
return {
|
|
56
57
|
track: e,
|
|
57
58
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
58
59
|
};
|
|
59
60
|
});
|
|
60
|
-
},
|
|
61
|
+
}, le = (e) => ce(e).map(({ track: e, label: t }) => ({
|
|
61
62
|
id: e.streamIndex,
|
|
62
63
|
label: t
|
|
63
|
-
})),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let
|
|
64
|
+
})), ue = [
|
|
65
|
+
0,
|
|
66
|
+
250,
|
|
67
|
+
1e3,
|
|
68
|
+
3e3,
|
|
69
|
+
1e4
|
|
70
|
+
], de = 6e4, R = (e) => e instanceof Error ? e.message : String(e), fe = (e) => {
|
|
71
|
+
let t = [], n = e?.cause;
|
|
72
|
+
for (let e = 0; n != null && e < 8; e++) {
|
|
73
|
+
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
74
|
+
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
t.push(R(n)), n = n?.cause;
|
|
78
|
+
}
|
|
79
|
+
return t.length ? t.join("\n") : void 0;
|
|
80
|
+
}, pe = (e, t, r) => {
|
|
81
|
+
let a = L(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1 } = r ?? {}, [b, x] = m(void 0), [S, C] = m(0), w = p({
|
|
82
|
+
count: 0,
|
|
83
|
+
at: 0
|
|
84
|
+
}), T = p(void 0);
|
|
85
|
+
d(() => (w.current = {
|
|
86
|
+
count: 0,
|
|
87
|
+
at: 0
|
|
88
|
+
}, a.setSourceState({ playbackErrors: [] }), () => {
|
|
89
|
+
T.current && clearTimeout(T.current);
|
|
90
|
+
}), [s]);
|
|
91
|
+
let E = p(null), D = p(null), O = p(!1), k = p(o);
|
|
92
|
+
k.current = o;
|
|
93
|
+
let A = p(r?.onSeek);
|
|
94
|
+
A.current = r?.onSeek;
|
|
95
|
+
let j = p(r?.onPlaybackError);
|
|
96
|
+
j.current = r?.onPlaybackError;
|
|
97
|
+
let M = u((e) => {
|
|
71
98
|
let t = typeof e == "number" ? e : void 0;
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
typeof e == "number" && (
|
|
75
|
-
}, [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
selectSubtitleTrack:
|
|
79
|
-
selectAudioTrack:
|
|
99
|
+
O.current = !0, a.setSourceState({ selectedSubtitleTrack: t }), E.current?.selectSubtitleStream(t);
|
|
100
|
+
}, [a]), N = u((e) => {
|
|
101
|
+
typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), x(e));
|
|
102
|
+
}, [a]), P = L((e) => e.setSourceState);
|
|
103
|
+
d(() => {
|
|
104
|
+
P({
|
|
105
|
+
selectSubtitleTrack: M,
|
|
106
|
+
selectAudioTrack: N
|
|
80
107
|
});
|
|
81
108
|
}, [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
]),
|
|
86
|
-
if (!
|
|
109
|
+
P,
|
|
110
|
+
M,
|
|
111
|
+
N
|
|
112
|
+
]), d(() => {
|
|
113
|
+
if (!e || !t || !s || !o) return;
|
|
87
114
|
let r = !1;
|
|
88
|
-
|
|
115
|
+
a.setSourceState({
|
|
89
116
|
playbackError: null,
|
|
90
117
|
ready: !1
|
|
91
118
|
});
|
|
92
|
-
let
|
|
93
|
-
r
|
|
119
|
+
let u = (t, n) => {
|
|
120
|
+
let r = {
|
|
121
|
+
at: Date.now(),
|
|
122
|
+
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
123
|
+
message: R(t),
|
|
124
|
+
detail: fe(t),
|
|
125
|
+
recovered: n
|
|
126
|
+
};
|
|
127
|
+
a.setSourceState({ playbackErrors: [...a.playbackErrors, r] });
|
|
128
|
+
}, d = (e) => {
|
|
129
|
+
if (r) return;
|
|
130
|
+
let t = n(e);
|
|
131
|
+
if (u(e, t), t) {
|
|
132
|
+
let t = performance.now();
|
|
133
|
+
t - w.current.at > de && (w.current = {
|
|
134
|
+
count: 0,
|
|
135
|
+
at: t
|
|
136
|
+
});
|
|
137
|
+
let n = ue[Math.min(w.current.count, ue.length - 1)];
|
|
138
|
+
w.current = {
|
|
139
|
+
count: w.current.count + 1,
|
|
140
|
+
at: t
|
|
141
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), T.current && clearTimeout(T.current), T.current = setTimeout(() => C((e) => e + 1), n);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), j.current?.(e);
|
|
94
145
|
};
|
|
95
146
|
return (async () => {
|
|
96
147
|
try {
|
|
97
|
-
let
|
|
98
|
-
videoElement:
|
|
99
|
-
canvasElement:
|
|
100
|
-
read: (e, t) =>
|
|
101
|
-
length:
|
|
102
|
-
publicPath:
|
|
103
|
-
libavWorkerUrl:
|
|
104
|
-
jassubWorkerUrl:
|
|
105
|
-
jassubWasmUrl:
|
|
106
|
-
jassubLegacyWasmUrl:
|
|
107
|
-
defaultFontUrl:
|
|
108
|
-
bufferSize:
|
|
109
|
-
audioStreamIndex:
|
|
148
|
+
let n = await i({
|
|
149
|
+
videoElement: e,
|
|
150
|
+
canvasElement: t,
|
|
151
|
+
read: (e, t) => k.current(e, t),
|
|
152
|
+
length: s,
|
|
153
|
+
publicPath: c,
|
|
154
|
+
libavWorkerUrl: l,
|
|
155
|
+
jassubWorkerUrl: f,
|
|
156
|
+
jassubWasmUrl: h,
|
|
157
|
+
jassubLegacyWasmUrl: g,
|
|
158
|
+
defaultFontUrl: _,
|
|
159
|
+
bufferSize: v,
|
|
160
|
+
audioStreamIndex: b,
|
|
110
161
|
onReady: () => {
|
|
111
162
|
if (r) return;
|
|
112
|
-
|
|
113
|
-
let
|
|
114
|
-
|
|
163
|
+
a.setSourceState({ ready: !0 });
|
|
164
|
+
let t = D.current;
|
|
165
|
+
D.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
115
166
|
},
|
|
116
|
-
onError:
|
|
167
|
+
onError: d,
|
|
117
168
|
onRecovered: () => {
|
|
118
|
-
r ||
|
|
169
|
+
r || a.setSourceState({ playbackError: null });
|
|
119
170
|
},
|
|
120
|
-
onSeek: (e) =>
|
|
171
|
+
onSeek: (e) => A.current?.(e),
|
|
121
172
|
onSubtitleStreams: (e) => {
|
|
122
|
-
r ||
|
|
123
|
-
subtitleTracks:
|
|
124
|
-
...
|
|
173
|
+
r || a.setSourceState({
|
|
174
|
+
subtitleTracks: le(e),
|
|
175
|
+
...O.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
125
176
|
});
|
|
126
177
|
},
|
|
127
178
|
onAudioStreams: (e, t) => {
|
|
128
|
-
r ||
|
|
129
|
-
audioTracks:
|
|
179
|
+
r || a.setSourceState({
|
|
180
|
+
audioTracks: le(e),
|
|
130
181
|
selectedAudioTrack: t
|
|
131
182
|
});
|
|
132
183
|
}
|
|
133
184
|
});
|
|
134
185
|
if (r) {
|
|
135
|
-
|
|
186
|
+
n.destroy();
|
|
136
187
|
return;
|
|
137
188
|
}
|
|
138
|
-
|
|
139
|
-
let
|
|
140
|
-
typeof
|
|
189
|
+
E.current = n, a.setSourceState({ indexes: n.indexes });
|
|
190
|
+
let o = a.selectedSubtitleTrack;
|
|
191
|
+
typeof o == "number" && n.selectSubtitleStream(o);
|
|
141
192
|
} catch (e) {
|
|
142
|
-
|
|
193
|
+
d(e);
|
|
143
194
|
}
|
|
144
195
|
})(), () => {
|
|
145
|
-
r = !0,
|
|
146
|
-
time:
|
|
147
|
-
size:
|
|
148
|
-
},
|
|
196
|
+
r = !0, D.current = {
|
|
197
|
+
time: e.currentTime,
|
|
198
|
+
size: s
|
|
199
|
+
}, E.current?.destroy(), E.current = null, a.setSourceState({ ready: !1 });
|
|
149
200
|
};
|
|
150
201
|
}, [
|
|
151
|
-
|
|
202
|
+
a,
|
|
203
|
+
e,
|
|
152
204
|
t,
|
|
153
|
-
n,
|
|
154
|
-
o,
|
|
155
205
|
s,
|
|
156
206
|
c,
|
|
157
|
-
|
|
158
|
-
|
|
207
|
+
l,
|
|
208
|
+
f,
|
|
159
209
|
h,
|
|
160
210
|
g,
|
|
161
211
|
_,
|
|
212
|
+
v,
|
|
213
|
+
b,
|
|
162
214
|
y,
|
|
163
|
-
|
|
215
|
+
S
|
|
164
216
|
]);
|
|
165
|
-
},
|
|
166
|
-
let [o, s] =
|
|
217
|
+
}, me = 5e3, he = 6e4, z = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
|
|
218
|
+
let [o, s] = m([]), c = p(null), l = p(i);
|
|
167
219
|
l.current = i;
|
|
168
|
-
let
|
|
169
|
-
return h.current =
|
|
220
|
+
let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
|
|
221
|
+
return h.current = u, d(() => {
|
|
170
222
|
if (!n || !i || !e || !t) return;
|
|
171
|
-
let a = !1, o = null, u, d =
|
|
223
|
+
let a = !1, o = null, u, d = me, f = () => {
|
|
172
224
|
r({
|
|
173
225
|
publicPath: e,
|
|
174
226
|
workerUrl: t,
|
|
@@ -184,7 +236,7 @@ var re = {
|
|
|
184
236
|
}
|
|
185
237
|
o = e, c.current = e, e.update(h.current);
|
|
186
238
|
}, () => {
|
|
187
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
239
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, he));
|
|
188
240
|
});
|
|
189
241
|
};
|
|
190
242
|
return f(), () => {
|
|
@@ -194,38 +246,38 @@ var re = {
|
|
|
194
246
|
n,
|
|
195
247
|
e,
|
|
196
248
|
t
|
|
197
|
-
]),
|
|
198
|
-
c.current?.update(
|
|
199
|
-
}, [
|
|
200
|
-
},
|
|
201
|
-
let r =
|
|
202
|
-
|
|
203
|
-
if (!e || !
|
|
204
|
-
let
|
|
249
|
+
]), d(() => {
|
|
250
|
+
c.current?.update(u);
|
|
251
|
+
}, [u]), o;
|
|
252
|
+
}, B = (e, n) => {
|
|
253
|
+
let r = p(null), [i, o] = m(!1), [s] = m(() => t());
|
|
254
|
+
d(() => {
|
|
255
|
+
if (!e || !n || !s) return;
|
|
256
|
+
let t = a({
|
|
205
257
|
video: e,
|
|
206
|
-
canvas:
|
|
258
|
+
canvas: n,
|
|
207
259
|
mode: s,
|
|
208
260
|
onBurnedInChange: o
|
|
209
261
|
});
|
|
210
|
-
return r.current =
|
|
211
|
-
|
|
262
|
+
return r.current = t, () => {
|
|
263
|
+
t.destroy(), r.current = null, o(!1);
|
|
212
264
|
};
|
|
213
265
|
}, [
|
|
214
266
|
e,
|
|
215
|
-
|
|
267
|
+
n,
|
|
216
268
|
s
|
|
217
269
|
]);
|
|
218
|
-
let c =
|
|
270
|
+
let c = u(() => {
|
|
219
271
|
r.current?.toggle().catch((e) => {
|
|
220
272
|
console.warn("picture in picture was refused", e);
|
|
221
273
|
});
|
|
222
274
|
}, []);
|
|
223
275
|
return {
|
|
224
|
-
toggle: e &&
|
|
276
|
+
toggle: e && n && s ? c : null,
|
|
225
277
|
mode: s,
|
|
226
278
|
burnedIn: i
|
|
227
279
|
};
|
|
228
|
-
},
|
|
280
|
+
}, V = {
|
|
229
281
|
headings: {
|
|
230
282
|
large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
|
|
231
283
|
medium: "\n font-weight: 600;\n font-size: calc(2.4 * var(--mp-unit));\n line-height: calc(2.9 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n }\n ",
|
|
@@ -252,14 +304,14 @@ var re = {
|
|
|
252
304
|
medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
|
|
253
305
|
regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
|
|
254
306
|
}
|
|
255
|
-
},
|
|
307
|
+
}, ge = h`
|
|
256
308
|
top: unset !important;
|
|
257
309
|
left: unset !important;
|
|
258
310
|
width: 100%;
|
|
259
311
|
height: 100%;
|
|
260
312
|
margin: auto;
|
|
261
313
|
pointer-events: none;
|
|
262
|
-
`,
|
|
314
|
+
`, _e = h`
|
|
263
315
|
position: absolute;
|
|
264
316
|
top: 0;
|
|
265
317
|
left: 0;
|
|
@@ -267,7 +319,7 @@ var re = {
|
|
|
267
319
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
268
320
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
269
321
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
270
|
-
${
|
|
322
|
+
${V.headings.small}
|
|
271
323
|
color: white;
|
|
272
324
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
273
325
|
z-index: 2;
|
|
@@ -288,7 +340,7 @@ var re = {
|
|
|
288
340
|
|
|
289
341
|
background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
|
|
290
342
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
291
|
-
`,
|
|
343
|
+
`, ve = h`
|
|
292
344
|
position: absolute;
|
|
293
345
|
inset: 0;
|
|
294
346
|
z-index: 2;
|
|
@@ -304,47 +356,47 @@ var re = {
|
|
|
304
356
|
border-radius: 50%;
|
|
305
357
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
306
358
|
border-top-color: #fff;
|
|
307
|
-
animation: ${
|
|
359
|
+
animation: ${g`
|
|
308
360
|
to { transform: rotate(360deg); }
|
|
309
361
|
`} 0.8s linear infinite;
|
|
310
362
|
}
|
|
311
|
-
`,
|
|
363
|
+
`, ye = h`
|
|
312
364
|
position: absolute;
|
|
313
365
|
inset: auto 0 20%;
|
|
314
366
|
z-index: 3;
|
|
315
367
|
padding: 0 calc(2 * var(--mp-unit));
|
|
316
368
|
text-align: center;
|
|
317
369
|
color: #fff;
|
|
318
|
-
${
|
|
370
|
+
${V.bLarge.regular}
|
|
319
371
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
320
372
|
pointer-events: none;
|
|
321
|
-
`,
|
|
322
|
-
let t =
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
t ? /* @__PURE__ */
|
|
373
|
+
`, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
|
|
374
|
+
let t = L((e) => e.title), n = L((e) => e.hideUI), r = L((e) => e.playbackError), i = L((e) => e.ready), a = L((e) => e.size), o = L((e) => e.waiting);
|
|
375
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
376
|
+
t ? /* @__PURE__ */ C("div", {
|
|
325
377
|
className: "title",
|
|
326
|
-
css:
|
|
378
|
+
css: _e,
|
|
327
379
|
style: { ...n ? {
|
|
328
380
|
opacity: "0",
|
|
329
381
|
pointerEvents: "none"
|
|
330
382
|
} : {} },
|
|
331
383
|
children: t
|
|
332
384
|
}) : void 0,
|
|
333
|
-
(a ? !i : o) && !r ? /* @__PURE__ */
|
|
334
|
-
r ? /* @__PURE__ */
|
|
335
|
-
css:
|
|
336
|
-
children:
|
|
385
|
+
(a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: ve }) : void 0,
|
|
386
|
+
r ? /* @__PURE__ */ C("div", {
|
|
387
|
+
css: ye,
|
|
388
|
+
children: be(r)
|
|
337
389
|
}) : void 0,
|
|
338
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ C("canvas", {
|
|
339
391
|
ref: e,
|
|
340
|
-
css:
|
|
392
|
+
css: ge
|
|
341
393
|
})
|
|
342
394
|
] });
|
|
343
|
-
},
|
|
395
|
+
}, H = 1e-4, U = 1, W = (e) => Math.max(H, Math.min(U, e)) ** 2, G = (e) => Math.max(H, Math.min(U, e)) ** (U / 2), K = (e) => {
|
|
344
396
|
if (e === void 0) return "0:00";
|
|
345
397
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
346
398
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
347
|
-
},
|
|
399
|
+
}, Se = (e, t) => `${K(e)} / ${K(t)}`, Ce = (e) => h`
|
|
348
400
|
display: flex;
|
|
349
401
|
justify-content: flex-end;
|
|
350
402
|
|
|
@@ -354,19 +406,19 @@ var re = {
|
|
|
354
406
|
z-index: 3;
|
|
355
407
|
|
|
356
408
|
* {
|
|
357
|
-
${
|
|
409
|
+
${V.bMedium.regular}
|
|
358
410
|
}
|
|
359
411
|
|
|
360
|
-
${e === "sm" &&
|
|
412
|
+
${e === "sm" && h`
|
|
361
413
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
362
414
|
`}
|
|
363
|
-
${e === "md" &&
|
|
415
|
+
${e === "md" && h`
|
|
364
416
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
365
417
|
`}
|
|
366
|
-
${e === "lg" &&
|
|
418
|
+
${e === "lg" && h`
|
|
367
419
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
368
420
|
`}
|
|
369
|
-
`,
|
|
421
|
+
`, q = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
|
|
370
422
|
"data-tooltip-id": e,
|
|
371
423
|
"data-open": !0,
|
|
372
424
|
"data-tooltip-offset": a,
|
|
@@ -374,39 +426,39 @@ var re = {
|
|
|
374
426
|
"data-tooltip-delay-hide": i,
|
|
375
427
|
"data-tooltip-place": o,
|
|
376
428
|
children: n
|
|
377
|
-
}), !s && /* @__PURE__ */
|
|
378
|
-
css:
|
|
429
|
+
}), !s && /* @__PURE__ */ C(ie, {
|
|
430
|
+
css: Ce(c),
|
|
379
431
|
id: e,
|
|
380
432
|
noArrow: !0,
|
|
381
433
|
children: t
|
|
382
|
-
})] }),
|
|
383
|
-
let [i, a] =
|
|
434
|
+
})] }), J = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
435
|
+
let [i, a] = m(!1), o = p(t);
|
|
384
436
|
o.current = t;
|
|
385
|
-
let s =
|
|
437
|
+
let s = p(null), c = u((t, r) => {
|
|
386
438
|
let i = e.current;
|
|
387
439
|
if (!i) return 0;
|
|
388
440
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
389
441
|
return Math.min(Math.max(l, 0), 1);
|
|
390
|
-
}, [e, n]),
|
|
442
|
+
}, [e, n]), l = u((e) => {
|
|
391
443
|
r || e.button > 0 || (s.current = e.pointerId, e.currentTarget.setPointerCapture?.(e.pointerId), a(!0), o.current(c(e.clientX, e.clientY)));
|
|
392
|
-
}, [r, c]),
|
|
444
|
+
}, [r, c]), f = u((e) => {
|
|
393
445
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
394
|
-
}, [c]), h =
|
|
446
|
+
}, [c]), h = u((e) => {
|
|
395
447
|
s.current === e.pointerId && (s.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), a(!1));
|
|
396
448
|
}, []);
|
|
397
|
-
return
|
|
449
|
+
return d(() => {
|
|
398
450
|
r && (s.current = null, a(!1));
|
|
399
451
|
}, [r]), {
|
|
400
452
|
dragging: i,
|
|
401
453
|
handlers: {
|
|
402
|
-
onPointerDown:
|
|
403
|
-
onPointerMove:
|
|
454
|
+
onPointerDown: l,
|
|
455
|
+
onPointerMove: f,
|
|
404
456
|
onPointerUp: h,
|
|
405
457
|
onPointerCancel: h,
|
|
406
458
|
style: { touchAction: "none" }
|
|
407
459
|
}
|
|
408
460
|
};
|
|
409
|
-
},
|
|
461
|
+
}, we = h`
|
|
410
462
|
position: relative;
|
|
411
463
|
height: calc(.4 * var(--mp-unit));
|
|
412
464
|
|
|
@@ -460,7 +512,7 @@ var re = {
|
|
|
460
512
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
461
513
|
|
|
462
514
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
463
|
-
${
|
|
515
|
+
${V.bMedium.bold}
|
|
464
516
|
|
|
465
517
|
position: absolute;
|
|
466
518
|
/* Anchored on its bottom edge rather than its top: now that it has a background its height
|
|
@@ -577,30 +629,30 @@ var re = {
|
|
|
577
629
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
578
630
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
579
631
|
}
|
|
580
|
-
`,
|
|
581
|
-
let e =
|
|
632
|
+
`, Te = () => {
|
|
633
|
+
let e = L(), t = L((e) => e.currentTime), n = L((e) => e.duration), r = L((e) => e.size), i = L((e) => e.downloadedRanges), a = L((e) => e.indexes), o = L((e) => e.thumbnails), s = L((e) => e.thumbnailAt), c = p(null), [l, u] = m(void 0), [h, g] = m(void 0), _ = p(void 0), { dragging: v, handlers: y } = J({
|
|
582
634
|
ref: c,
|
|
583
635
|
onChange: (e) => {
|
|
584
|
-
|
|
636
|
+
u(e), _.current !== "mouse" && g(e * n);
|
|
585
637
|
}
|
|
586
638
|
}), b = (e) => {
|
|
587
639
|
_.current = e.pointerType, y.onPointerDown(e);
|
|
588
640
|
}, x = (e) => {
|
|
589
641
|
y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
|
|
590
|
-
},
|
|
642
|
+
}, S = (e) => {
|
|
591
643
|
if (!c.current) return;
|
|
592
644
|
let { left: t, right: r } = c.current.getBoundingClientRect();
|
|
593
645
|
return Math.min(Math.max((e - t) / (r - t), 0), 1) * n;
|
|
594
646
|
}, T = (e) => {
|
|
595
|
-
g(
|
|
647
|
+
g(S(e.clientX));
|
|
596
648
|
}, E = () => {
|
|
597
649
|
c.current && g(void 0);
|
|
598
|
-
}, D = (e) => n ? e / n * 100 : 0, O =
|
|
650
|
+
}, D = (e) => n ? e / n * 100 : 0, O = f(() => i?.map((e, t) => {
|
|
599
651
|
if (!r || !n) return null;
|
|
600
652
|
let i = a.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), o = i.at(0), s = i.at(-1);
|
|
601
653
|
if (!o || !s) return null;
|
|
602
654
|
let c = o.timestamp / n, l = s.timestamp / n, u = Number((l - c).toFixed(2)), d = c * 100;
|
|
603
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ C("div", {
|
|
604
656
|
className: "loaded-part",
|
|
605
657
|
style: {
|
|
606
658
|
transform: `scaleX(${u})`,
|
|
@@ -611,12 +663,12 @@ var re = {
|
|
|
611
663
|
n,
|
|
612
664
|
a.length,
|
|
613
665
|
i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
614
|
-
]), k =
|
|
666
|
+
]), k = f(() => {
|
|
615
667
|
if (!h || h < 0) return;
|
|
616
668
|
let e = Math.floor(h / 3600), t = Math.floor((h - e * 3600) / 60), n = Math.floor(h - e * 3600 - t * 60);
|
|
617
669
|
return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
|
|
618
670
|
}, [h]);
|
|
619
|
-
|
|
671
|
+
d(() => {
|
|
620
672
|
if (l === void 0 || !n) return;
|
|
621
673
|
let t = l * n;
|
|
622
674
|
e.seek(t);
|
|
@@ -625,7 +677,7 @@ var re = {
|
|
|
625
677
|
l,
|
|
626
678
|
n
|
|
627
679
|
]);
|
|
628
|
-
let A =
|
|
680
|
+
let A = f(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = f(() => {
|
|
629
681
|
if (h) {
|
|
630
682
|
if (s) return s(h);
|
|
631
683
|
if (o.length) return o.find(({ startTime: e, endTime: t }) => e <= h && h < t);
|
|
@@ -635,49 +687,49 @@ var re = {
|
|
|
635
687
|
s,
|
|
636
688
|
h
|
|
637
689
|
]);
|
|
638
|
-
return /* @__PURE__ */
|
|
639
|
-
css:
|
|
690
|
+
return /* @__PURE__ */ w("div", {
|
|
691
|
+
css: we,
|
|
640
692
|
ref: c,
|
|
641
693
|
className: v ? "progress-bar dragging" : "progress-bar",
|
|
642
694
|
onMouseMove: T,
|
|
643
695
|
onMouseOut: E,
|
|
644
696
|
children: [
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
h ? /* @__PURE__ */
|
|
697
|
+
/* @__PURE__ */ C("div", { className: "background-bar" }),
|
|
698
|
+
h ? /* @__PURE__ */ C("div", {
|
|
647
699
|
className: "cursor-time",
|
|
648
700
|
style: { left: `clamp(calc(3 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(3 * var(--mp-unit))))` },
|
|
649
701
|
children: k
|
|
650
702
|
}) : void 0,
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ C("div", { className: "progress" }),
|
|
704
|
+
/* @__PURE__ */ C("div", {
|
|
653
705
|
className: "loaded",
|
|
654
706
|
children: O
|
|
655
707
|
}),
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ C("div", { className: "hover" }),
|
|
709
|
+
/* @__PURE__ */ C("div", {
|
|
658
710
|
className: "play-container",
|
|
659
|
-
children: /* @__PURE__ */
|
|
711
|
+
children: /* @__PURE__ */ C("div", {
|
|
660
712
|
className: "play",
|
|
661
713
|
style: { transform: `scaleX(${A})` }
|
|
662
714
|
})
|
|
663
715
|
}),
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ C("div", { className: "chapters" }),
|
|
717
|
+
/* @__PURE__ */ C("div", { className: "scrubber" }),
|
|
718
|
+
/* @__PURE__ */ C("div", {
|
|
667
719
|
className: "padding",
|
|
668
720
|
...y,
|
|
669
721
|
onPointerDown: b,
|
|
670
722
|
onPointerUp: x,
|
|
671
723
|
onPointerCancel: x
|
|
672
724
|
}),
|
|
673
|
-
/* @__PURE__ */
|
|
725
|
+
/* @__PURE__ */ C("div", {
|
|
674
726
|
className: "thumbnail",
|
|
675
727
|
style: { left: `clamp(var(--thumbnail-half), ${D(h ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
676
|
-
children: j?.url ? /* @__PURE__ */
|
|
728
|
+
children: j?.url ? /* @__PURE__ */ C("img", { src: j.url }) : void 0
|
|
677
729
|
})
|
|
678
730
|
]
|
|
679
731
|
});
|
|
680
|
-
},
|
|
732
|
+
}, Ee = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e", Y = {
|
|
681
733
|
xmlns: "http://www.w3.org/2000/svg",
|
|
682
734
|
width: 24,
|
|
683
735
|
height: 24,
|
|
@@ -687,22 +739,22 @@ var re = {
|
|
|
687
739
|
strokeWidth: 2,
|
|
688
740
|
strokeLinecap: "round",
|
|
689
741
|
strokeLinejoin: "round"
|
|
690
|
-
},
|
|
691
|
-
...
|
|
742
|
+
}, De = (e) => /* @__PURE__ */ w("svg", {
|
|
743
|
+
...Y,
|
|
692
744
|
...e,
|
|
693
|
-
children: [/* @__PURE__ */
|
|
745
|
+
children: [/* @__PURE__ */ C("rect", {
|
|
694
746
|
x: "3",
|
|
695
747
|
y: "5",
|
|
696
748
|
width: "18",
|
|
697
749
|
height: "14",
|
|
698
750
|
rx: "2",
|
|
699
751
|
ry: "2"
|
|
700
|
-
}), /* @__PURE__ */
|
|
701
|
-
}),
|
|
702
|
-
...
|
|
752
|
+
}), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
|
|
753
|
+
}), Oe = (e) => /* @__PURE__ */ w("svg", {
|
|
754
|
+
...Y,
|
|
703
755
|
...e,
|
|
704
756
|
children: [
|
|
705
|
-
/* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ C("rect", {
|
|
706
758
|
x: "3",
|
|
707
759
|
y: "5",
|
|
708
760
|
width: "18",
|
|
@@ -710,20 +762,20 @@ var re = {
|
|
|
710
762
|
rx: "2",
|
|
711
763
|
ry: "2"
|
|
712
764
|
}),
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
765
|
+
/* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
|
|
766
|
+
/* @__PURE__ */ C("line", {
|
|
715
767
|
x1: "2",
|
|
716
768
|
y1: "2",
|
|
717
769
|
x2: "22",
|
|
718
770
|
y2: "22"
|
|
719
771
|
})
|
|
720
772
|
]
|
|
721
|
-
}),
|
|
722
|
-
...
|
|
773
|
+
}), ke = (e) => /* @__PURE__ */ w("svg", {
|
|
774
|
+
...Y,
|
|
723
775
|
...e,
|
|
724
776
|
children: [
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
778
|
+
/* @__PURE__ */ C("rect", {
|
|
727
779
|
x: "12",
|
|
728
780
|
y: "13",
|
|
729
781
|
width: "10",
|
|
@@ -731,97 +783,9 @@ var re = {
|
|
|
731
783
|
rx: "1",
|
|
732
784
|
ry: "1"
|
|
733
785
|
}),
|
|
734
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
735
787
|
]
|
|
736
|
-
}),
|
|
737
|
-
display: flex;
|
|
738
|
-
align-items: center;
|
|
739
|
-
justify-content: center;
|
|
740
|
-
flex-direction: column;
|
|
741
|
-
width: 100%;
|
|
742
|
-
|
|
743
|
-
.playback-slider {
|
|
744
|
-
display: flex;
|
|
745
|
-
align-items: center;
|
|
746
|
-
|
|
747
|
-
padding: 8px 4px;
|
|
748
|
-
margin: 0 2px;
|
|
749
|
-
/* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
|
|
750
|
-
@media (pointer: coarse) {
|
|
751
|
-
padding: 20px 8px;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
cursor: pointer;
|
|
755
|
-
|
|
756
|
-
> div {
|
|
757
|
-
position: relative;
|
|
758
|
-
|
|
759
|
-
background: #ccc;
|
|
760
|
-
border-radius: 4px;
|
|
761
|
-
|
|
762
|
-
width: 120px;
|
|
763
|
-
max-width: 100%;
|
|
764
|
-
height: 3px;
|
|
765
|
-
@media (min-width: 768px) {
|
|
766
|
-
height: 4px;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
.playback-handle {
|
|
771
|
-
position: absolute;
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
background: #ffffff;
|
|
775
|
-
border-radius: 50%;
|
|
776
|
-
transform: translateX(-50%);
|
|
777
|
-
pointer-events: none;
|
|
778
|
-
|
|
779
|
-
width: 10px;
|
|
780
|
-
height: 10px;
|
|
781
|
-
top: -3.5px;
|
|
782
|
-
@media (min-width: 768px) {
|
|
783
|
-
width: 12px;
|
|
784
|
-
height: 12px;
|
|
785
|
-
top: -4px;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
`, we = () => {
|
|
790
|
-
let e = F(), t = F((e) => e.playbackRate), n = f(null), r = f(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: d } = q({
|
|
791
|
-
ref: r,
|
|
792
|
-
onChange: (t) => e.setPlaybackRate(l(t))
|
|
793
|
-
}), p = (t) => {
|
|
794
|
-
t.preventDefault();
|
|
795
|
-
let n = .05, r = s;
|
|
796
|
-
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
797
|
-
};
|
|
798
|
-
u(() => {
|
|
799
|
-
let e = n.current;
|
|
800
|
-
return e && e.addEventListener("wheel", p, { passive: !1 }), () => {
|
|
801
|
-
e && e.removeEventListener("wheel", p);
|
|
802
|
-
};
|
|
803
|
-
}, [t]);
|
|
804
|
-
let m = c(s);
|
|
805
|
-
return /* @__PURE__ */ C("div", {
|
|
806
|
-
css: Ce,
|
|
807
|
-
children: [/* @__PURE__ */ C("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ S("div", {
|
|
808
|
-
className: "playback-slider",
|
|
809
|
-
ref: n,
|
|
810
|
-
...d,
|
|
811
|
-
children: /* @__PURE__ */ S("div", {
|
|
812
|
-
ref: r,
|
|
813
|
-
style: { background: `linear-gradient(to right,
|
|
814
|
-
#fff 0% ${m}%,
|
|
815
|
-
#3A3A3A ${m}% 100%
|
|
816
|
-
)` },
|
|
817
|
-
children: /* @__PURE__ */ S("div", {
|
|
818
|
-
className: "playback-handle",
|
|
819
|
-
style: { left: `${m}%` }
|
|
820
|
-
})
|
|
821
|
-
})
|
|
822
|
-
})]
|
|
823
|
-
});
|
|
824
|
-
}, Y = m`
|
|
788
|
+
}), X = h`
|
|
825
789
|
.popover {
|
|
826
790
|
position: absolute;
|
|
827
791
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -860,7 +824,7 @@ width: 100%;
|
|
|
860
824
|
|
|
861
825
|
border-radius: 8px;
|
|
862
826
|
background-color: rgba(28,28,28,0.95);
|
|
863
|
-
${
|
|
827
|
+
${V.bMedium.regular}
|
|
864
828
|
|
|
865
829
|
z-index: 4;
|
|
866
830
|
|
|
@@ -889,10 +853,10 @@ width: 100%;
|
|
|
889
853
|
:last-of-type {
|
|
890
854
|
border-radius: 0 0 8px 8px;
|
|
891
855
|
}
|
|
892
|
-
|
|
856
|
+
&:not(.no-hover) {
|
|
893
857
|
cursor: pointer;
|
|
894
858
|
}
|
|
895
|
-
|
|
859
|
+
&:not(.no-hover):hover {
|
|
896
860
|
background-color: rgba(255,255,255,.1);
|
|
897
861
|
}
|
|
898
862
|
|
|
@@ -903,7 +867,7 @@ width: 100%;
|
|
|
903
867
|
|
|
904
868
|
.secondary {
|
|
905
869
|
color: #eee;
|
|
906
|
-
${
|
|
870
|
+
${V.bSmall.regular}
|
|
907
871
|
}
|
|
908
872
|
}
|
|
909
873
|
}
|
|
@@ -945,29 +909,29 @@ width: 100%;
|
|
|
945
909
|
.failed {
|
|
946
910
|
border-bottom: 1px solid #4D4D4E;
|
|
947
911
|
color: #f66;
|
|
948
|
-
${
|
|
912
|
+
${V.bSmall.regular}
|
|
949
913
|
}
|
|
950
914
|
}
|
|
951
|
-
`,
|
|
915
|
+
`, Ae = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
952
916
|
let c = o !== void 0, l = (e, i, a) => {
|
|
953
917
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
954
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ w("div", {
|
|
955
919
|
onClick: () => {
|
|
956
920
|
l || r(e ?? void 0);
|
|
957
921
|
},
|
|
958
922
|
className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
959
|
-
children: [/* @__PURE__ */
|
|
923
|
+
children: [/* @__PURE__ */ C("span", { children: i }), /* @__PURE__ */ C("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
960
924
|
}, e ?? "__off__");
|
|
961
925
|
};
|
|
962
|
-
return /* @__PURE__ */
|
|
926
|
+
return /* @__PURE__ */ w("div", {
|
|
963
927
|
className: "popover track-list",
|
|
964
928
|
children: [
|
|
965
|
-
/* @__PURE__ */
|
|
929
|
+
/* @__PURE__ */ w("div", {
|
|
966
930
|
className: i ? "back" : "back no-hover",
|
|
967
931
|
onClick: i,
|
|
968
|
-
children: [i ? /* @__PURE__ */
|
|
932
|
+
children: [i ? /* @__PURE__ */ C(D, {}) : null, /* @__PURE__ */ C("span", { children: e })]
|
|
969
933
|
}),
|
|
970
|
-
s ? /* @__PURE__ */
|
|
934
|
+
s ? /* @__PURE__ */ C("div", {
|
|
971
935
|
className: "no-hover failed",
|
|
972
936
|
children: "Could not switch. Try again."
|
|
973
937
|
}) : null,
|
|
@@ -976,12 +940,12 @@ width: 100%;
|
|
|
976
940
|
]
|
|
977
941
|
});
|
|
978
942
|
}, Z = ({ onReset: e } = {}) => {
|
|
979
|
-
let t =
|
|
943
|
+
let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
|
|
980
944
|
c.current = e;
|
|
981
945
|
let l = () => {
|
|
982
946
|
r(!1), c.current?.();
|
|
983
947
|
};
|
|
984
|
-
return
|
|
948
|
+
return d(() => {
|
|
985
949
|
let e = (e) => {
|
|
986
950
|
n && t.current && !t.current.contains(e.target) && l();
|
|
987
951
|
};
|
|
@@ -1016,7 +980,241 @@ width: 100%;
|
|
|
1016
980
|
});
|
|
1017
981
|
}
|
|
1018
982
|
};
|
|
1019
|
-
},
|
|
983
|
+
}, je = h`
|
|
984
|
+
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
985
|
+
which is the width of the player box, so it can be clamped to it. */
|
|
986
|
+
position: static;
|
|
987
|
+
|
|
988
|
+
.errors {
|
|
989
|
+
/* the icon keeps its size, the pressable box grows around it */
|
|
990
|
+
@media (pointer: coarse) {
|
|
991
|
+
box-sizing: border-box;
|
|
992
|
+
justify-content: center;
|
|
993
|
+
|
|
994
|
+
min-width: 44px;
|
|
995
|
+
min-height: 44px;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
${X}
|
|
1000
|
+
|
|
1001
|
+
.popover.error-list {
|
|
1002
|
+
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
1003
|
+
decoder message that has been ellipsized is not worth copying. */
|
|
1004
|
+
width: 420px;
|
|
1005
|
+
max-height: min(300px, calc(100cqh - 100% - 16px));
|
|
1006
|
+
|
|
1007
|
+
/* track-menu's header is a left-aligned label row; here it carries a control too, so the two
|
|
1008
|
+
ends go to the two ends */
|
|
1009
|
+
.back {
|
|
1010
|
+
justify-content: space-between;
|
|
1011
|
+
gap: 8px;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
.copy {
|
|
1015
|
+
/* sits in the header row, which track-menu styles as .back */
|
|
1016
|
+
display: flex;
|
|
1017
|
+
align-items: center;
|
|
1018
|
+
gap: 6px;
|
|
1019
|
+
|
|
1020
|
+
background: none;
|
|
1021
|
+
border: none;
|
|
1022
|
+
padding: 4px 6px;
|
|
1023
|
+
border-radius: 4px;
|
|
1024
|
+
|
|
1025
|
+
color: #fff;
|
|
1026
|
+
cursor: pointer;
|
|
1027
|
+
${V.bSmall.regular}
|
|
1028
|
+
|
|
1029
|
+
&:hover {
|
|
1030
|
+
background-color: rgba(255,255,255,.1);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
svg {
|
|
1034
|
+
width: 14px;
|
|
1035
|
+
height: 14px;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
.entry {
|
|
1040
|
+
/* one failure is a block of text, so it stacks instead of sitting on one line */
|
|
1041
|
+
display: flex;
|
|
1042
|
+
flex-direction: column;
|
|
1043
|
+
align-items: flex-start;
|
|
1044
|
+
gap: 2px;
|
|
1045
|
+
|
|
1046
|
+
.when {
|
|
1047
|
+
color: #bbb;
|
|
1048
|
+
${V.bSmall.regular}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.what {
|
|
1052
|
+
/* the decoder's own words, which are long and must not be cut */
|
|
1053
|
+
overflow-wrap: anywhere;
|
|
1054
|
+
white-space: pre-wrap;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
.cause {
|
|
1058
|
+
color: #ddd;
|
|
1059
|
+
overflow-wrap: anywhere;
|
|
1060
|
+
white-space: pre-wrap;
|
|
1061
|
+
${V.bSmall.regular}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
`, Me = (e) => new Date(e).toLocaleTimeString(), Q = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : K(Math.max(0, e)), Ne = (e) => e.map((e, t) => {
|
|
1066
|
+
let n = Q(e.atMediaTime);
|
|
1067
|
+
return [
|
|
1068
|
+
`${t + 1}. ${new Date(e.at).toISOString()}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1069
|
+
e.message,
|
|
1070
|
+
e.detail
|
|
1071
|
+
].filter(Boolean).join("\n");
|
|
1072
|
+
}).join("\n\n"), Pe = () => {
|
|
1073
|
+
let e = L((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
|
|
1074
|
+
if (e.length === 0) return null;
|
|
1075
|
+
let o = () => {
|
|
1076
|
+
navigator.clipboard?.writeText(Ne(e)).then(() => {
|
|
1077
|
+
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1078
|
+
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1079
|
+
}, s = `Playback errors (${e.length})`;
|
|
1080
|
+
return /* @__PURE__ */ w("div", {
|
|
1081
|
+
css: je,
|
|
1082
|
+
ref: r,
|
|
1083
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1084
|
+
id: "errors",
|
|
1085
|
+
disabled: t,
|
|
1086
|
+
text: /* @__PURE__ */ C("button", {
|
|
1087
|
+
className: "errors",
|
|
1088
|
+
type: "button",
|
|
1089
|
+
onClick: n,
|
|
1090
|
+
"aria-label": s,
|
|
1091
|
+
"aria-expanded": t,
|
|
1092
|
+
children: /* @__PURE__ */ C(T, { className: "alert-triangle" })
|
|
1093
|
+
}),
|
|
1094
|
+
toolTipText: /* @__PURE__ */ C("span", { children: s })
|
|
1095
|
+
}), t && /* @__PURE__ */ w("div", {
|
|
1096
|
+
className: "popover error-list",
|
|
1097
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1098
|
+
className: "back no-hover",
|
|
1099
|
+
children: [/* @__PURE__ */ C("span", { children: s }), /* @__PURE__ */ w("button", {
|
|
1100
|
+
className: "copy",
|
|
1101
|
+
type: "button",
|
|
1102
|
+
onClick: o,
|
|
1103
|
+
"aria-label": "Copy the errors",
|
|
1104
|
+
children: [C(i ? E : k, {}), /* @__PURE__ */ C("span", { children: i ? "Copied" : "Copy" })]
|
|
1105
|
+
})]
|
|
1106
|
+
}), e.map((e, t) => /* @__PURE__ */ w("div", {
|
|
1107
|
+
className: "entry no-hover",
|
|
1108
|
+
children: [
|
|
1109
|
+
/* @__PURE__ */ w("span", {
|
|
1110
|
+
className: "when",
|
|
1111
|
+
children: [
|
|
1112
|
+
Me(e.at),
|
|
1113
|
+
Q(e.atMediaTime) ? ` at ${Q(e.atMediaTime)}` : "",
|
|
1114
|
+
e.recovered ? " recovered" : ""
|
|
1115
|
+
]
|
|
1116
|
+
}),
|
|
1117
|
+
/* @__PURE__ */ C("span", {
|
|
1118
|
+
className: "what",
|
|
1119
|
+
children: e.message
|
|
1120
|
+
}),
|
|
1121
|
+
e.detail ? /* @__PURE__ */ C("span", {
|
|
1122
|
+
className: "cause",
|
|
1123
|
+
children: e.detail
|
|
1124
|
+
}) : null
|
|
1125
|
+
]
|
|
1126
|
+
}, `${e.at}-${t}`))]
|
|
1127
|
+
})]
|
|
1128
|
+
});
|
|
1129
|
+
}, Fe = h`
|
|
1130
|
+
display: flex;
|
|
1131
|
+
align-items: center;
|
|
1132
|
+
justify-content: center;
|
|
1133
|
+
flex-direction: column;
|
|
1134
|
+
width: 100%;
|
|
1135
|
+
|
|
1136
|
+
.playback-slider {
|
|
1137
|
+
display: flex;
|
|
1138
|
+
align-items: center;
|
|
1139
|
+
|
|
1140
|
+
padding: 8px 4px;
|
|
1141
|
+
margin: 0 2px;
|
|
1142
|
+
/* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
|
|
1143
|
+
@media (pointer: coarse) {
|
|
1144
|
+
padding: 20px 8px;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
cursor: pointer;
|
|
1148
|
+
|
|
1149
|
+
> div {
|
|
1150
|
+
position: relative;
|
|
1151
|
+
|
|
1152
|
+
background: #ccc;
|
|
1153
|
+
border-radius: 4px;
|
|
1154
|
+
|
|
1155
|
+
width: 120px;
|
|
1156
|
+
max-width: 100%;
|
|
1157
|
+
height: 3px;
|
|
1158
|
+
@media (min-width: 768px) {
|
|
1159
|
+
height: 4px;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.playback-handle {
|
|
1164
|
+
position: absolute;
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
background: #ffffff;
|
|
1168
|
+
border-radius: 50%;
|
|
1169
|
+
transform: translateX(-50%);
|
|
1170
|
+
pointer-events: none;
|
|
1171
|
+
|
|
1172
|
+
width: 10px;
|
|
1173
|
+
height: 10px;
|
|
1174
|
+
top: -3.5px;
|
|
1175
|
+
@media (min-width: 768px) {
|
|
1176
|
+
width: 12px;
|
|
1177
|
+
height: 12px;
|
|
1178
|
+
top: -4px;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
`, Ie = () => {
|
|
1183
|
+
let e = L(), t = L((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = J({
|
|
1184
|
+
ref: r,
|
|
1185
|
+
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1186
|
+
}), f = (t) => {
|
|
1187
|
+
t.preventDefault();
|
|
1188
|
+
let n = .05, r = s;
|
|
1189
|
+
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
1190
|
+
};
|
|
1191
|
+
d(() => {
|
|
1192
|
+
let e = n.current;
|
|
1193
|
+
return e && e.addEventListener("wheel", f, { passive: !1 }), () => {
|
|
1194
|
+
e && e.removeEventListener("wheel", f);
|
|
1195
|
+
};
|
|
1196
|
+
}, [t]);
|
|
1197
|
+
let m = c(s);
|
|
1198
|
+
return /* @__PURE__ */ w("div", {
|
|
1199
|
+
css: Fe,
|
|
1200
|
+
children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
|
|
1201
|
+
className: "playback-slider",
|
|
1202
|
+
ref: n,
|
|
1203
|
+
...u,
|
|
1204
|
+
children: /* @__PURE__ */ C("div", {
|
|
1205
|
+
ref: r,
|
|
1206
|
+
style: { background: `linear-gradient(to right,
|
|
1207
|
+
#fff 0% ${m}%,
|
|
1208
|
+
#3A3A3A ${m}% 100%
|
|
1209
|
+
)` },
|
|
1210
|
+
children: /* @__PURE__ */ C("div", {
|
|
1211
|
+
className: "playback-handle",
|
|
1212
|
+
style: { left: `${m}%` }
|
|
1213
|
+
})
|
|
1214
|
+
})
|
|
1215
|
+
})]
|
|
1216
|
+
});
|
|
1217
|
+
}, Le = h`
|
|
1020
1218
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1021
1219
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1022
1220
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1034,7 +1232,7 @@ position: static;
|
|
|
1034
1232
|
}
|
|
1035
1233
|
}
|
|
1036
1234
|
|
|
1037
|
-
${
|
|
1235
|
+
${X}
|
|
1038
1236
|
|
|
1039
1237
|
.playback-rate {
|
|
1040
1238
|
.slider {
|
|
@@ -1075,80 +1273,80 @@ ${Y}
|
|
|
1075
1273
|
}
|
|
1076
1274
|
}
|
|
1077
1275
|
|
|
1078
|
-
`,
|
|
1079
|
-
let e =
|
|
1276
|
+
`, Re = () => {
|
|
1277
|
+
let e = L(), t = L((e) => e.playbackRate), n = L((e) => e.audioTracks), r = L((e) => e.selectedAudioTrack), i = L((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = Z({ onReset: () => o(0) }), p = (t) => {
|
|
1080
1278
|
e.setPlaybackRate(t), o(0);
|
|
1081
1279
|
}, h = (e) => {
|
|
1082
1280
|
e !== void 0 && f(e, () => i(e));
|
|
1083
1281
|
}, g = (e) => () => {
|
|
1084
1282
|
o(e);
|
|
1085
1283
|
};
|
|
1086
|
-
return /* @__PURE__ */
|
|
1087
|
-
css:
|
|
1284
|
+
return /* @__PURE__ */ w("div", {
|
|
1285
|
+
css: Le,
|
|
1088
1286
|
ref: l,
|
|
1089
1287
|
children: [
|
|
1090
|
-
/* @__PURE__ */
|
|
1288
|
+
/* @__PURE__ */ C(q, {
|
|
1091
1289
|
id: "settings",
|
|
1092
1290
|
disabled: s,
|
|
1093
|
-
text: /* @__PURE__ */
|
|
1291
|
+
text: /* @__PURE__ */ C("button", {
|
|
1094
1292
|
className: "settings",
|
|
1095
1293
|
type: "button",
|
|
1096
1294
|
onClick: c,
|
|
1097
1295
|
"aria-label": "Settings",
|
|
1098
1296
|
"aria-expanded": s,
|
|
1099
|
-
children: /* @__PURE__ */
|
|
1297
|
+
children: /* @__PURE__ */ C(ee, {})
|
|
1100
1298
|
}),
|
|
1101
|
-
toolTipText: /* @__PURE__ */
|
|
1299
|
+
toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
|
|
1102
1300
|
}),
|
|
1103
|
-
s && a === 0 && /* @__PURE__ */
|
|
1301
|
+
s && a === 0 && /* @__PURE__ */ w("div", {
|
|
1104
1302
|
className: "popover menu",
|
|
1105
|
-
children: [n.length > 1 ? /* @__PURE__ */
|
|
1303
|
+
children: [n.length > 1 ? /* @__PURE__ */ w("div", {
|
|
1106
1304
|
onClick: g(2),
|
|
1107
|
-
children: [/* @__PURE__ */
|
|
1108
|
-
}) : null, /* @__PURE__ */
|
|
1305
|
+
children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(O, {}) })]
|
|
1306
|
+
}) : null, /* @__PURE__ */ w("div", {
|
|
1109
1307
|
onClick: g(1),
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1308
|
+
children: [/* @__PURE__ */ C("div", { children: "Playback speed" }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("span", {
|
|
1111
1309
|
className: "secondary",
|
|
1112
1310
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
1113
|
-
}), /* @__PURE__ */
|
|
1311
|
+
}), /* @__PURE__ */ C(O, {})] })]
|
|
1114
1312
|
})]
|
|
1115
1313
|
}),
|
|
1116
|
-
s && a === 1 && /* @__PURE__ */
|
|
1314
|
+
s && a === 1 && /* @__PURE__ */ w("div", {
|
|
1117
1315
|
className: "popover playback-rate",
|
|
1118
1316
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1317
|
+
/* @__PURE__ */ w("div", {
|
|
1120
1318
|
className: "back",
|
|
1121
1319
|
onClick: g(0),
|
|
1122
|
-
children: [/* @__PURE__ */
|
|
1320
|
+
children: [/* @__PURE__ */ C(D, {}), /* @__PURE__ */ C("span", { children: "Playback speed" })]
|
|
1123
1321
|
}),
|
|
1124
|
-
/* @__PURE__ */
|
|
1322
|
+
/* @__PURE__ */ C("div", {
|
|
1125
1323
|
className: "slider no-hover",
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1324
|
+
children: /* @__PURE__ */ C(Ie, {})
|
|
1127
1325
|
}),
|
|
1128
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ w("div", {
|
|
1129
1327
|
className: "options no-hover",
|
|
1130
1328
|
children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
onClick: () =>
|
|
1329
|
+
/* @__PURE__ */ C("div", {
|
|
1330
|
+
onClick: () => p(.5),
|
|
1133
1331
|
children: "0.5x"
|
|
1134
1332
|
}),
|
|
1135
|
-
/* @__PURE__ */
|
|
1136
|
-
onClick: () =>
|
|
1333
|
+
/* @__PURE__ */ C("div", {
|
|
1334
|
+
onClick: () => p(1),
|
|
1137
1335
|
children: "1x"
|
|
1138
1336
|
}),
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
onClick: () =>
|
|
1337
|
+
/* @__PURE__ */ C("div", {
|
|
1338
|
+
onClick: () => p(1.5),
|
|
1141
1339
|
children: "1.5x"
|
|
1142
1340
|
}),
|
|
1143
|
-
/* @__PURE__ */
|
|
1144
|
-
onClick: () =>
|
|
1341
|
+
/* @__PURE__ */ C("div", {
|
|
1342
|
+
onClick: () => p(2),
|
|
1145
1343
|
children: "2x"
|
|
1146
1344
|
})
|
|
1147
1345
|
]
|
|
1148
1346
|
})
|
|
1149
1347
|
]
|
|
1150
1348
|
}),
|
|
1151
|
-
s && a === 2 && /* @__PURE__ */
|
|
1349
|
+
s && a === 2 && /* @__PURE__ */ C(Ae, {
|
|
1152
1350
|
title: "Audio",
|
|
1153
1351
|
tracks: n,
|
|
1154
1352
|
selected: r,
|
|
@@ -1159,7 +1357,7 @@ ${Y}
|
|
|
1159
1357
|
})
|
|
1160
1358
|
]
|
|
1161
1359
|
});
|
|
1162
|
-
},
|
|
1360
|
+
}, ze = h`
|
|
1163
1361
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1164
1362
|
which is the width of the player box, so it can be clamped to it. */
|
|
1165
1363
|
position: static;
|
|
@@ -1175,28 +1373,28 @@ position: static;
|
|
|
1175
1373
|
}
|
|
1176
1374
|
}
|
|
1177
1375
|
|
|
1178
|
-
${
|
|
1179
|
-
`,
|
|
1180
|
-
let e =
|
|
1376
|
+
${X}
|
|
1377
|
+
`, Be = () => {
|
|
1378
|
+
let e = L((e) => e.subtitleTracks), t = L((e) => e.selectedSubtitleTrack), n = L((e) => e.selectSubtitleTrack), r = L((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
|
|
1181
1379
|
if (e.length === 0) return null;
|
|
1182
1380
|
let u = t !== void 0;
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
css:
|
|
1381
|
+
return /* @__PURE__ */ w("div", {
|
|
1382
|
+
css: ze,
|
|
1185
1383
|
ref: o,
|
|
1186
|
-
children: [/* @__PURE__ */
|
|
1384
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1187
1385
|
id: "subtitles",
|
|
1188
1386
|
disabled: i,
|
|
1189
|
-
text: /* @__PURE__ */
|
|
1387
|
+
text: /* @__PURE__ */ C("button", {
|
|
1190
1388
|
className: "subtitles",
|
|
1191
1389
|
type: "button",
|
|
1192
1390
|
onClick: a,
|
|
1193
1391
|
"aria-label": "Subtitles",
|
|
1194
1392
|
"aria-expanded": i,
|
|
1195
1393
|
"aria-pressed": u,
|
|
1196
|
-
children: u ? /* @__PURE__ */
|
|
1394
|
+
children: u ? /* @__PURE__ */ C(De, { className: "captions" }) : /* @__PURE__ */ C(Oe, { className: "captions-off" })
|
|
1197
1395
|
}),
|
|
1198
|
-
toolTipText: /* @__PURE__ */
|
|
1199
|
-
}), i && /* @__PURE__ */
|
|
1396
|
+
toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
|
|
1397
|
+
}), i && /* @__PURE__ */ C(Ae, {
|
|
1200
1398
|
title: "Subtitles",
|
|
1201
1399
|
tracks: e,
|
|
1202
1400
|
selected: t,
|
|
@@ -1206,14 +1404,14 @@ ${Y}
|
|
|
1206
1404
|
failed: c
|
|
1207
1405
|
})]
|
|
1208
1406
|
});
|
|
1209
|
-
},
|
|
1407
|
+
}, Ve = {
|
|
1210
1408
|
primary: "#EAEBEE",
|
|
1211
1409
|
secondary: "#D0D0D9",
|
|
1212
1410
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1213
1411
|
accent: "#6EA8FE",
|
|
1214
1412
|
borderPrimary: "#384F70",
|
|
1215
1413
|
backgroundTooltip: "#222222"
|
|
1216
|
-
},
|
|
1414
|
+
}, He = h`
|
|
1217
1415
|
display: flex;
|
|
1218
1416
|
align-items: center;
|
|
1219
1417
|
|
|
@@ -1256,8 +1454,8 @@ ${Y}
|
|
|
1256
1454
|
width: 10px;
|
|
1257
1455
|
height: 10px;
|
|
1258
1456
|
}
|
|
1259
|
-
`,
|
|
1260
|
-
let n =
|
|
1457
|
+
`, Ue = ({ value: e, onChange: t }) => {
|
|
1458
|
+
let n = L((e) => e.volume), r = L((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
|
|
1261
1459
|
ref: a,
|
|
1262
1460
|
onChange: t
|
|
1263
1461
|
}), s = (n) => {
|
|
@@ -1265,37 +1463,37 @@ ${Y}
|
|
|
1265
1463
|
let r = .05, i = e;
|
|
1266
1464
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
1267
1465
|
};
|
|
1268
|
-
|
|
1466
|
+
d(() => {
|
|
1269
1467
|
let e = i.current;
|
|
1270
1468
|
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
1271
1469
|
e && e.removeEventListener("wheel", s);
|
|
1272
1470
|
};
|
|
1273
1471
|
}, [e]);
|
|
1274
|
-
let c = e * 100, l =
|
|
1275
|
-
return /* @__PURE__ */
|
|
1472
|
+
let c = e * 100, l = f(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
|
|
1473
|
+
return /* @__PURE__ */ C(q, {
|
|
1276
1474
|
id: "volume-slider",
|
|
1277
|
-
text: /* @__PURE__ */
|
|
1475
|
+
text: /* @__PURE__ */ C("div", {
|
|
1278
1476
|
ref: i,
|
|
1279
|
-
css:
|
|
1477
|
+
css: He,
|
|
1280
1478
|
...o,
|
|
1281
|
-
children: /* @__PURE__ */
|
|
1479
|
+
children: /* @__PURE__ */ C("div", {
|
|
1282
1480
|
ref: a,
|
|
1283
1481
|
style: { background: `linear-gradient(to right,
|
|
1284
1482
|
#fff 0% ${c}%,
|
|
1285
1483
|
#3A3A3A ${c}% 100%
|
|
1286
1484
|
)` },
|
|
1287
|
-
children: /* @__PURE__ */
|
|
1485
|
+
children: /* @__PURE__ */ C("div", {
|
|
1288
1486
|
className: "volume-handle",
|
|
1289
1487
|
style: { left: `${e * 100}%` }
|
|
1290
1488
|
})
|
|
1291
1489
|
})
|
|
1292
1490
|
}),
|
|
1293
|
-
toolTipText: /* @__PURE__ */
|
|
1491
|
+
toolTipText: /* @__PURE__ */ w("div", {
|
|
1294
1492
|
className: "volume-value",
|
|
1295
1493
|
children: [l, "%"]
|
|
1296
1494
|
})
|
|
1297
1495
|
});
|
|
1298
|
-
},
|
|
1496
|
+
}, We = h`
|
|
1299
1497
|
position: relative;
|
|
1300
1498
|
display: flex;
|
|
1301
1499
|
align-items: center;
|
|
@@ -1320,7 +1518,7 @@ ${Y}
|
|
|
1320
1518
|
border-radius: 4px;
|
|
1321
1519
|
|
|
1322
1520
|
.volume-value {
|
|
1323
|
-
${
|
|
1521
|
+
${V.bMedium.regular};
|
|
1324
1522
|
color: #ffffff;
|
|
1325
1523
|
}
|
|
1326
1524
|
}
|
|
@@ -1358,39 +1556,39 @@ ${Y}
|
|
|
1358
1556
|
}
|
|
1359
1557
|
}
|
|
1360
1558
|
|
|
1361
|
-
`,
|
|
1362
|
-
let t =
|
|
1363
|
-
return /* @__PURE__ */
|
|
1364
|
-
css:
|
|
1365
|
-
children: [/* @__PURE__ */
|
|
1559
|
+
`, Ge = ({ ref: e }) => {
|
|
1560
|
+
let t = L(), n = L((e) => e.volume), r = L((e) => e.muted), i = f(() => G(n), [n]);
|
|
1561
|
+
return /* @__PURE__ */ w("div", {
|
|
1562
|
+
css: We,
|
|
1563
|
+
children: [/* @__PURE__ */ C(q, {
|
|
1366
1564
|
id: "sound",
|
|
1367
|
-
text: /* @__PURE__ */
|
|
1565
|
+
text: /* @__PURE__ */ C("button", {
|
|
1368
1566
|
className: "sound",
|
|
1369
1567
|
type: "button",
|
|
1370
1568
|
onClick: () => t.toggleMuted(),
|
|
1371
1569
|
ref: e,
|
|
1372
1570
|
"aria-label": "Mute",
|
|
1373
1571
|
"aria-pressed": r || n === 0,
|
|
1374
|
-
children:
|
|
1572
|
+
children: C(r || n === 0 ? re : n <= .5 ? te : ne, {
|
|
1375
1573
|
size: 18,
|
|
1376
1574
|
color: "#fff"
|
|
1377
1575
|
})
|
|
1378
1576
|
}),
|
|
1379
|
-
toolTipText: /* @__PURE__ */
|
|
1380
|
-
}), /* @__PURE__ */
|
|
1577
|
+
toolTipText: /* @__PURE__ */ C("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
1578
|
+
}), /* @__PURE__ */ C("div", {
|
|
1381
1579
|
className: "volume-slider-container",
|
|
1382
|
-
children: /* @__PURE__ */
|
|
1580
|
+
children: /* @__PURE__ */ C("div", {
|
|
1383
1581
|
className: "volume-slider-background",
|
|
1384
|
-
children: /* @__PURE__ */
|
|
1582
|
+
children: /* @__PURE__ */ C(Ue, {
|
|
1385
1583
|
value: r ? 0 : i,
|
|
1386
1584
|
onChange: (e) => {
|
|
1387
|
-
t.setVolume(
|
|
1585
|
+
t.setVolume(W(e));
|
|
1388
1586
|
}
|
|
1389
1587
|
})
|
|
1390
1588
|
})
|
|
1391
1589
|
})]
|
|
1392
1590
|
});
|
|
1393
|
-
}, $ = .05,
|
|
1591
|
+
}, $ = .05, Ke = 5, qe = h`
|
|
1394
1592
|
display: flex;
|
|
1395
1593
|
flex-direction: column;
|
|
1396
1594
|
gap: calc(0.4 * var(--mp-unit));
|
|
@@ -1401,7 +1599,7 @@ ${Y}
|
|
|
1401
1599
|
opacity: 0.72;
|
|
1402
1600
|
font-size: 0.9em;
|
|
1403
1601
|
}
|
|
1404
|
-
`,
|
|
1602
|
+
`, Je = h`
|
|
1405
1603
|
position: absolute;
|
|
1406
1604
|
bottom: 0;
|
|
1407
1605
|
width: 100%;
|
|
@@ -1466,10 +1664,10 @@ ${Y}
|
|
|
1466
1664
|
* drawn in the hover colour is invisible exactly when it is being looked for.
|
|
1467
1665
|
*/
|
|
1468
1666
|
button[aria-pressed='true'] svg {
|
|
1469
|
-
stroke: ${
|
|
1667
|
+
stroke: ${Ve.accent};
|
|
1470
1668
|
}
|
|
1471
1669
|
|
|
1472
|
-
.play, .sound, .time, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1670
|
+
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1473
1671
|
display: flex;
|
|
1474
1672
|
align-items: center;
|
|
1475
1673
|
|
|
@@ -1487,7 +1685,7 @@ ${Y}
|
|
|
1487
1685
|
}
|
|
1488
1686
|
}
|
|
1489
1687
|
|
|
1490
|
-
.play, .sound, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1688
|
+
.play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
1491
1689
|
border-radius: 4px;
|
|
1492
1690
|
|
|
1493
1691
|
padding: 8px;
|
|
@@ -1501,7 +1699,7 @@ ${Y}
|
|
|
1501
1699
|
cursor: pointer;
|
|
1502
1700
|
|
|
1503
1701
|
:hover {
|
|
1504
|
-
background-color: ${
|
|
1702
|
+
background-color: ${Ve.hover};
|
|
1505
1703
|
}
|
|
1506
1704
|
|
|
1507
1705
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -1518,7 +1716,7 @@ ${Y}
|
|
|
1518
1716
|
|
|
1519
1717
|
.left {
|
|
1520
1718
|
.time {
|
|
1521
|
-
${
|
|
1719
|
+
${V.bMedium.regular}
|
|
1522
1720
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1523
1721
|
}
|
|
1524
1722
|
}
|
|
@@ -1539,12 +1737,12 @@ ${Y}
|
|
|
1539
1737
|
}
|
|
1540
1738
|
}
|
|
1541
1739
|
}
|
|
1542
|
-
`,
|
|
1543
|
-
let e =
|
|
1544
|
-
let r =
|
|
1545
|
-
e.setVolume(
|
|
1740
|
+
`, Ye = () => {
|
|
1741
|
+
let e = L(), t = L((e) => e.paused), n = L((e) => e.currentTime), r = L((e) => e.duration), i = L((e) => e.fullscreen), a = L((e) => e.hideUI), o = L((e) => e.togglePictureInPicture), s = L((e) => e.pictureInPictureMode), c = L((e) => e.burnedInSubtitles), l = L((e) => e.subtitleTracks), [f, p] = m(null), h = s === "burn-in", g = l.length > 0, _ = r > 0 && n === r, v = u(({ direction: t, stepSize: n }) => {
|
|
1742
|
+
let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
|
|
1743
|
+
e.setVolume(W(a)), o && !e.muted && e.toggleMuted();
|
|
1546
1744
|
}, [e]);
|
|
1547
|
-
|
|
1745
|
+
d(() => {
|
|
1548
1746
|
let t = (t) => {
|
|
1549
1747
|
let n = t.target;
|
|
1550
1748
|
if (n?.isContentEditable || /^(input|textarea|select)$/i.test(n?.tagName ?? "")) return;
|
|
@@ -1563,13 +1761,13 @@ ${Y}
|
|
|
1563
1761
|
});
|
|
1564
1762
|
else if (t.key === "ArrowRight") {
|
|
1565
1763
|
if (!e.duration) return;
|
|
1566
|
-
e.seek(Math.min(e.currentTime +
|
|
1567
|
-
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime -
|
|
1764
|
+
e.seek(Math.min(e.currentTime + Ke, e.duration));
|
|
1765
|
+
} else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Ke, 0)) : r = !1;
|
|
1568
1766
|
r && t.preventDefault();
|
|
1569
1767
|
};
|
|
1570
1768
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1571
1769
|
}, [e, v]);
|
|
1572
|
-
let y =
|
|
1770
|
+
let y = u((e) => {
|
|
1573
1771
|
e.preventDefault(), e.deltaY < 0 ? v({
|
|
1574
1772
|
direction: "up",
|
|
1575
1773
|
stepSize: $
|
|
@@ -1578,86 +1776,87 @@ ${Y}
|
|
|
1578
1776
|
stepSize: $
|
|
1579
1777
|
});
|
|
1580
1778
|
}, [v]);
|
|
1581
|
-
return
|
|
1779
|
+
return d(() => {
|
|
1582
1780
|
if (f) return f.addEventListener("wheel", y, { passive: !1 }), () => f.removeEventListener("wheel", y);
|
|
1583
|
-
}, [f, y]), /* @__PURE__ */
|
|
1584
|
-
css:
|
|
1781
|
+
}, [f, y]), /* @__PURE__ */ w("div", {
|
|
1782
|
+
css: Je,
|
|
1585
1783
|
style: { ...a ? {
|
|
1586
1784
|
opacity: "0",
|
|
1587
1785
|
pointerEvents: "none"
|
|
1588
1786
|
} : {} },
|
|
1589
|
-
children: [/* @__PURE__ */
|
|
1787
|
+
children: [/* @__PURE__ */ C(Te, {}), /* @__PURE__ */ w("div", {
|
|
1590
1788
|
className: "actions",
|
|
1591
|
-
children: [/* @__PURE__ */
|
|
1789
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1592
1790
|
className: "left",
|
|
1593
1791
|
children: [
|
|
1594
|
-
/* @__PURE__ */
|
|
1792
|
+
/* @__PURE__ */ C(q, {
|
|
1595
1793
|
id: "play",
|
|
1596
1794
|
tooltipPlace: "top-start",
|
|
1597
|
-
text: /* @__PURE__ */
|
|
1795
|
+
text: /* @__PURE__ */ C("button", {
|
|
1598
1796
|
className: "play",
|
|
1599
1797
|
type: "button",
|
|
1600
1798
|
onClick: () => e.togglePaused(),
|
|
1601
1799
|
"aria-label": _ ? "Replay" : t ? "Play" : "Pause",
|
|
1602
|
-
children:
|
|
1800
|
+
children: C(_ ? P : t ? N : M, {})
|
|
1603
1801
|
}),
|
|
1604
|
-
toolTipText: /* @__PURE__ */
|
|
1802
|
+
toolTipText: /* @__PURE__ */ C("span", { children: _ ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
|
|
1605
1803
|
}),
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ C(Ge, { ref: p }),
|
|
1805
|
+
/* @__PURE__ */ C("div", {
|
|
1608
1806
|
className: "time",
|
|
1609
|
-
children:
|
|
1807
|
+
children: Se(n, r)
|
|
1610
1808
|
})
|
|
1611
1809
|
]
|
|
1612
|
-
}), /* @__PURE__ */
|
|
1810
|
+
}), /* @__PURE__ */ w("div", {
|
|
1613
1811
|
className: "right",
|
|
1614
1812
|
children: [
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
|
|
1813
|
+
/* @__PURE__ */ C(Pe, {}),
|
|
1814
|
+
/* @__PURE__ */ C(Be, {}),
|
|
1815
|
+
/* @__PURE__ */ C(Re, {}),
|
|
1816
|
+
o ? /* @__PURE__ */ C(q, {
|
|
1618
1817
|
id: "picture-in-picture",
|
|
1619
1818
|
tooltipPlace: "top-end",
|
|
1620
|
-
text: /* @__PURE__ */
|
|
1819
|
+
text: /* @__PURE__ */ C("button", {
|
|
1621
1820
|
className: "picture-in-picture",
|
|
1622
1821
|
type: "button",
|
|
1623
1822
|
onClick: o,
|
|
1624
1823
|
disabled: h && !g,
|
|
1625
1824
|
"aria-label": h ? "Put the subtitles in the video" : "Picture in picture",
|
|
1626
1825
|
"aria-pressed": h ? c : void 0,
|
|
1627
|
-
children: h ? /* @__PURE__ */
|
|
1628
|
-
src:
|
|
1826
|
+
children: h ? /* @__PURE__ */ C(ke, {}) : /* @__PURE__ */ C("img", {
|
|
1827
|
+
src: Ee,
|
|
1629
1828
|
alt: ""
|
|
1630
1829
|
})
|
|
1631
1830
|
}),
|
|
1632
|
-
toolTipText: /* @__PURE__ */
|
|
1633
|
-
css:
|
|
1634
|
-
children: [/* @__PURE__ */
|
|
1831
|
+
toolTipText: /* @__PURE__ */ w("span", {
|
|
1832
|
+
css: qe,
|
|
1833
|
+
children: [/* @__PURE__ */ C("span", {
|
|
1635
1834
|
className: "lead",
|
|
1636
1835
|
children: h ? g ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
|
|
1637
|
-
}), h && g ? /* @__PURE__ */
|
|
1836
|
+
}), h && g ? /* @__PURE__ */ C("span", {
|
|
1638
1837
|
className: "hint",
|
|
1639
1838
|
children: "Then hover the video and click your browser's own pop out button"
|
|
1640
1839
|
}) : null]
|
|
1641
1840
|
})
|
|
1642
1841
|
}) : null,
|
|
1643
|
-
/* @__PURE__ */
|
|
1842
|
+
/* @__PURE__ */ C(q, {
|
|
1644
1843
|
id: "full-screen",
|
|
1645
1844
|
tooltipPlace: "top-end",
|
|
1646
|
-
text: /* @__PURE__ */
|
|
1845
|
+
text: /* @__PURE__ */ C("button", {
|
|
1647
1846
|
className: "full-screen",
|
|
1648
1847
|
type: "button",
|
|
1649
1848
|
onClick: () => e.toggleFullscreen(),
|
|
1650
1849
|
"aria-label": "Full screen",
|
|
1651
1850
|
"aria-pressed": i,
|
|
1652
|
-
children:
|
|
1851
|
+
children: C(i ? j : A, {})
|
|
1653
1852
|
}),
|
|
1654
|
-
toolTipText: /* @__PURE__ */
|
|
1853
|
+
toolTipText: /* @__PURE__ */ C("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
|
|
1655
1854
|
})
|
|
1656
1855
|
]
|
|
1657
1856
|
})]
|
|
1658
1857
|
})]
|
|
1659
1858
|
});
|
|
1660
|
-
},
|
|
1859
|
+
}, Xe = 9e3, Ze = h`
|
|
1661
1860
|
position: absolute;
|
|
1662
1861
|
inset: 0;
|
|
1663
1862
|
z-index: 2;
|
|
@@ -1695,12 +1894,12 @@ ${Y}
|
|
|
1695
1894
|
}
|
|
1696
1895
|
|
|
1697
1896
|
.title {
|
|
1698
|
-
${
|
|
1897
|
+
${V.bMedium.bold}
|
|
1699
1898
|
color: #fff;
|
|
1700
1899
|
}
|
|
1701
1900
|
|
|
1702
1901
|
.body {
|
|
1703
|
-
${
|
|
1902
|
+
${V.bSmall.regular}
|
|
1704
1903
|
color: rgba(255, 255, 255, 0.75);
|
|
1705
1904
|
}
|
|
1706
1905
|
|
|
@@ -1711,39 +1910,39 @@ ${Y}
|
|
|
1711
1910
|
line-height: 1;
|
|
1712
1911
|
color: #6EA8FE;
|
|
1713
1912
|
}
|
|
1714
|
-
`,
|
|
1715
|
-
let e =
|
|
1716
|
-
return
|
|
1913
|
+
`, Qe = () => {
|
|
1914
|
+
let e = L((e) => e.burnedInSubtitles), t = L((e) => e.pictureInPictureMode), [n, r] = m(!1);
|
|
1915
|
+
return d(() => {
|
|
1717
1916
|
if (t !== "burn-in" || !e) {
|
|
1718
1917
|
r(!1);
|
|
1719
1918
|
return;
|
|
1720
1919
|
}
|
|
1721
1920
|
r(!0);
|
|
1722
|
-
let n = setTimeout(() => r(!1),
|
|
1921
|
+
let n = setTimeout(() => r(!1), Xe);
|
|
1723
1922
|
return () => clearTimeout(n);
|
|
1724
|
-
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */
|
|
1725
|
-
css:
|
|
1923
|
+
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
|
|
1924
|
+
css: Ze,
|
|
1726
1925
|
className: n ? "show" : "",
|
|
1727
1926
|
role: "status",
|
|
1728
|
-
children: /* @__PURE__ */
|
|
1927
|
+
children: /* @__PURE__ */ w("div", {
|
|
1729
1928
|
className: "card",
|
|
1730
|
-
children: [/* @__PURE__ */
|
|
1929
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1731
1930
|
className: "words",
|
|
1732
|
-
children: [/* @__PURE__ */
|
|
1931
|
+
children: [/* @__PURE__ */ C("div", {
|
|
1733
1932
|
className: "title",
|
|
1734
1933
|
children: "Subtitles are in the picture"
|
|
1735
|
-
}), /* @__PURE__ */
|
|
1934
|
+
}), /* @__PURE__ */ C("div", {
|
|
1736
1935
|
className: "body",
|
|
1737
1936
|
children: "Now hover the video and click your browser's own pop out button"
|
|
1738
1937
|
})]
|
|
1739
|
-
}), /* @__PURE__ */
|
|
1938
|
+
}), /* @__PURE__ */ C("div", {
|
|
1740
1939
|
className: "arrow",
|
|
1741
1940
|
"aria-hidden": "true",
|
|
1742
1941
|
children: "→"
|
|
1743
1942
|
})]
|
|
1744
1943
|
})
|
|
1745
1944
|
});
|
|
1746
|
-
},
|
|
1945
|
+
}, $e = 3e3, et = h`
|
|
1747
1946
|
position: absolute;
|
|
1748
1947
|
inset: 0;
|
|
1749
1948
|
z-index: 2;
|
|
@@ -1754,7 +1953,7 @@ ${Y}
|
|
|
1754
1953
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
1755
1954
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
1756
1955
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
1757
|
-
`,
|
|
1956
|
+
`, tt = h`
|
|
1758
1957
|
position: relative;
|
|
1759
1958
|
background-color: black;
|
|
1760
1959
|
display: flex;
|
|
@@ -1786,26 +1985,26 @@ ${Y}
|
|
|
1786
1985
|
&.hide {
|
|
1787
1986
|
cursor: none;
|
|
1788
1987
|
}
|
|
1789
|
-
`,
|
|
1790
|
-
let r = `${t}${
|
|
1791
|
-
return
|
|
1988
|
+
`, nt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
|
|
1989
|
+
let r = `${t}${l(e) && e.key != null ? e.key : n}`;
|
|
1990
|
+
return l(e) && e.type === c ? nt(e.props.children, `${r}/`) : [{
|
|
1792
1991
|
key: r,
|
|
1793
1992
|
item: e
|
|
1794
1993
|
}];
|
|
1795
|
-
}),
|
|
1796
|
-
let o =
|
|
1797
|
-
|
|
1798
|
-
let
|
|
1799
|
-
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0),
|
|
1994
|
+
}), rt = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
|
|
1995
|
+
let o = L(), s = L((e) => e.hideUI), c = L((e) => e.setHideUI), l = p(void 0), u = p("mouse");
|
|
1996
|
+
d(() => () => clearTimeout(l.current), []);
|
|
1997
|
+
let f = () => {
|
|
1998
|
+
c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), $e);
|
|
1800
1999
|
};
|
|
1801
|
-
return /* @__PURE__ */
|
|
1802
|
-
css:
|
|
2000
|
+
return /* @__PURE__ */ w("div", {
|
|
2001
|
+
css: tt,
|
|
1803
2002
|
ref: e,
|
|
1804
2003
|
onPointerMove: (e) => {
|
|
1805
|
-
|
|
2004
|
+
u.current = e.pointerType, e.pointerType === "mouse" && f();
|
|
1806
2005
|
},
|
|
1807
2006
|
onPointerDown: (e) => {
|
|
1808
|
-
|
|
2007
|
+
u.current = e.pointerType;
|
|
1809
2008
|
},
|
|
1810
2009
|
onMouseOut: (e) => {
|
|
1811
2010
|
let t = e.relatedTarget;
|
|
@@ -1815,9 +2014,9 @@ ${Y}
|
|
|
1815
2014
|
},
|
|
1816
2015
|
className: s ? "hide" : "",
|
|
1817
2016
|
children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
|
|
1820
|
-
css:
|
|
2017
|
+
/* @__PURE__ */ C(xe, { onCanvasRef: n }),
|
|
2018
|
+
nt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
|
|
2019
|
+
css: et,
|
|
1821
2020
|
style: { ...s ? {
|
|
1822
2021
|
opacity: "0",
|
|
1823
2022
|
visibility: "hidden",
|
|
@@ -1825,35 +2024,35 @@ ${Y}
|
|
|
1825
2024
|
} : {} },
|
|
1826
2025
|
children: t
|
|
1827
2026
|
}, e)),
|
|
1828
|
-
i === !1 ? null : /* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
2027
|
+
i === !1 ? null : /* @__PURE__ */ C(Ye, {}),
|
|
2028
|
+
/* @__PURE__ */ C(Qe, {}),
|
|
2029
|
+
/* @__PURE__ */ w("div", {
|
|
1831
2030
|
className: "video",
|
|
1832
2031
|
onClick: () => {
|
|
1833
|
-
if (
|
|
2032
|
+
if (u.current === "mouse") {
|
|
1834
2033
|
o.togglePaused();
|
|
1835
2034
|
return;
|
|
1836
2035
|
}
|
|
1837
|
-
s ?
|
|
2036
|
+
s ? f() : (clearTimeout(l.current), c(!0));
|
|
1838
2037
|
},
|
|
1839
|
-
children: [t ? /* @__PURE__ */
|
|
2038
|
+
children: [t ? /* @__PURE__ */ C("video", {
|
|
1840
2039
|
ref: t,
|
|
1841
2040
|
playsInline: !0
|
|
1842
2041
|
}) : null, a]
|
|
1843
2042
|
})
|
|
1844
2043
|
]
|
|
1845
2044
|
});
|
|
1846
|
-
},
|
|
1847
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: l, thumbnailRead:
|
|
1848
|
-
|
|
1849
|
-
let w =
|
|
2045
|
+
}, it = ({ options: e, children: t }) => {
|
|
2046
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: l, thumbnailRead: u, thumbnailsEnabled: f } = r ?? {}, p = y(), h = v(), [g, _] = m(null), [b, x] = m(null), S = n?.media ?? g;
|
|
2047
|
+
d(() => (p?.(S), () => p?.(null)), [S, p]), pe(g, b, r);
|
|
2048
|
+
let w = z({
|
|
1850
2049
|
publicPath: s,
|
|
1851
2050
|
workerUrl: c,
|
|
1852
2051
|
length: f === !1 ? void 0 : a,
|
|
1853
|
-
read:
|
|
2052
|
+
read: u ?? l,
|
|
1854
2053
|
downloadedRanges: o
|
|
1855
|
-
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } =
|
|
1856
|
-
|
|
2054
|
+
}), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = B(g, b), k = L((e) => e.setSourceState);
|
|
2055
|
+
d(() => {
|
|
1857
2056
|
k({
|
|
1858
2057
|
title: i,
|
|
1859
2058
|
size: a,
|
|
@@ -1866,7 +2065,7 @@ ${Y}
|
|
|
1866
2065
|
o
|
|
1867
2066
|
]);
|
|
1868
2067
|
let A = n?.thumbnails?.at;
|
|
1869
|
-
|
|
2068
|
+
d(() => {
|
|
1870
2069
|
k({
|
|
1871
2070
|
thumbnails: T,
|
|
1872
2071
|
thumbnailAt: A,
|
|
@@ -1883,7 +2082,7 @@ ${Y}
|
|
|
1883
2082
|
O
|
|
1884
2083
|
]);
|
|
1885
2084
|
let j = n?.subtitles?.selection, M = n?.audioTracks?.selection;
|
|
1886
|
-
return
|
|
2085
|
+
return d(() => {
|
|
1887
2086
|
j && k({
|
|
1888
2087
|
subtitleTracks: j.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
1889
2088
|
id: e,
|
|
@@ -1894,7 +2093,7 @@ ${Y}
|
|
|
1894
2093
|
selectSubtitleTrack: (e) => j.select(e == null ? null : String(e)),
|
|
1895
2094
|
subtitleOffLabel: j.offLabel
|
|
1896
2095
|
});
|
|
1897
|
-
}, [k, j]),
|
|
2096
|
+
}, [k, j]), d(() => {
|
|
1898
2097
|
M && k({
|
|
1899
2098
|
audioTracks: M.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
1900
2099
|
id: e,
|
|
@@ -1904,15 +2103,15 @@ ${Y}
|
|
|
1904
2103
|
selectedAudioTrack: M.selectedId ?? void 0,
|
|
1905
2104
|
selectAudioTrack: (e) => M.select(String(e))
|
|
1906
2105
|
});
|
|
1907
|
-
}, [k, M]), /* @__PURE__ */
|
|
2106
|
+
}, [k, M]), /* @__PURE__ */ C(rt, {
|
|
1908
2107
|
ref: h,
|
|
1909
|
-
onVideoRef: n ? void 0 :
|
|
2108
|
+
onVideoRef: n ? void 0 : _,
|
|
1910
2109
|
onCanvasRef: x,
|
|
1911
2110
|
overlay: e.overlay,
|
|
1912
2111
|
controls: e.controls,
|
|
1913
2112
|
children: t
|
|
1914
2113
|
});
|
|
1915
|
-
},
|
|
2114
|
+
}, at = h`
|
|
1916
2115
|
/**
|
|
1917
2116
|
* The chrome's whole scale, in one place.
|
|
1918
2117
|
*
|
|
@@ -1982,17 +2181,17 @@ ${Y}
|
|
|
1982
2181
|
height: 100%;
|
|
1983
2182
|
width: 100%;
|
|
1984
2183
|
overflow: hidden;
|
|
1985
|
-
`,
|
|
1986
|
-
css:
|
|
1987
|
-
children: /* @__PURE__ */
|
|
2184
|
+
`, ot = (e) => /* @__PURE__ */ C("div", {
|
|
2185
|
+
css: at,
|
|
2186
|
+
children: /* @__PURE__ */ C(I.Provider, { children: /* @__PURE__ */ C(it, {
|
|
1988
2187
|
options: e,
|
|
1989
2188
|
children: e.children
|
|
1990
2189
|
}) })
|
|
1991
|
-
}),
|
|
2190
|
+
}), st = (e) => !!e && typeof e == "object" && "at" in e, ct = (e) => !!e && typeof e == "object" && "selection" in e, lt = ({ blob: e, name: t }) => ({
|
|
1992
2191
|
length: e.size,
|
|
1993
2192
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
1994
2193
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
1995
|
-
}),
|
|
2194
|
+
}), ut = async (e, t) => {
|
|
1996
2195
|
let n = await fetch(e, {
|
|
1997
2196
|
headers: { Range: "bytes=0-1" },
|
|
1998
2197
|
credentials: t
|
|
@@ -2002,8 +2201,8 @@ ${Y}
|
|
|
2002
2201
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2003
2202
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2004
2203
|
return i;
|
|
2005
|
-
},
|
|
2006
|
-
let i = t ?? await
|
|
2204
|
+
}, dt = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
2205
|
+
let i = t ?? await ut(e, r);
|
|
2007
2206
|
return {
|
|
2008
2207
|
length: i,
|
|
2009
2208
|
name: n,
|
|
@@ -2016,9 +2215,9 @@ ${Y}
|
|
|
2016
2215
|
return a.arrayBuffer();
|
|
2017
2216
|
}
|
|
2018
2217
|
};
|
|
2019
|
-
},
|
|
2020
|
-
if ("blob" in e) return
|
|
2021
|
-
if ("url" in e) return
|
|
2218
|
+
}, ft = async (e) => {
|
|
2219
|
+
if ("blob" in e) return lt(e);
|
|
2220
|
+
if ("url" in e) return dt(e);
|
|
2022
2221
|
if ("read" in e) return {
|
|
2023
2222
|
length: e.length,
|
|
2024
2223
|
name: e.name,
|
|
@@ -2027,4 +2226,4 @@ ${Y}
|
|
|
2027
2226
|
throw Error(`Unknown source type: ${e}`);
|
|
2028
2227
|
};
|
|
2029
2228
|
//#endregion
|
|
2030
|
-
export {
|
|
2229
|
+
export { ot as MediaPlayer, ot as default, I as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, ft as inputToRemuxerInput, ct as isDelegatedTracks, st as isExternalThumbnails, F as sourceFeature, i as startPlayback, B as usePictureInPicture, L as usePlayer, z as useSeekThumbnails };
|