@banou/media-player 0.10.21 → 0.10.24
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/README.md +10 -3
- package/dist/audio/loudness-analysis.d.ts +9 -1
- package/dist/audio/playback-tap.d.ts +11 -0
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/playback.d.ts +21 -0
- package/dist/{engine-C4Gj_4zs.js → engine-BdouHadr.js} +124 -107
- package/dist/index.d.ts +1 -1
- package/dist/index.js +612 -492
- package/dist/react/hooks/use-frame-step.d.ts +14 -0
- package/dist/react/hooks/use-playback.d.ts +2 -1
- package/dist/react/hooks/use-volume-normalizer.d.ts +6 -2
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +4 -0
- package/dist/react/video-player.d.ts +10 -2
- package/dist/utils/source.d.ts +6 -1
- package/dist/volume-normalizer-worklet.js +14 -4
- package/package.json +5 -5
- package/src/lib/audio/loudness-analysis.ts +50 -17
- package/src/lib/audio/playback-tap.ts +37 -0
- package/src/lib/audio/volume-normalizer-worklet.js +14 -4
- package/src/lib/engine/index.ts +1 -1
- package/src/lib/engine/playback.ts +37 -8
- package/src/lib/engine/subtitles.ts +11 -7
- package/src/lib/index.tsx +1 -0
- package/src/lib/react/components/control-bar.tsx +6 -1
- package/src/lib/react/hooks/use-frame-step.ts +109 -0
- package/src/lib/react/hooks/use-playback.ts +5 -1
- package/src/lib/react/hooks/use-volume-normalizer.ts +7 -4
- package/src/lib/react/source-feature.ts +3 -0
- package/src/lib/react/video-player.tsx +28 -14
- package/src/lib/utils/source.ts +6 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t, n, o as r, r as i, s as a, t as o, u as s } from "./engine-
|
|
1
|
+
import { c as e, l as t, n, o as r, r as i, s as a, t as o, u as s } from "./engine-BdouHadr.js";
|
|
2
2
|
import { Children as c, Fragment as l, isValidElement as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
3
3
|
import { css as _, keyframes as v } from "@emotion/react";
|
|
4
4
|
import { createPlayer as y, useContainerAttach as b, useMediaAttach as x } from "@videojs/react";
|
|
@@ -7,9 +7,9 @@ import { makeRemuxer as w } from "libav-wasm";
|
|
|
7
7
|
import { createMediaElementSource as T } from "@banou/ponyfill/web-audio";
|
|
8
8
|
import { Fragment as E, jsx as D, jsxs as O } from "@emotion/react/jsx-runtime";
|
|
9
9
|
import { Captions as k, CaptionsOff as A, Check as j, ChevronLeft as M, ChevronRight as N, Copy as P, Maximize as F, Minimize as I, Pause as L, Play as R, RotateCcw as z, Settings as B, TriangleAlert as V, Volume1 as H, Volume2 as ee, VolumeX as te } from "lucide-react";
|
|
10
|
-
import { Tooltip as
|
|
10
|
+
import { Tooltip as ne } from "react-tooltip";
|
|
11
11
|
//#region src/lib/react/source-feature.ts
|
|
12
|
-
var
|
|
12
|
+
var U = {
|
|
13
13
|
indexes: [],
|
|
14
14
|
chapters: [],
|
|
15
15
|
thumbnails: [],
|
|
@@ -34,19 +34,19 @@ var W = {
|
|
|
34
34
|
playbackErrors: [],
|
|
35
35
|
ready: !1,
|
|
36
36
|
setSourceState: () => {}
|
|
37
|
-
},
|
|
37
|
+
}, W = S({
|
|
38
38
|
name: "source",
|
|
39
|
-
state: () => ({ ...
|
|
39
|
+
state: () => ({ ...U }),
|
|
40
40
|
attach({ set: e }) {
|
|
41
41
|
e({
|
|
42
42
|
setSourceState: (t) => e(t),
|
|
43
43
|
setHideUI: (t) => e({ hideUI: t })
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
}),
|
|
47
|
-
features: [...C,
|
|
46
|
+
}), G = y({
|
|
47
|
+
features: [...C, W],
|
|
48
48
|
displayName: "MediaPlayer"
|
|
49
|
-
}),
|
|
49
|
+
}), K = G.usePlayer, re = (e) => {
|
|
50
50
|
if (e && e !== "und") try {
|
|
51
51
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
52
52
|
type: "language",
|
|
@@ -55,28 +55,28 @@ var W = {
|
|
|
55
55
|
} catch {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
},
|
|
59
|
-
let t = e.map((e) =>
|
|
58
|
+
}, ie = (e) => e?.replace(/_/g, " ").trim() || void 0, q = (e) => {
|
|
59
|
+
let t = e.map((e) => re(e.language) ?? ie(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
60
60
|
...e,
|
|
61
61
|
[t]: (e[t] ?? 0) + 1
|
|
62
62
|
}), {});
|
|
63
63
|
return e.map((e, r) => {
|
|
64
|
-
let i = t[r], a =
|
|
64
|
+
let i = t[r], a = ie(e.title);
|
|
65
65
|
return {
|
|
66
66
|
track: e,
|
|
67
67
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
68
68
|
};
|
|
69
69
|
});
|
|
70
|
-
},
|
|
70
|
+
}, J = (e) => q(e).map(({ track: e, label: t }) => ({
|
|
71
71
|
id: e.streamIndex,
|
|
72
72
|
label: t
|
|
73
|
-
})),
|
|
73
|
+
})), Y = [
|
|
74
74
|
0,
|
|
75
75
|
250,
|
|
76
76
|
1e3,
|
|
77
77
|
3e3,
|
|
78
78
|
1e4
|
|
79
|
-
],
|
|
79
|
+
], ae = 6e4, X = 500, oe = 15e3, se = (e) => e instanceof Error ? e.message : String(e), ce = (e) => {
|
|
80
80
|
let t = [], n = e?.cause;
|
|
81
81
|
for (let e = 0; n != null && e < 8; e++) {
|
|
82
82
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
@@ -86,82 +86,84 @@ var W = {
|
|
|
86
86
|
t.push(se(n)), n = n?.cause;
|
|
87
87
|
}
|
|
88
88
|
return t.length ? t.join("\n") : void 0;
|
|
89
|
-
}, le = (e, t, n) => {
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
let [
|
|
89
|
+
}, le = (e, t, n, i) => {
|
|
90
|
+
let o = K(), { read: s, size: c, publicPath: l = "", libavWorkerUrl: u = "", jassubWorkerUrl: p = "", jassubWasmUrl: g = "", jassubLegacyWasmUrl: _, defaultFontUrl: v, bufferSize: y, autoplay: b = !1, chapters: x, seekPrepareBudgetMs: S = X } = n ?? {}, C = m(x);
|
|
91
|
+
C.current = x;
|
|
92
|
+
let [w, T] = h(void 0), [E, D] = h(0), O = m({
|
|
93
93
|
count: 0,
|
|
94
94
|
at: 0
|
|
95
|
-
}),
|
|
96
|
-
f(() => (
|
|
95
|
+
}), k = m(void 0);
|
|
96
|
+
f(() => (O.current = {
|
|
97
97
|
count: 0,
|
|
98
98
|
at: 0
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
}), [
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
let
|
|
107
|
-
|
|
108
|
-
let
|
|
99
|
+
}, o.setSourceState({ playbackErrors: [] }), () => {
|
|
100
|
+
k.current && clearTimeout(k.current);
|
|
101
|
+
}), [c]);
|
|
102
|
+
let A = m(null), j = m(null), M = m(!1), N = m(s);
|
|
103
|
+
N.current = s;
|
|
104
|
+
let P = m(n?.onSeek);
|
|
105
|
+
P.current = n?.onSeek;
|
|
106
|
+
let F = m(n?.onPlaybackError);
|
|
107
|
+
F.current = n?.onPlaybackError;
|
|
108
|
+
let I = m(i);
|
|
109
|
+
I.current = i;
|
|
110
|
+
let L = d((e) => {
|
|
109
111
|
let t = typeof e == "number" ? e : void 0;
|
|
110
|
-
|
|
111
|
-
}, [
|
|
112
|
-
let t =
|
|
113
|
-
if (!t ||
|
|
114
|
-
|
|
112
|
+
M.current = !0, o.setSourceState({ selectedSubtitleTrack: t }), A.current?.selectSubtitleStream(t);
|
|
113
|
+
}, [o]), R = d((e) => {
|
|
114
|
+
let t = A.current;
|
|
115
|
+
if (!t || S <= 0) {
|
|
116
|
+
o.seek(e);
|
|
115
117
|
return;
|
|
116
118
|
}
|
|
117
|
-
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(),
|
|
118
|
-
if (!
|
|
119
|
+
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), i = !1, a = "prepared", s = () => {
|
|
120
|
+
if (!i && (i = !0, o.seek(e), n)) {
|
|
119
121
|
let n = t.videoElement, i = 0;
|
|
120
122
|
if (n) for (let t = 0; t < n.buffered.length; t++) n.buffered.start(t) <= e + 1 && e < n.buffered.end(t) && (i = n.buffered.end(t) - e);
|
|
121
|
-
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${
|
|
123
|
+
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${a}, runway ${i.toFixed(1)}s${a === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
|
-
|
|
126
|
+
o.setSourceState({ seekingTo: e });
|
|
125
127
|
let c = t.videoElement, l = () => {
|
|
126
|
-
c?.removeEventListener("seeked", l), clearTimeout(u),
|
|
128
|
+
c?.removeEventListener("seeked", l), clearTimeout(u), o.setSourceState({ seekingTo: void 0 });
|
|
127
129
|
}, u = setTimeout(l, oe);
|
|
128
130
|
c?.addEventListener("seeked", l);
|
|
129
131
|
let d = setTimeout(() => {
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
+
a = "deadline", s();
|
|
133
|
+
}, S);
|
|
132
134
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
133
135
|
clearTimeout(d), s();
|
|
134
136
|
});
|
|
135
|
-
}, [
|
|
136
|
-
typeof e == "number" && (
|
|
137
|
-
}, [
|
|
137
|
+
}, [o, S]), z = d((e) => {
|
|
138
|
+
typeof e == "number" && (o.setSourceState({ selectedAudioTrack: e }), T(e));
|
|
139
|
+
}, [o]), B = K((e) => e.setSourceState);
|
|
138
140
|
f(() => {
|
|
139
|
-
|
|
140
|
-
selectSubtitleTrack:
|
|
141
|
-
selectAudioTrack:
|
|
142
|
-
requestSeek:
|
|
141
|
+
B({
|
|
142
|
+
selectSubtitleTrack: L,
|
|
143
|
+
selectAudioTrack: z,
|
|
144
|
+
requestSeek: R
|
|
143
145
|
});
|
|
144
146
|
}, [
|
|
145
|
-
|
|
146
|
-
F,
|
|
147
|
+
B,
|
|
147
148
|
L,
|
|
148
|
-
|
|
149
|
+
z,
|
|
150
|
+
R
|
|
149
151
|
]), f(() => {
|
|
150
|
-
if (!e || !t || !
|
|
152
|
+
if (!e || !t || !c || !s) return;
|
|
151
153
|
let n = !1;
|
|
152
|
-
|
|
154
|
+
o.setSourceState({
|
|
153
155
|
playbackError: null,
|
|
154
156
|
ready: !1
|
|
155
157
|
});
|
|
156
|
-
let
|
|
157
|
-
let r = Date.now(),
|
|
158
|
-
if (c && c.message ===
|
|
158
|
+
let i = (t, n) => {
|
|
159
|
+
let r = Date.now(), i = se(t), a = ce(t), s = o.playbackErrors, c = s[s.length - 1];
|
|
160
|
+
if (c && c.message === i && c.detail === a && c.recovered === n) {
|
|
159
161
|
let e = {
|
|
160
162
|
...c,
|
|
161
163
|
count: c.count + 1,
|
|
162
164
|
lastAt: r
|
|
163
165
|
};
|
|
164
|
-
|
|
166
|
+
o.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
|
|
165
167
|
return;
|
|
166
168
|
}
|
|
167
169
|
let l = {
|
|
@@ -169,64 +171,65 @@ var W = {
|
|
|
169
171
|
lastAt: r,
|
|
170
172
|
count: 1,
|
|
171
173
|
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
172
|
-
message:
|
|
173
|
-
detail:
|
|
174
|
+
message: i,
|
|
175
|
+
detail: a,
|
|
174
176
|
recovered: n
|
|
175
177
|
};
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
+
o.setSourceState({ playbackErrors: [...s, l] });
|
|
179
|
+
}, d = (e) => {
|
|
178
180
|
if (n) return;
|
|
179
181
|
let t = r(e);
|
|
180
|
-
if (
|
|
182
|
+
if (i(e, t), t) {
|
|
181
183
|
let t = performance.now();
|
|
182
|
-
t -
|
|
184
|
+
t - O.current.at > ae && (O.current = {
|
|
183
185
|
count: 0,
|
|
184
186
|
at: t
|
|
185
187
|
});
|
|
186
|
-
let n =
|
|
187
|
-
|
|
188
|
-
count:
|
|
188
|
+
let n = Y[Math.min(O.current.count, Y.length - 1)];
|
|
189
|
+
O.current = {
|
|
190
|
+
count: O.current.count + 1,
|
|
189
191
|
at: t
|
|
190
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
192
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), k.current && clearTimeout(k.current), k.current = setTimeout(() => D((e) => e + 1), n);
|
|
191
193
|
return;
|
|
192
194
|
}
|
|
193
|
-
console.error("playback failed", e),
|
|
195
|
+
console.error("playback failed", e), o.setSourceState({ playbackError: e }), F.current?.(e);
|
|
194
196
|
};
|
|
195
197
|
return (async () => {
|
|
196
198
|
try {
|
|
197
199
|
let r = await a({
|
|
198
200
|
videoElement: e,
|
|
199
201
|
subtitleContainer: t,
|
|
200
|
-
read: (e, t) =>
|
|
201
|
-
length:
|
|
202
|
-
publicPath:
|
|
203
|
-
libavWorkerUrl:
|
|
204
|
-
jassubWorkerUrl:
|
|
205
|
-
jassubWasmUrl:
|
|
206
|
-
jassubLegacyWasmUrl:
|
|
207
|
-
defaultFontUrl:
|
|
208
|
-
bufferSize:
|
|
209
|
-
audioStreamIndex:
|
|
202
|
+
read: (e, t) => N.current(e, t),
|
|
203
|
+
length: c,
|
|
204
|
+
publicPath: l,
|
|
205
|
+
libavWorkerUrl: u,
|
|
206
|
+
jassubWorkerUrl: p,
|
|
207
|
+
jassubWasmUrl: g,
|
|
208
|
+
jassubLegacyWasmUrl: _,
|
|
209
|
+
defaultFontUrl: v,
|
|
210
|
+
bufferSize: y,
|
|
211
|
+
audioStreamIndex: w,
|
|
210
212
|
onReady: () => {
|
|
211
213
|
if (n) return;
|
|
212
|
-
|
|
213
|
-
let t =
|
|
214
|
-
|
|
214
|
+
o.setSourceState({ ready: !0 });
|
|
215
|
+
let t = j.current;
|
|
216
|
+
j.current = null, t && t.size === c && t.time > 0 && (e.currentTime = t.time), b && e.play().catch(() => {});
|
|
215
217
|
},
|
|
216
|
-
onError:
|
|
218
|
+
onError: d,
|
|
217
219
|
onRecovered: () => {
|
|
218
|
-
n ||
|
|
220
|
+
n || o.setSourceState({ playbackError: null });
|
|
219
221
|
},
|
|
220
|
-
onSeek: (e) =>
|
|
222
|
+
onSeek: (e) => P.current?.(e),
|
|
223
|
+
onOutput: (e) => I.current?.(e),
|
|
221
224
|
onSubtitleStreams: (e) => {
|
|
222
|
-
n ||
|
|
223
|
-
subtitleTracks:
|
|
224
|
-
...
|
|
225
|
+
n || o.setSourceState({
|
|
226
|
+
subtitleTracks: J(e),
|
|
227
|
+
...M.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
225
228
|
});
|
|
226
229
|
},
|
|
227
230
|
onAudioStreams: (e, t) => {
|
|
228
|
-
n ||
|
|
229
|
-
audioTracks:
|
|
231
|
+
n || o.setSourceState({
|
|
232
|
+
audioTracks: J(e),
|
|
230
233
|
selectedAudioTrack: t
|
|
231
234
|
});
|
|
232
235
|
}
|
|
@@ -235,26 +238,25 @@ var W = {
|
|
|
235
238
|
r.destroy();
|
|
236
239
|
return;
|
|
237
240
|
}
|
|
238
|
-
|
|
241
|
+
A.current = r, o.setSourceState({
|
|
239
242
|
indexes: r.indexes,
|
|
240
|
-
chapters:
|
|
243
|
+
chapters: C.current ?? r.chapters
|
|
241
244
|
});
|
|
242
|
-
let
|
|
243
|
-
typeof
|
|
245
|
+
let i = o.selectedSubtitleTrack;
|
|
246
|
+
typeof i == "number" && r.selectSubtitleStream(i);
|
|
244
247
|
} catch (e) {
|
|
245
|
-
|
|
248
|
+
d(e);
|
|
246
249
|
}
|
|
247
250
|
})(), () => {
|
|
248
|
-
n = !0,
|
|
251
|
+
n = !0, j.current = {
|
|
249
252
|
time: e.currentTime,
|
|
250
|
-
size:
|
|
251
|
-
},
|
|
253
|
+
size: c
|
|
254
|
+
}, A.current?.destroy(), A.current = null, o.setSourceState({ ready: !1 });
|
|
252
255
|
};
|
|
253
256
|
}, [
|
|
254
|
-
|
|
257
|
+
o,
|
|
255
258
|
e,
|
|
256
259
|
t,
|
|
257
|
-
s,
|
|
258
260
|
c,
|
|
259
261
|
l,
|
|
260
262
|
u,
|
|
@@ -262,17 +264,68 @@ var W = {
|
|
|
262
264
|
g,
|
|
263
265
|
_,
|
|
264
266
|
v,
|
|
265
|
-
C,
|
|
266
267
|
y,
|
|
267
|
-
|
|
268
|
+
w,
|
|
269
|
+
b,
|
|
270
|
+
E
|
|
268
271
|
]);
|
|
269
|
-
}, ue =
|
|
272
|
+
}, ue = 1001 / 24e3, de = (e, t) => new Promise((n) => {
|
|
273
|
+
let r = setTimeout(n, t);
|
|
274
|
+
e.requestVideoFrameCallback(() => {
|
|
275
|
+
clearTimeout(r), n();
|
|
276
|
+
});
|
|
277
|
+
}), fe = (e) => {
|
|
278
|
+
let t = K(), n = K((e) => e.setSourceState);
|
|
279
|
+
f(() => {
|
|
280
|
+
let r = e;
|
|
281
|
+
if (!r || typeof r.requestVideoFrameCallback != "function") return;
|
|
282
|
+
let i, a = !1, o = [], s = () => {
|
|
283
|
+
a = !0, i = void 0;
|
|
284
|
+
}, c = () => {
|
|
285
|
+
i = void 0, o.length = 0;
|
|
286
|
+
};
|
|
287
|
+
r.addEventListener("seeking", s), r.addEventListener("emptied", c);
|
|
288
|
+
let l = 0, u = (e, t) => {
|
|
289
|
+
let n = a;
|
|
290
|
+
!r.paused && !r.seeking && (a = !1), !n && !r.paused && r.playbackRate <= 1 && i && t.presentedFrames === i.presentedFrames + 1 && t.mediaTime > i.mediaTime && (o.push(t.mediaTime - i.mediaTime), o.length > 60 && o.shift()), i = n ? void 0 : t, l = r.requestVideoFrameCallback(u);
|
|
291
|
+
};
|
|
292
|
+
l = r.requestVideoFrameCallback(u);
|
|
293
|
+
let d = () => {
|
|
294
|
+
if (o.length < 5) return ue;
|
|
295
|
+
let e = [...o].sort((e, t) => e - t), t = e[e.length >> 1], n = e.filter((e) => Math.abs(e - t) <= t / 4);
|
|
296
|
+
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
297
|
+
}, f = !1;
|
|
298
|
+
return n({ stepFrame: async (e) => {
|
|
299
|
+
if (!f) {
|
|
300
|
+
f = !0;
|
|
301
|
+
try {
|
|
302
|
+
r.paused || (r.pause(), await de(r, 100));
|
|
303
|
+
let n = d(), a = t.state.seekingTo, o = a === void 0 ? i ? i.mediaTime + (e > 0 ? 1.5 : -.5) * n : r.currentTime + e * n : a + e * n, s = Math.max(0, Math.min(o, r.duration || o)), c = new Promise((e) => {
|
|
304
|
+
let t = setTimeout(e, 1e3);
|
|
305
|
+
r.addEventListener("seeked", () => {
|
|
306
|
+
clearTimeout(t), e();
|
|
307
|
+
}, { once: !0 });
|
|
308
|
+
}), { requestSeek: l } = t.state;
|
|
309
|
+
l ? l(s) : r.currentTime = s, await c;
|
|
310
|
+
} finally {
|
|
311
|
+
f = !1;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
} }), () => {
|
|
315
|
+
r.removeEventListener("seeking", s), r.removeEventListener("emptied", c), r.cancelVideoFrameCallback(l), n({ stepFrame: void 0 });
|
|
316
|
+
};
|
|
317
|
+
}, [
|
|
318
|
+
e,
|
|
319
|
+
t,
|
|
320
|
+
n
|
|
321
|
+
]);
|
|
322
|
+
}, pe = 5e3, me = 6e4, he = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
270
323
|
let [o, s] = h([]), c = m(null), l = m(r);
|
|
271
324
|
l.current = r;
|
|
272
325
|
let u = p(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = m(u);
|
|
273
326
|
return g.current = u, f(() => {
|
|
274
327
|
if (!n || !r || !e || !t) return;
|
|
275
|
-
let a = !1, o = null, u, d =
|
|
328
|
+
let a = !1, o = null, u, d = pe, f = () => {
|
|
276
329
|
i({
|
|
277
330
|
publicPath: e,
|
|
278
331
|
workerUrl: t,
|
|
@@ -288,7 +341,7 @@ var W = {
|
|
|
288
341
|
}
|
|
289
342
|
o = e, c.current = e, e.update(g.current);
|
|
290
343
|
}, () => {
|
|
291
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
344
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, me));
|
|
292
345
|
});
|
|
293
346
|
};
|
|
294
347
|
return f(), () => {
|
|
@@ -306,7 +359,7 @@ var W = {
|
|
|
306
359
|
c.current?.prioritize(e);
|
|
307
360
|
}, [])
|
|
308
361
|
};
|
|
309
|
-
},
|
|
362
|
+
}, ge = (e, t) => {
|
|
310
363
|
let r = m(null), [i, a] = h(!1), [s] = h(() => n());
|
|
311
364
|
f(() => {
|
|
312
365
|
if (!e || !t || !s) return;
|
|
@@ -334,10 +387,10 @@ var W = {
|
|
|
334
387
|
mode: s,
|
|
335
388
|
burnedIn: i
|
|
336
389
|
};
|
|
337
|
-
},
|
|
338
|
-
let t =
|
|
390
|
+
}, _e = "(hover: hover) and (pointer: fine)", ve = () => typeof matchMedia == "function" ? matchMedia(_e) : void 0, ye = (e) => {
|
|
391
|
+
let t = ve();
|
|
339
392
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
340
|
-
},
|
|
393
|
+
}, be = () => !!ve()?.matches, xe = () => !1, Se = (e, t) => {
|
|
341
394
|
let [n, r] = h(!1), [i, a] = h(), o = m(t);
|
|
342
395
|
t && (o.current = t);
|
|
343
396
|
let s = m(!1), c = d((e) => {
|
|
@@ -360,7 +413,7 @@ var W = {
|
|
|
360
413
|
_,
|
|
361
414
|
u
|
|
362
415
|
]);
|
|
363
|
-
let v = g(
|
|
416
|
+
let v = g(ye, be, xe), [y, b] = h(!1);
|
|
364
417
|
f(() => {
|
|
365
418
|
if (!_) return;
|
|
366
419
|
let e = (e) => {
|
|
@@ -401,16 +454,16 @@ var W = {
|
|
|
401
454
|
u,
|
|
402
455
|
S
|
|
403
456
|
]);
|
|
404
|
-
},
|
|
457
|
+
}, Ce = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
405
458
|
channelCountMode: "max",
|
|
406
459
|
processorOptions: n
|
|
407
|
-
})),
|
|
460
|
+
})), we = /* @__PURE__ */ new WeakMap(), Te = (e) => new Promise((t, n) => {
|
|
408
461
|
let r = () => {
|
|
409
462
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
410
463
|
};
|
|
411
464
|
e.addEventListener("statechange", r), r();
|
|
412
|
-
}),
|
|
413
|
-
let r =
|
|
465
|
+
}), Ee = (e, t, n = {}) => {
|
|
466
|
+
let r = we.get(e);
|
|
414
467
|
if (r) return r.wake(), r;
|
|
415
468
|
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), l = e.ownerDocument, u = () => {
|
|
416
469
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -426,12 +479,12 @@ var W = {
|
|
|
426
479
|
};
|
|
427
480
|
i.addEventListener("statechange", f), f();
|
|
428
481
|
let p = (async () => {
|
|
429
|
-
let r = await
|
|
482
|
+
let r = await Ce(i, t, {
|
|
430
483
|
...n,
|
|
431
484
|
enabled: a,
|
|
432
485
|
inputGainDb: c()
|
|
433
486
|
});
|
|
434
|
-
await
|
|
487
|
+
await Te(i);
|
|
435
488
|
let s = T(i, e);
|
|
436
489
|
return r.port.postMessage({
|
|
437
490
|
enabled: a,
|
|
@@ -448,60 +501,61 @@ var W = {
|
|
|
448
501
|
a = e, o?.port.postMessage({ enabled: a });
|
|
449
502
|
},
|
|
450
503
|
release: () => {
|
|
451
|
-
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
504
|
+
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (we.delete(e), i.close().catch(() => {}));
|
|
452
505
|
},
|
|
453
506
|
wake: () => {
|
|
454
507
|
i.state !== "closed" && (s = !1, u(), f());
|
|
455
508
|
}
|
|
456
509
|
};
|
|
457
|
-
return
|
|
458
|
-
},
|
|
510
|
+
return we.set(e, m), m;
|
|
511
|
+
}, De = 20, Oe = 5, ke = 1, Ae = 50, je = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
459
512
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
460
513
|
for (let e of [...c]) e();
|
|
461
514
|
c.clear();
|
|
462
|
-
}, u = () => new Promise((e) => c.add(e)), d = (e, t
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
515
|
+
}, u = () => new Promise((e) => c.add(e)), d = async (e, t, n) => {
|
|
516
|
+
let r = Math.min(t + n, e.length);
|
|
517
|
+
for (; o && !o.some(([e, n]) => e <= t && r <= n);) if (a || await new Promise((e) => s.add(e))) throw Error("Cancelled");
|
|
518
|
+
return e.read(t, n);
|
|
519
|
+
}, f = (e) => {
|
|
466
520
|
for (let t of [...s]) t(e);
|
|
467
521
|
s.clear();
|
|
468
|
-
},
|
|
522
|
+
}, p;
|
|
469
523
|
try {
|
|
470
|
-
|
|
524
|
+
p = new Worker(r, { type: "module" });
|
|
471
525
|
} catch (e) {
|
|
472
526
|
return console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), {
|
|
473
527
|
update: () => {},
|
|
474
528
|
stop: () => {}
|
|
475
529
|
};
|
|
476
530
|
}
|
|
477
|
-
let
|
|
478
|
-
|
|
531
|
+
let m = new MessageChannel();
|
|
532
|
+
p.postMessage({
|
|
479
533
|
type: "port",
|
|
480
|
-
port:
|
|
481
|
-
}, [
|
|
482
|
-
let
|
|
534
|
+
port: m.port1
|
|
535
|
+
}, [m.port1]), t.port.postMessage({ analysis: m.port2 }, [m.port2]);
|
|
536
|
+
let h = {
|
|
483
537
|
spans: [],
|
|
484
538
|
end: null
|
|
485
|
-
},
|
|
486
|
-
|
|
539
|
+
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
540
|
+
p.onmessage = ({ data: e }) => {
|
|
487
541
|
if (e.type === "unsupported") {
|
|
488
542
|
U();
|
|
489
543
|
return;
|
|
490
544
|
}
|
|
491
|
-
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(
|
|
545
|
+
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
492
546
|
spans: e.spans,
|
|
493
547
|
end: e.end
|
|
494
|
-
}), e.type === "merged" && (
|
|
548
|
+
}), e.type === "merged" && (y = e.run), _.get(`${e.type}:${e.run}`)?.(h), _.delete(`${e.type}:${e.run}`), l();
|
|
495
549
|
};
|
|
496
|
-
let
|
|
550
|
+
let b = t.context, x = () => t.port.postMessage({
|
|
497
551
|
media: n.currentTime,
|
|
498
|
-
ctx:
|
|
552
|
+
ctx: b.currentTime,
|
|
499
553
|
rate: n.playbackRate,
|
|
500
554
|
paused: n.paused || n.seeking || n.readyState < 3
|
|
501
|
-
}),
|
|
555
|
+
}), S = () => p.postMessage({
|
|
502
556
|
type: "playhead",
|
|
503
557
|
time: n.currentTime
|
|
504
|
-
}),
|
|
558
|
+
}), C = setInterval(x, Ae), T = [
|
|
505
559
|
"play",
|
|
506
560
|
"playing",
|
|
507
561
|
"pause",
|
|
@@ -511,64 +565,64 @@ var W = {
|
|
|
511
565
|
"waiting",
|
|
512
566
|
"ended"
|
|
513
567
|
];
|
|
514
|
-
for (let e of
|
|
515
|
-
let
|
|
568
|
+
for (let e of T) n.addEventListener(e, x);
|
|
569
|
+
let E = Infinity, D = !1, O = 0, k = !1, A = 0, j = 0, M = /* @__PURE__ */ new Map(), N = (e) => {
|
|
516
570
|
let t = e;
|
|
517
|
-
for (let [e, n] of
|
|
518
|
-
return t >= (
|
|
519
|
-
},
|
|
520
|
-
let e = n.currentTime, t =
|
|
521
|
-
if (t !== null && t < e +
|
|
571
|
+
for (let [e, n] of h.spans) e <= t && t < n && (t = n);
|
|
572
|
+
return t >= (h.end ?? E) - .05 ? null : t;
|
|
573
|
+
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
574
|
+
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
575
|
+
if (t !== null && t < e + De) return r && A <= t + 1 && t <= j + Oe ? "read" : P(t);
|
|
522
576
|
if (r) return "read";
|
|
523
|
-
let i = t ??
|
|
524
|
-
return i === null ? "done" :
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
})])),
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
|
|
577
|
+
let i = t ?? N(0);
|
|
578
|
+
return i === null ? "done" : P(i);
|
|
579
|
+
}, I = () => {}, L = (e) => (e.catch(() => {}), Promise.race([e, new Promise((e) => {
|
|
580
|
+
I = () => e(void 0);
|
|
581
|
+
})])), R = () => {
|
|
582
|
+
S(), D && s.size && typeof F() == "number" && I(), l();
|
|
583
|
+
}, z = () => {
|
|
584
|
+
S(), l();
|
|
531
585
|
};
|
|
532
|
-
n.addEventListener("seeking",
|
|
533
|
-
let
|
|
534
|
-
if (!
|
|
535
|
-
|
|
536
|
-
let t =
|
|
537
|
-
|
|
586
|
+
n.addEventListener("seeking", R), n.addEventListener("seeked", z), n.addEventListener("timeupdate", z);
|
|
587
|
+
let B, V = async (e) => {
|
|
588
|
+
if (!k) return;
|
|
589
|
+
k = !1;
|
|
590
|
+
let t = v("ended", O);
|
|
591
|
+
p.postMessage({
|
|
538
592
|
type: "end",
|
|
539
|
-
run:
|
|
593
|
+
run: O,
|
|
540
594
|
finished: e
|
|
541
595
|
}), await t;
|
|
542
|
-
},
|
|
543
|
-
if (
|
|
544
|
-
let t =
|
|
545
|
-
|
|
596
|
+
}, H = async (e) => {
|
|
597
|
+
if (j = e.pts + e.duration, !e.data.byteLength) return;
|
|
598
|
+
let t = v("ack", O);
|
|
599
|
+
p.postMessage({
|
|
546
600
|
type: "fragment",
|
|
547
|
-
run:
|
|
601
|
+
run: O,
|
|
548
602
|
data: e.data
|
|
549
603
|
}, [e.data]), await t;
|
|
550
|
-
},
|
|
551
|
-
if (
|
|
552
|
-
publicPath:
|
|
553
|
-
workerUrl:
|
|
604
|
+
}, ee = async (t) => {
|
|
605
|
+
if (B = await w({
|
|
606
|
+
publicPath: t.publicPath,
|
|
607
|
+
workerUrl: t.libavWorkerUrl,
|
|
554
608
|
workerOptions: { type: "module" },
|
|
555
|
-
length:
|
|
556
|
-
read:
|
|
557
|
-
audioStreamIndex:
|
|
558
|
-
}), a) return e(
|
|
559
|
-
let
|
|
609
|
+
length: t.length,
|
|
610
|
+
read: (e, n) => d(t, e, n),
|
|
611
|
+
audioStreamIndex: t.audioStreamIndex
|
|
612
|
+
}), a) return e(B);
|
|
613
|
+
let n = await B.init();
|
|
560
614
|
if (!a) {
|
|
561
|
-
for (
|
|
615
|
+
for (E = n.info.input.duration || Infinity, p.postMessage({
|
|
562
616
|
type: "init",
|
|
563
|
-
data:
|
|
564
|
-
codec:
|
|
565
|
-
}, [
|
|
617
|
+
data: n.data,
|
|
618
|
+
codec: n.info.output.audioMimeType
|
|
619
|
+
}, [n.data]), k = !0, D = !0, p.postMessage({
|
|
566
620
|
type: "run",
|
|
567
|
-
run:
|
|
621
|
+
run: O,
|
|
568
622
|
pts: 0,
|
|
569
623
|
start: !0
|
|
570
624
|
}); !a;) {
|
|
571
|
-
let e =
|
|
625
|
+
let e = F();
|
|
572
626
|
if (e === "done") break;
|
|
573
627
|
if (e === "idle") {
|
|
574
628
|
await u();
|
|
@@ -576,54 +630,88 @@ var W = {
|
|
|
576
630
|
}
|
|
577
631
|
try {
|
|
578
632
|
if (e === "read") {
|
|
579
|
-
let e = await
|
|
633
|
+
let e = await L(B.read());
|
|
580
634
|
if (a) return;
|
|
581
635
|
if (!e) continue;
|
|
582
|
-
await
|
|
636
|
+
await H(e), e.finished && await V(!0);
|
|
583
637
|
} else {
|
|
584
|
-
await
|
|
585
|
-
let t =
|
|
586
|
-
|
|
587
|
-
let n = await
|
|
638
|
+
await V(!1), M.set(Math.round(e * 10), g);
|
|
639
|
+
let t = B.seek(Math.max(0, e - ke));
|
|
640
|
+
f(!0);
|
|
641
|
+
let n = await L(t);
|
|
588
642
|
if (a) return;
|
|
589
643
|
if (!n) continue;
|
|
590
|
-
|
|
644
|
+
O++, k = !0, A = n.pts, p.postMessage({
|
|
591
645
|
type: "run",
|
|
592
|
-
run:
|
|
646
|
+
run: O,
|
|
593
647
|
pts: n.pts,
|
|
594
648
|
start: n.pts <= 0
|
|
595
|
-
}), await
|
|
649
|
+
}), await H(n), n.finished && await V(!0);
|
|
596
650
|
}
|
|
597
651
|
} catch {
|
|
598
652
|
if (a) return;
|
|
599
|
-
await
|
|
653
|
+
await V(!1), typeof F() != "number" && await u();
|
|
600
654
|
}
|
|
601
655
|
}
|
|
602
|
-
e(
|
|
656
|
+
e(B), B = void 0;
|
|
603
657
|
}
|
|
658
|
+
}, te = () => {}, ne = (e, t) => {
|
|
659
|
+
let n = !1, r = (e) => {
|
|
660
|
+
n && p.postMessage({
|
|
661
|
+
type: "end",
|
|
662
|
+
run: O,
|
|
663
|
+
finished: e
|
|
664
|
+
}), n = !1;
|
|
665
|
+
};
|
|
666
|
+
te = e.attach(t, (e, t) => {
|
|
667
|
+
if (e.type === "init") {
|
|
668
|
+
r(!1);
|
|
669
|
+
let t = e.data.slice(0);
|
|
670
|
+
p.postMessage({
|
|
671
|
+
type: "init",
|
|
672
|
+
data: t,
|
|
673
|
+
codec: e.audioMimeType
|
|
674
|
+
}, [t]);
|
|
675
|
+
} else if (e.type === "run") r(!1), n = !0, p.postMessage({
|
|
676
|
+
type: "run",
|
|
677
|
+
run: ++O,
|
|
678
|
+
pts: e.pts,
|
|
679
|
+
start: !t && e.pts <= 0,
|
|
680
|
+
join: t
|
|
681
|
+
});
|
|
682
|
+
else if (e.type === "end") r(!0);
|
|
683
|
+
else if (n) {
|
|
684
|
+
let t = e.data.slice(0);
|
|
685
|
+
p.postMessage({
|
|
686
|
+
type: "fragment",
|
|
687
|
+
run: O,
|
|
688
|
+
data: t
|
|
689
|
+
}, [t]);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
604
692
|
}, U = () => {
|
|
605
693
|
if (!a) {
|
|
606
|
-
a = !0,
|
|
607
|
-
for (let e of
|
|
608
|
-
n.removeEventListener("seeking",
|
|
609
|
-
for (let e of
|
|
610
|
-
|
|
694
|
+
a = !0, f(!0), l(), clearInterval(C);
|
|
695
|
+
for (let e of T) n.removeEventListener(e, x);
|
|
696
|
+
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z), te(), B && e(B), p.terminate(), t.port.postMessage({ analysis: null });
|
|
697
|
+
for (let e of _.values()) e(h);
|
|
698
|
+
_.clear();
|
|
611
699
|
}
|
|
612
700
|
};
|
|
613
|
-
return
|
|
701
|
+
return "tap" in i ? ne(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
|
|
614
702
|
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), U());
|
|
615
|
-
}),
|
|
703
|
+
}), S(), {
|
|
616
704
|
update: (e) => {
|
|
617
|
-
o = e,
|
|
705
|
+
o = e, f(!1);
|
|
618
706
|
},
|
|
619
707
|
stop: U
|
|
620
708
|
};
|
|
621
|
-
},
|
|
709
|
+
}, Me = (e, t, n, r, i) => {
|
|
622
710
|
let a = m(null), [o, s] = h(!1), [c, l] = h(null);
|
|
623
711
|
f(() => {
|
|
624
712
|
if (e && t) {
|
|
625
713
|
if (n && !a.current) {
|
|
626
|
-
let r =
|
|
714
|
+
let r = Ee(e, t, { enabled: n });
|
|
627
715
|
a.current = r, r.routed.then((e) => {
|
|
628
716
|
a.current === r && l(e);
|
|
629
717
|
}, (e) => {
|
|
@@ -643,11 +731,11 @@ var W = {
|
|
|
643
731
|
u.current = i;
|
|
644
732
|
let d = m(null), p = m(r);
|
|
645
733
|
p.current = r;
|
|
646
|
-
let { length: g, publicPath: _, libavWorkerUrl: v
|
|
734
|
+
let { length: g, publicPath: _, libavWorkerUrl: v } = r && "read" in r ? r : {}, y = r && "tap" in r ? r.tap : void 0, b = r?.audioStreamIndex;
|
|
647
735
|
return f(() => {
|
|
648
736
|
let r = p.current;
|
|
649
737
|
if (!c || !e || !t || !n || !r) return;
|
|
650
|
-
let i =
|
|
738
|
+
let i = je({
|
|
651
739
|
node: c,
|
|
652
740
|
element: e,
|
|
653
741
|
scriptUrl: t,
|
|
@@ -664,10 +752,33 @@ var W = {
|
|
|
664
752
|
g,
|
|
665
753
|
_,
|
|
666
754
|
v,
|
|
755
|
+
b,
|
|
667
756
|
y
|
|
668
757
|
]), f(() => {
|
|
669
758
|
d.current?.update(i);
|
|
670
759
|
}, [i]), { refused: o };
|
|
760
|
+
}, Ne = () => {
|
|
761
|
+
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
762
|
+
return {
|
|
763
|
+
push: (n) => {
|
|
764
|
+
n.type === "init" ? (e = n, t = void 0) : n.type === "run" ? t = {
|
|
765
|
+
pts: n.pts,
|
|
766
|
+
begun: !1
|
|
767
|
+
} : n.type === "fragment" && t && (t.begun = !0), r()?.take(n);
|
|
768
|
+
},
|
|
769
|
+
attach: (i, a) => {
|
|
770
|
+
let o = {
|
|
771
|
+
audioStreamIndex: i,
|
|
772
|
+
take: a
|
|
773
|
+
};
|
|
774
|
+
return n = o, r() && e && (a(e), t && a({
|
|
775
|
+
type: "run",
|
|
776
|
+
pts: t.pts
|
|
777
|
+
}, t.begun)), () => {
|
|
778
|
+
n === o && (n = void 0);
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
};
|
|
671
782
|
}, Z = {
|
|
672
783
|
headings: {
|
|
673
784
|
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 ",
|
|
@@ -695,7 +806,7 @@ var W = {
|
|
|
695
806
|
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 ",
|
|
696
807
|
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 "
|
|
697
808
|
}
|
|
698
|
-
},
|
|
809
|
+
}, Pe = _`
|
|
699
810
|
display: flex;
|
|
700
811
|
justify-content: center;
|
|
701
812
|
align-items: center;
|
|
@@ -708,7 +819,7 @@ var W = {
|
|
|
708
819
|
margin: auto;
|
|
709
820
|
pointer-events: none;
|
|
710
821
|
}
|
|
711
|
-
`,
|
|
822
|
+
`, Fe = _`
|
|
712
823
|
position: absolute;
|
|
713
824
|
top: 0;
|
|
714
825
|
left: 0;
|
|
@@ -737,9 +848,9 @@ var W = {
|
|
|
737
848
|
|
|
738
849
|
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%);
|
|
739
850
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
740
|
-
`,
|
|
851
|
+
`, Ie = v`
|
|
741
852
|
to { transform: rotate(360deg); }
|
|
742
|
-
`,
|
|
853
|
+
`, Le = _`
|
|
743
854
|
position: absolute;
|
|
744
855
|
inset: 0;
|
|
745
856
|
z-index: 2;
|
|
@@ -755,9 +866,9 @@ var W = {
|
|
|
755
866
|
border-radius: 50%;
|
|
756
867
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
757
868
|
border-top-color: #fff;
|
|
758
|
-
animation: ${
|
|
869
|
+
animation: ${Ie} 0.8s linear infinite;
|
|
759
870
|
}
|
|
760
|
-
`,
|
|
871
|
+
`, Re = _`
|
|
761
872
|
position: absolute;
|
|
762
873
|
inset: auto 0 20%;
|
|
763
874
|
z-index: 3;
|
|
@@ -767,34 +878,34 @@ var W = {
|
|
|
767
878
|
${Z.bLarge.regular}
|
|
768
879
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
769
880
|
pointer-events: none;
|
|
770
|
-
`,
|
|
771
|
-
let t =
|
|
881
|
+
`, ze = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Be = ({ onSubtitleRef: e }) => {
|
|
882
|
+
let t = K((e) => e.title), n = K((e) => e.hideUI), r = K((e) => e.playbackError), i = K((e) => e.ready), a = K((e) => e.size), o = K((e) => e.waiting), s = K((e) => e.seekingTo);
|
|
772
883
|
return /* @__PURE__ */ O(E, { children: [
|
|
773
884
|
t ? /* @__PURE__ */ D("div", {
|
|
774
885
|
className: "title",
|
|
775
|
-
css:
|
|
886
|
+
css: Fe,
|
|
776
887
|
style: { ...n ? {
|
|
777
888
|
opacity: "0",
|
|
778
889
|
pointerEvents: "none"
|
|
779
890
|
} : {} },
|
|
780
891
|
children: t
|
|
781
892
|
}) : void 0,
|
|
782
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css:
|
|
893
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Le }) : void 0,
|
|
783
894
|
r ? /* @__PURE__ */ D("div", {
|
|
784
|
-
css:
|
|
785
|
-
children:
|
|
895
|
+
css: Re,
|
|
896
|
+
children: ze(r)
|
|
786
897
|
}) : void 0,
|
|
787
898
|
/* @__PURE__ */ D("div", {
|
|
788
899
|
className: "subtitles",
|
|
789
900
|
ref: e,
|
|
790
|
-
css:
|
|
901
|
+
css: Pe
|
|
791
902
|
})
|
|
792
903
|
] });
|
|
793
|
-
},
|
|
904
|
+
}, Ve = 1e-4, He = 1, Ue = (e) => Math.max(Ve, Math.min(He, e)) ** 2, We = (e) => Math.max(Ve, Math.min(He, e)) ** (He / 2), Ge = (e) => {
|
|
794
905
|
if (e === void 0) return "0:00";
|
|
795
906
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
796
907
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
797
|
-
},
|
|
908
|
+
}, Ke = (e, t) => `${Ge(e)} / ${Ge(t)}`, qe = (e) => _`
|
|
798
909
|
display: flex;
|
|
799
910
|
justify-content: flex-start;
|
|
800
911
|
|
|
@@ -842,17 +953,17 @@ var W = {
|
|
|
842
953
|
x: -1,
|
|
843
954
|
y: -1,
|
|
844
955
|
anchors: 0
|
|
845
|
-
},
|
|
956
|
+
}, Je = (e) => {
|
|
846
957
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
847
|
-
},
|
|
958
|
+
}, Ye = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Je, {
|
|
848
959
|
capture: !0,
|
|
849
960
|
passive: !0
|
|
850
961
|
}), () => {
|
|
851
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
962
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", Je, { capture: !0 });
|
|
852
963
|
}), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
853
964
|
let l = m(null), u = m(null);
|
|
854
965
|
return f(() => {
|
|
855
|
-
let e =
|
|
966
|
+
let e = Ye(), t = () => {
|
|
856
967
|
let e = l.current;
|
|
857
968
|
if (!e) return;
|
|
858
969
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -872,14 +983,14 @@ var W = {
|
|
|
872
983
|
"data-tooltip-delay-hide": i,
|
|
873
984
|
"data-tooltip-place": o,
|
|
874
985
|
children: n
|
|
875
|
-
}), !s && /* @__PURE__ */ D(
|
|
986
|
+
}), !s && /* @__PURE__ */ D(ne, {
|
|
876
987
|
ref: u,
|
|
877
|
-
css:
|
|
988
|
+
css: qe(c),
|
|
878
989
|
id: e,
|
|
879
990
|
noArrow: !0,
|
|
880
991
|
children: t
|
|
881
992
|
})] });
|
|
882
|
-
},
|
|
993
|
+
}, Xe = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
883
994
|
let [i, a] = h(!1), o = m(t);
|
|
884
995
|
o.current = t;
|
|
885
996
|
let s = m(null), c = d((t, r) => {
|
|
@@ -918,26 +1029,26 @@ var W = {
|
|
|
918
1029
|
style: { touchAction: "none" }
|
|
919
1030
|
}
|
|
920
1031
|
};
|
|
921
|
-
},
|
|
1032
|
+
}, Ze = 2, Qe = .005, $e = "#000", et = "#0000", tt = (e, t) => {
|
|
922
1033
|
if (!t) return [];
|
|
923
1034
|
let n = /* @__PURE__ */ new Set();
|
|
924
1035
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
925
1036
|
let r = e / t;
|
|
926
|
-
r <=
|
|
1037
|
+
r <= Qe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
927
1038
|
}
|
|
928
1039
|
return n.size ? [
|
|
929
1040
|
0,
|
|
930
1041
|
...[...n].sort((e, t) => e - t),
|
|
931
1042
|
100
|
|
932
1043
|
] : [];
|
|
933
|
-
},
|
|
934
|
-
let n =
|
|
1044
|
+
}, nt = (e, t) => {
|
|
1045
|
+
let n = Ze / 2, r = e.length - 2, i = [];
|
|
935
1046
|
for (let a = 0; a <= r; a += 1) {
|
|
936
1047
|
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
937
|
-
i.push(`${t(a) ?
|
|
1048
|
+
i.push(`${t(a) ? $e : et} ${c} ${l}`), a !== r && i.push(`${et} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
938
1049
|
}
|
|
939
1050
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
940
|
-
},
|
|
1051
|
+
}, rt = /* @__PURE__ */ new Set([
|
|
941
1052
|
"op",
|
|
942
1053
|
"ops",
|
|
943
1054
|
"opening",
|
|
@@ -945,7 +1056,7 @@ var W = {
|
|
|
945
1056
|
"ncop",
|
|
946
1057
|
"オープニング",
|
|
947
1058
|
"op主題歌"
|
|
948
|
-
]),
|
|
1059
|
+
]), it = /* @__PURE__ */ new Set([
|
|
949
1060
|
"ed",
|
|
950
1061
|
"eds",
|
|
951
1062
|
"ending",
|
|
@@ -958,13 +1069,13 @@ var W = {
|
|
|
958
1069
|
"エンドカード",
|
|
959
1070
|
"エンドロール",
|
|
960
1071
|
"ed主題歌"
|
|
961
|
-
]),
|
|
1072
|
+
]), at = /* @__PURE__ */ new Set(["intro", "イントロ"]), ot = /* @__PURE__ */ new Set(["outro", "アウトロ"]), st = {
|
|
962
1073
|
"credits start": "ending",
|
|
963
1074
|
"credits end": null,
|
|
964
1075
|
"preview end": null,
|
|
965
1076
|
"end credits": "ending",
|
|
966
1077
|
"closing credits": "ending"
|
|
967
|
-
},
|
|
1078
|
+
}, ct = /* @__PURE__ */ new Set([
|
|
968
1079
|
"theme",
|
|
969
1080
|
"themes",
|
|
970
1081
|
"song",
|
|
@@ -983,53 +1094,53 @@ var W = {
|
|
|
983
1094
|
"the",
|
|
984
1095
|
"主題歌",
|
|
985
1096
|
"ノンクレジット"
|
|
986
|
-
]),
|
|
1097
|
+
]), lt = /* @__PURE__ */ new Set([
|
|
987
1098
|
"post",
|
|
988
1099
|
"pre",
|
|
989
1100
|
"after",
|
|
990
1101
|
"before",
|
|
991
1102
|
"non"
|
|
992
|
-
]),
|
|
993
|
-
if (
|
|
994
|
-
if (
|
|
1103
|
+
]), ut = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, dt = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), ft = (e) => e.replace(/([a-z-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w-ヿ一-鿿]+|[^\w-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !ct.has(e)), pt = (e, t) => {
|
|
1104
|
+
if (rt.has(e)) return "opening";
|
|
1105
|
+
if (it.has(e)) return "ending";
|
|
995
1106
|
if (t) {
|
|
996
|
-
if (
|
|
997
|
-
if (
|
|
1107
|
+
if (at.has(e)) return "opening";
|
|
1108
|
+
if (ot.has(e)) return "ending";
|
|
998
1109
|
}
|
|
999
|
-
},
|
|
1000
|
-
if (
|
|
1110
|
+
}, mt = (e, t) => {
|
|
1111
|
+
if (dt(e)) return;
|
|
1001
1112
|
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
1002
|
-
if (n in
|
|
1003
|
-
let r = n.split(
|
|
1004
|
-
if (r.some((e) => e.split(/[\s_]+/u).some((e) =>
|
|
1113
|
+
if (n in st) return st[n] ?? void 0;
|
|
1114
|
+
let r = n.split(ut).map((e) => e.trim()).filter(Boolean);
|
|
1115
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => lt.has(e)))) return;
|
|
1005
1116
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
1006
1117
|
for (let e of i) {
|
|
1007
|
-
let n =
|
|
1118
|
+
let n = ft(e);
|
|
1008
1119
|
if (n.length !== 1) continue;
|
|
1009
|
-
let r =
|
|
1120
|
+
let r = pt(n[0], t);
|
|
1010
1121
|
if (r) return r;
|
|
1011
1122
|
}
|
|
1012
|
-
},
|
|
1123
|
+
}, ht = 15, gt = 87, _t = 93, vt = (e) => {
|
|
1013
1124
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
1014
1125
|
if (!n) return t;
|
|
1015
1126
|
let r = e.map((e, t) => ({
|
|
1016
1127
|
index: t,
|
|
1017
1128
|
start: e.start,
|
|
1018
1129
|
length: e.end - e.start
|
|
1019
|
-
})).filter(({ length: e }) => e >=
|
|
1130
|
+
})).filter(({ length: e }) => e >= gt && e <= _t), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
1020
1131
|
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
1021
|
-
},
|
|
1022
|
-
let t = e.map(({ title: e }) =>
|
|
1132
|
+
}, yt = (e) => {
|
|
1133
|
+
let t = e.map(({ title: e }) => mt(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
|
|
1023
1134
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
1024
1135
|
let i = e.map((e, n) => {
|
|
1025
|
-
if (e.end - e.start <
|
|
1136
|
+
if (e.end - e.start < ht) return;
|
|
1026
1137
|
let r = t[n];
|
|
1027
1138
|
if (r) return r;
|
|
1028
|
-
let i =
|
|
1139
|
+
let i = mt(e.title, !0);
|
|
1029
1140
|
return i && !t.includes(i) ? i : void 0;
|
|
1030
1141
|
});
|
|
1031
|
-
return e.every(({ title: e }) =>
|
|
1032
|
-
},
|
|
1142
|
+
return e.every(({ title: e }) => dt(e)) ? vt(e) : i;
|
|
1143
|
+
}, bt = _`
|
|
1033
1144
|
position: relative;
|
|
1034
1145
|
height: calc(.4 * var(--mp-unit));
|
|
1035
1146
|
|
|
@@ -1248,8 +1359,8 @@ var W = {
|
|
|
1248
1359
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1249
1360
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1250
1361
|
}
|
|
1251
|
-
`,
|
|
1252
|
-
let e =
|
|
1362
|
+
`, xt = 4, St = () => {
|
|
1363
|
+
let e = K(), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.duration), i = K((e) => e.size), a = K((e) => e.downloadedRanges), o = K((e) => e.buffered), s = K((e) => e.indexes), c = K((e) => e.thumbnails), l = K((e) => e.thumbnailAt), u = K((e) => e.requestThumbnail), d = K((e) => e.chapters), g = K((e) => e.seekingTo), _ = K((e) => e.setSourceState), v = K((e) => e.hideUI), y = m(null), [b, x] = h(void 0), [S, C] = h(void 0), w = (e) => {
|
|
1253
1364
|
C(e), u(e);
|
|
1254
1365
|
}, T = !!S;
|
|
1255
1366
|
f(() => {
|
|
@@ -1257,13 +1368,13 @@ var W = {
|
|
|
1257
1368
|
}, [_, T]), f(() => {
|
|
1258
1369
|
v && w(void 0);
|
|
1259
1370
|
}, [v]);
|
|
1260
|
-
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } =
|
|
1371
|
+
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = Xe({
|
|
1261
1372
|
ref: y,
|
|
1262
1373
|
onChange: (e) => {
|
|
1263
1374
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1264
1375
|
else if (!M.current) {
|
|
1265
1376
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1266
|
-
Math.abs(e - j.current) * t >
|
|
1377
|
+
Math.abs(e - j.current) * t > xt && (M.current = !0);
|
|
1267
1378
|
}
|
|
1268
1379
|
x(e), E.current !== "mouse" && w(e * r);
|
|
1269
1380
|
}
|
|
@@ -1315,7 +1426,7 @@ var W = {
|
|
|
1315
1426
|
b,
|
|
1316
1427
|
r
|
|
1317
1428
|
]);
|
|
1318
|
-
let
|
|
1429
|
+
let ne = p(() => {
|
|
1319
1430
|
if (!r) return 0;
|
|
1320
1431
|
if (N && b !== void 0) return b;
|
|
1321
1432
|
let e = g ?? t;
|
|
@@ -1326,22 +1437,22 @@ var W = {
|
|
|
1326
1437
|
N,
|
|
1327
1438
|
b,
|
|
1328
1439
|
g
|
|
1329
|
-
]),
|
|
1330
|
-
if (!
|
|
1331
|
-
let e = S / r * 100, t =
|
|
1332
|
-
return t >= 0 ? t :
|
|
1440
|
+
]), U = p(() => tt(d, r), [d, r]), W = U.length > 0, G = p(() => {
|
|
1441
|
+
if (!W || S === void 0 || !r) return -1;
|
|
1442
|
+
let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
|
|
1443
|
+
return t >= 0 ? t : U.length - 2;
|
|
1333
1444
|
}, [
|
|
1334
|
-
G,
|
|
1335
1445
|
W,
|
|
1446
|
+
U,
|
|
1336
1447
|
S,
|
|
1337
1448
|
r
|
|
1338
|
-
]),
|
|
1339
|
-
G,
|
|
1449
|
+
]), re = p(() => W ? nt(U, (e) => e !== G) : void 0, [
|
|
1340
1450
|
W,
|
|
1341
|
-
|
|
1342
|
-
|
|
1451
|
+
U,
|
|
1452
|
+
G
|
|
1453
|
+
]), ie = p(() => G >= 0 ? nt(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
|
|
1343
1454
|
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1344
|
-
}, [d, S]),
|
|
1455
|
+
}, [d, S]), J = p(() => {
|
|
1345
1456
|
if (S) {
|
|
1346
1457
|
if (l) return l(S);
|
|
1347
1458
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
|
|
@@ -1350,7 +1461,7 @@ var W = {
|
|
|
1350
1461
|
c,
|
|
1351
1462
|
l,
|
|
1352
1463
|
S
|
|
1353
|
-
]),
|
|
1464
|
+
]), Y = (e, t) => /* @__PURE__ */ O("div", {
|
|
1354
1465
|
className: e ? `track ${e}` : "track",
|
|
1355
1466
|
style: t ? { maskImage: t } : void 0,
|
|
1356
1467
|
children: [
|
|
@@ -1363,42 +1474,42 @@ var W = {
|
|
|
1363
1474
|
className: "play-container",
|
|
1364
1475
|
children: /* @__PURE__ */ D("div", {
|
|
1365
1476
|
className: "play",
|
|
1366
|
-
style: { transform: `scaleX(${
|
|
1477
|
+
style: { transform: `scaleX(${ne})` }
|
|
1367
1478
|
})
|
|
1368
1479
|
})
|
|
1369
1480
|
]
|
|
1370
1481
|
});
|
|
1371
1482
|
return /* @__PURE__ */ O("div", {
|
|
1372
|
-
css:
|
|
1483
|
+
css: bt,
|
|
1373
1484
|
ref: y,
|
|
1374
1485
|
className: [
|
|
1375
1486
|
"progress-bar",
|
|
1376
1487
|
N ? "dragging" : "",
|
|
1377
|
-
|
|
1488
|
+
W ? "segmented" : ""
|
|
1378
1489
|
].filter(Boolean).join(" "),
|
|
1379
1490
|
onPointerDown: z,
|
|
1380
1491
|
onPointerMove: z,
|
|
1381
1492
|
onMouseMove: B,
|
|
1382
1493
|
onMouseOut: V,
|
|
1383
1494
|
children: [
|
|
1384
|
-
|
|
1495
|
+
Y(void 0, re),
|
|
1385
1496
|
S ? /* @__PURE__ */ O("div", {
|
|
1386
1497
|
className: "cursor-time",
|
|
1387
1498
|
style: {
|
|
1388
|
-
left:
|
|
1389
|
-
maxWidth:
|
|
1499
|
+
left: q ? `clamp(var(--thumbnail-half), ${H(S)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${H(S)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1500
|
+
maxWidth: q ? "var(--thumbnail-width)" : void 0
|
|
1390
1501
|
},
|
|
1391
1502
|
children: [/* @__PURE__ */ D("span", {
|
|
1392
1503
|
className: "cursor-time-value",
|
|
1393
|
-
children:
|
|
1394
|
-
}),
|
|
1504
|
+
children: Ge(S)
|
|
1505
|
+
}), q ? /* @__PURE__ */ D("span", {
|
|
1395
1506
|
className: "chapter-title",
|
|
1396
|
-
children:
|
|
1507
|
+
children: q.title
|
|
1397
1508
|
}) : void 0]
|
|
1398
1509
|
}) : void 0,
|
|
1399
1510
|
/* @__PURE__ */ D("div", { className: "progress" }),
|
|
1400
1511
|
/* @__PURE__ */ D("div", { className: "hover" }),
|
|
1401
|
-
|
|
1512
|
+
ie ? Y("focus", ie) : void 0,
|
|
1402
1513
|
/* @__PURE__ */ D("div", { className: "scrubber" }),
|
|
1403
1514
|
/* @__PURE__ */ D("div", {
|
|
1404
1515
|
className: "padding",
|
|
@@ -1410,11 +1521,11 @@ var W = {
|
|
|
1410
1521
|
/* @__PURE__ */ D("div", {
|
|
1411
1522
|
className: "thumbnail",
|
|
1412
1523
|
style: { left: `clamp(var(--thumbnail-half), ${H(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1413
|
-
children:
|
|
1524
|
+
children: J?.url ? /* @__PURE__ */ D("img", { src: J.url }) : void 0
|
|
1414
1525
|
})
|
|
1415
1526
|
]
|
|
1416
1527
|
});
|
|
1417
|
-
},
|
|
1528
|
+
}, Ct = "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", wt = {
|
|
1418
1529
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1419
1530
|
width: 24,
|
|
1420
1531
|
height: 24,
|
|
@@ -1424,8 +1535,8 @@ var W = {
|
|
|
1424
1535
|
strokeWidth: 2,
|
|
1425
1536
|
strokeLinecap: "round",
|
|
1426
1537
|
strokeLinejoin: "round"
|
|
1427
|
-
},
|
|
1428
|
-
...
|
|
1538
|
+
}, Tt = (e) => /* @__PURE__ */ O("svg", {
|
|
1539
|
+
...wt,
|
|
1429
1540
|
...e,
|
|
1430
1541
|
children: [
|
|
1431
1542
|
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1439,8 +1550,8 @@ var W = {
|
|
|
1439
1550
|
}),
|
|
1440
1551
|
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1441
1552
|
]
|
|
1442
|
-
}),
|
|
1443
|
-
...
|
|
1553
|
+
}), Et = (e) => /* @__PURE__ */ O("svg", {
|
|
1554
|
+
...wt,
|
|
1444
1555
|
...e,
|
|
1445
1556
|
children: [
|
|
1446
1557
|
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1454,7 +1565,7 @@ var W = {
|
|
|
1454
1565
|
}),
|
|
1455
1566
|
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1456
1567
|
]
|
|
1457
|
-
}),
|
|
1568
|
+
}), Dt = _`
|
|
1458
1569
|
.popover {
|
|
1459
1570
|
position: absolute;
|
|
1460
1571
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1581,7 +1692,7 @@ var W = {
|
|
|
1581
1692
|
${Z.bSmall.regular}
|
|
1582
1693
|
}
|
|
1583
1694
|
}
|
|
1584
|
-
`,
|
|
1695
|
+
`, Ot = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1585
1696
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1586
1697
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1587
1698
|
return /* @__PURE__ */ O("div", {
|
|
@@ -1608,7 +1719,7 @@ var W = {
|
|
|
1608
1719
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1609
1720
|
]
|
|
1610
1721
|
});
|
|
1611
|
-
},
|
|
1722
|
+
}, kt = ({ onReset: e } = {}) => {
|
|
1612
1723
|
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1613
1724
|
c.current = e;
|
|
1614
1725
|
let l = () => {
|
|
@@ -1649,7 +1760,7 @@ var W = {
|
|
|
1649
1760
|
});
|
|
1650
1761
|
}
|
|
1651
1762
|
};
|
|
1652
|
-
},
|
|
1763
|
+
}, At = _`
|
|
1653
1764
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1654
1765
|
which is the width of the player box, so it can be clamped to it. */
|
|
1655
1766
|
position: static;
|
|
@@ -1665,7 +1776,7 @@ position: static;
|
|
|
1665
1776
|
}
|
|
1666
1777
|
}
|
|
1667
1778
|
|
|
1668
|
-
${
|
|
1779
|
+
${Dt}
|
|
1669
1780
|
|
|
1670
1781
|
.popover.error-list {
|
|
1671
1782
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1737,23 +1848,23 @@ ${Ct}
|
|
|
1737
1848
|
}
|
|
1738
1849
|
}
|
|
1739
1850
|
}
|
|
1740
|
-
`,
|
|
1741
|
-
let n =
|
|
1851
|
+
`, jt = (e) => new Date(e).toLocaleTimeString(), Mt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Ge(Math.max(0, e)), Nt = (e) => e.reduce((e, t) => e + t.count, 0), Pt = (e) => e.map((e, t) => {
|
|
1852
|
+
let n = Mt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1742
1853
|
return [
|
|
1743
1854
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1744
1855
|
e.message,
|
|
1745
1856
|
e.detail
|
|
1746
1857
|
].filter(Boolean).join("\n");
|
|
1747
|
-
}).join("\n\n"),
|
|
1748
|
-
let e =
|
|
1858
|
+
}).join("\n\n"), Ft = () => {
|
|
1859
|
+
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = kt(), [i, a] = h(!1);
|
|
1749
1860
|
if (e.length === 0) return null;
|
|
1750
1861
|
let o = () => {
|
|
1751
|
-
navigator.clipboard?.writeText(
|
|
1862
|
+
navigator.clipboard?.writeText(Pt(e)).then(() => {
|
|
1752
1863
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1753
1864
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1754
|
-
}, s = `Playback errors (${
|
|
1865
|
+
}, s = `Playback errors (${Nt(e)})`;
|
|
1755
1866
|
return /* @__PURE__ */ O("div", {
|
|
1756
|
-
css:
|
|
1867
|
+
css: At,
|
|
1757
1868
|
ref: r,
|
|
1758
1869
|
children: [/* @__PURE__ */ D($, {
|
|
1759
1870
|
id: "errors",
|
|
@@ -1784,9 +1895,9 @@ ${Ct}
|
|
|
1784
1895
|
/* @__PURE__ */ O("span", {
|
|
1785
1896
|
className: "when",
|
|
1786
1897
|
children: [
|
|
1787
|
-
|
|
1788
|
-
e.count > 1 ? ` to ${
|
|
1789
|
-
|
|
1898
|
+
jt(e.at),
|
|
1899
|
+
e.count > 1 ? ` to ${jt(e.lastAt)}` : "",
|
|
1900
|
+
Mt(e.atMediaTime) ? ` at ${Mt(e.atMediaTime)}` : "",
|
|
1790
1901
|
e.recovered ? " recovered" : "",
|
|
1791
1902
|
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1792
1903
|
className: "count",
|
|
@@ -1806,7 +1917,7 @@ ${Ct}
|
|
|
1806
1917
|
}, `${e.at}-${t}`))]
|
|
1807
1918
|
})]
|
|
1808
1919
|
});
|
|
1809
|
-
},
|
|
1920
|
+
}, It = _`
|
|
1810
1921
|
display: flex;
|
|
1811
1922
|
align-items: center;
|
|
1812
1923
|
justify-content: center;
|
|
@@ -1859,8 +1970,8 @@ width: 100%;
|
|
|
1859
1970
|
}
|
|
1860
1971
|
}
|
|
1861
1972
|
}
|
|
1862
|
-
`,
|
|
1863
|
-
let e =
|
|
1973
|
+
`, Lt = () => {
|
|
1974
|
+
let e = K(), t = K((e) => e.playbackRate), n = m(null), r = m(null), i = .25, a = 2.75, 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 } = Xe({
|
|
1864
1975
|
ref: r,
|
|
1865
1976
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1866
1977
|
}), d = (t) => {
|
|
@@ -1876,7 +1987,7 @@ width: 100%;
|
|
|
1876
1987
|
}, [t]);
|
|
1877
1988
|
let p = c(s);
|
|
1878
1989
|
return /* @__PURE__ */ O("div", {
|
|
1879
|
-
css:
|
|
1990
|
+
css: It,
|
|
1880
1991
|
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1881
1992
|
className: "playback-slider",
|
|
1882
1993
|
ref: n,
|
|
@@ -1894,7 +2005,7 @@ width: 100%;
|
|
|
1894
2005
|
})
|
|
1895
2006
|
})]
|
|
1896
2007
|
});
|
|
1897
|
-
},
|
|
2008
|
+
}, Rt = _`
|
|
1898
2009
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1899
2010
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1900
2011
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1912,7 +2023,7 @@ position: static;
|
|
|
1912
2023
|
}
|
|
1913
2024
|
}
|
|
1914
2025
|
|
|
1915
|
-
${
|
|
2026
|
+
${Dt}
|
|
1916
2027
|
|
|
1917
2028
|
.switch {
|
|
1918
2029
|
position: relative;
|
|
@@ -1988,8 +2099,8 @@ ${Ct}
|
|
|
1988
2099
|
}
|
|
1989
2100
|
}
|
|
1990
2101
|
|
|
1991
|
-
`,
|
|
1992
|
-
let e =
|
|
2102
|
+
`, zt = () => {
|
|
2103
|
+
let e = K(), t = K((e) => e.playbackRate), n = K((e) => e.audioTracks), r = K((e) => e.selectedAudioTrack), i = K((e) => e.selectAudioTrack), a = K((e) => e.quality), o = K((e) => e.volumeNormalizer), [s, c] = h(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } = kt({ onReset: () => c(0) }), g = (t) => {
|
|
1993
2104
|
e.setPlaybackRate(t), c(0);
|
|
1994
2105
|
}, _ = (e) => {
|
|
1995
2106
|
e !== void 0 && m(e, () => i(e));
|
|
@@ -1999,7 +2110,7 @@ ${Ct}
|
|
|
1999
2110
|
c(e);
|
|
2000
2111
|
};
|
|
2001
2112
|
return /* @__PURE__ */ O("div", {
|
|
2002
|
-
css:
|
|
2113
|
+
css: Rt,
|
|
2003
2114
|
ref: d,
|
|
2004
2115
|
children: [
|
|
2005
2116
|
/* @__PURE__ */ D($, {
|
|
@@ -2061,7 +2172,7 @@ ${Ct}
|
|
|
2061
2172
|
}),
|
|
2062
2173
|
/* @__PURE__ */ D("div", {
|
|
2063
2174
|
className: "slider no-hover",
|
|
2064
|
-
children: /* @__PURE__ */ D(
|
|
2175
|
+
children: /* @__PURE__ */ D(Lt, {})
|
|
2065
2176
|
}),
|
|
2066
2177
|
/* @__PURE__ */ O("div", {
|
|
2067
2178
|
className: "options no-hover",
|
|
@@ -2086,7 +2197,7 @@ ${Ct}
|
|
|
2086
2197
|
})
|
|
2087
2198
|
]
|
|
2088
2199
|
}),
|
|
2089
|
-
l && s === 2 && /* @__PURE__ */ D(
|
|
2200
|
+
l && s === 2 && /* @__PURE__ */ D(Ot, {
|
|
2090
2201
|
title: "Audio",
|
|
2091
2202
|
tracks: n,
|
|
2092
2203
|
selected: r,
|
|
@@ -2095,7 +2206,7 @@ ${Ct}
|
|
|
2095
2206
|
pending: f,
|
|
2096
2207
|
failed: p
|
|
2097
2208
|
}),
|
|
2098
|
-
l && s === 3 && a && /* @__PURE__ */ D(
|
|
2209
|
+
l && s === 3 && a && /* @__PURE__ */ D(Ot, {
|
|
2099
2210
|
title: "Quality",
|
|
2100
2211
|
tracks: a.options,
|
|
2101
2212
|
selected: a.selectedId ?? void 0,
|
|
@@ -2107,7 +2218,7 @@ ${Ct}
|
|
|
2107
2218
|
})
|
|
2108
2219
|
]
|
|
2109
2220
|
});
|
|
2110
|
-
},
|
|
2221
|
+
}, Bt = _`
|
|
2111
2222
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2112
2223
|
which is the width of the player box, so it can be clamped to it. */
|
|
2113
2224
|
position: static;
|
|
@@ -2123,13 +2234,13 @@ position: static;
|
|
|
2123
2234
|
}
|
|
2124
2235
|
}
|
|
2125
2236
|
|
|
2126
|
-
${
|
|
2127
|
-
`,
|
|
2128
|
-
let e =
|
|
2237
|
+
${Dt}
|
|
2238
|
+
`, Vt = () => {
|
|
2239
|
+
let e = K((e) => e.subtitleTracks), t = K((e) => e.selectedSubtitleTrack), n = K((e) => e.selectSubtitleTrack), r = K((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = kt();
|
|
2129
2240
|
if (e.length === 0) return null;
|
|
2130
2241
|
let u = t !== void 0;
|
|
2131
2242
|
return /* @__PURE__ */ O("div", {
|
|
2132
|
-
css:
|
|
2243
|
+
css: Bt,
|
|
2133
2244
|
ref: o,
|
|
2134
2245
|
children: [/* @__PURE__ */ D($, {
|
|
2135
2246
|
id: "subtitles",
|
|
@@ -2144,7 +2255,7 @@ ${Ct}
|
|
|
2144
2255
|
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
2145
2256
|
}),
|
|
2146
2257
|
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2147
|
-
}), i && /* @__PURE__ */ D(
|
|
2258
|
+
}), i && /* @__PURE__ */ D(Ot, {
|
|
2148
2259
|
title: "Subtitles",
|
|
2149
2260
|
tracks: e,
|
|
2150
2261
|
selected: t,
|
|
@@ -2154,13 +2265,13 @@ ${Ct}
|
|
|
2154
2265
|
failed: c
|
|
2155
2266
|
})]
|
|
2156
2267
|
});
|
|
2157
|
-
},
|
|
2268
|
+
}, Ht = {
|
|
2158
2269
|
primary: "#EAEBEE",
|
|
2159
2270
|
secondary: "#D0D0D9",
|
|
2160
2271
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2161
2272
|
borderPrimary: "#384F70",
|
|
2162
2273
|
backgroundTooltip: "#222222"
|
|
2163
|
-
},
|
|
2274
|
+
}, Ut = _`
|
|
2164
2275
|
display: flex;
|
|
2165
2276
|
align-items: center;
|
|
2166
2277
|
|
|
@@ -2203,8 +2314,8 @@ ${Ct}
|
|
|
2203
2314
|
width: 10px;
|
|
2204
2315
|
height: 10px;
|
|
2205
2316
|
}
|
|
2206
|
-
`,
|
|
2207
|
-
let n =
|
|
2317
|
+
`, Wt = ({ value: e, onChange: t }) => {
|
|
2318
|
+
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } = Xe({
|
|
2208
2319
|
ref: a,
|
|
2209
2320
|
onChange: t
|
|
2210
2321
|
}), s = (n) => {
|
|
@@ -2218,12 +2329,12 @@ ${Ct}
|
|
|
2218
2329
|
e && e.removeEventListener("wheel", s);
|
|
2219
2330
|
};
|
|
2220
2331
|
}, [e]);
|
|
2221
|
-
let c = e * 100, l = p(() => Math.round(r ? 0 :
|
|
2332
|
+
let c = e * 100, l = p(() => Math.round(r ? 0 : We(n) * 100), [n, r]);
|
|
2222
2333
|
return /* @__PURE__ */ D($, {
|
|
2223
2334
|
id: "volume-slider",
|
|
2224
2335
|
text: /* @__PURE__ */ D("div", {
|
|
2225
2336
|
ref: i,
|
|
2226
|
-
css:
|
|
2337
|
+
css: Ut,
|
|
2227
2338
|
...o,
|
|
2228
2339
|
children: /* @__PURE__ */ D("div", {
|
|
2229
2340
|
ref: a,
|
|
@@ -2242,7 +2353,7 @@ ${Ct}
|
|
|
2242
2353
|
children: [l, "%"]
|
|
2243
2354
|
})
|
|
2244
2355
|
});
|
|
2245
|
-
},
|
|
2356
|
+
}, Gt = _`
|
|
2246
2357
|
position: relative;
|
|
2247
2358
|
display: flex;
|
|
2248
2359
|
align-items: center;
|
|
@@ -2305,10 +2416,10 @@ ${Ct}
|
|
|
2305
2416
|
}
|
|
2306
2417
|
}
|
|
2307
2418
|
|
|
2308
|
-
`,
|
|
2309
|
-
let t =
|
|
2419
|
+
`, Kt = ({ ref: e }) => {
|
|
2420
|
+
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() => We(n), [n]);
|
|
2310
2421
|
return /* @__PURE__ */ O("div", {
|
|
2311
|
-
css:
|
|
2422
|
+
css: Gt,
|
|
2312
2423
|
children: [/* @__PURE__ */ D($, {
|
|
2313
2424
|
id: "sound",
|
|
2314
2425
|
text: /* @__PURE__ */ D("button", {
|
|
@@ -2328,16 +2439,16 @@ ${Ct}
|
|
|
2328
2439
|
className: "volume-slider-container",
|
|
2329
2440
|
children: /* @__PURE__ */ D("div", {
|
|
2330
2441
|
className: "volume-slider-background",
|
|
2331
|
-
children: /* @__PURE__ */ D(
|
|
2442
|
+
children: /* @__PURE__ */ D(Wt, {
|
|
2332
2443
|
value: r ? 0 : i,
|
|
2333
2444
|
onChange: (e) => {
|
|
2334
|
-
t.setVolume(
|
|
2445
|
+
t.setVolume(Ue(e));
|
|
2335
2446
|
}
|
|
2336
2447
|
})
|
|
2337
2448
|
})
|
|
2338
2449
|
})]
|
|
2339
2450
|
});
|
|
2340
|
-
},
|
|
2451
|
+
}, qt = .05, Jt = 5, Yt = 50, Xt = 1e3, Zt = _`
|
|
2341
2452
|
position: absolute;
|
|
2342
2453
|
bottom: 0;
|
|
2343
2454
|
width: 100%;
|
|
@@ -2429,7 +2540,7 @@ ${Ct}
|
|
|
2429
2540
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2430
2541
|
of its own and so is never :hover */
|
|
2431
2542
|
:hover, &.armed {
|
|
2432
|
-
background-color: ${
|
|
2543
|
+
background-color: ${Ht.hover};
|
|
2433
2544
|
}
|
|
2434
2545
|
|
|
2435
2546
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2467,36 +2578,36 @@ ${Ct}
|
|
|
2467
2578
|
}
|
|
2468
2579
|
}
|
|
2469
2580
|
}
|
|
2470
|
-
`,
|
|
2471
|
-
let n =
|
|
2472
|
-
let r =
|
|
2473
|
-
n.setVolume(
|
|
2474
|
-
}, [n]),
|
|
2581
|
+
`, Qt = ({ shortcuts: e = "window", root: t }) => {
|
|
2582
|
+
let n = K(), r = K((e) => e.paused), i = K((e) => e.currentTime), a = K((e) => e.duration), o = K((e) => e.seekingTo), s = K((e) => e.fullscreen), c = K((e) => e.hideUI), l = K((e) => e.togglePictureInPicture), u = K((e) => e.pictureInPictureMode), p = K((e) => e.burnedInSubtitles), g = K((e) => e.passThroughPictureInPicture), _ = K((e) => e.subtitleTracks), v = K((e) => e.requestSeek), y = K((e) => e.stepFrame), [b, x] = h(null), S = m(null), C = m(void 0), w = u === "burn-in", T = _.length > 0, E = a > 0 && i === a, k = d(({ direction: e, stepSize: t }) => {
|
|
2583
|
+
let r = We(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2584
|
+
n.setVolume(Ue(a)), o && !n.muted && n.toggleMuted();
|
|
2585
|
+
}, [n]), A = m(!1);
|
|
2475
2586
|
f(() => {
|
|
2476
2587
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
2477
|
-
|
|
2588
|
+
A.current = !!t.current?.contains(i(e) ?? null);
|
|
2478
2589
|
}, o = (a) => {
|
|
2479
2590
|
let o = i(a);
|
|
2480
|
-
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "")) return;
|
|
2481
|
-
let s = t.current?.contains(o ?? null) || o === document.body &&
|
|
2591
|
+
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "") || (a.ctrlKey || a.metaKey || a.altKey) && !a.getModifierState("AltGraph")) return;
|
|
2592
|
+
let s = t.current?.contains(o ?? null) || o === document.body && A.current;
|
|
2482
2593
|
if (e === "player" && !n.fullscreen && !s) return;
|
|
2483
2594
|
let c = !0;
|
|
2484
2595
|
if (a.key === "f") n.toggleFullscreen();
|
|
2485
2596
|
else if (a.key === "k") n.togglePaused();
|
|
2486
2597
|
else if (a.key === " ") n.togglePaused();
|
|
2487
2598
|
else if (a.key === "m") n.toggleMuted();
|
|
2488
|
-
else if (a.key === "ArrowUp")
|
|
2599
|
+
else if (a.key === "ArrowUp") k({
|
|
2489
2600
|
direction: "up",
|
|
2490
|
-
stepSize:
|
|
2601
|
+
stepSize: qt
|
|
2491
2602
|
});
|
|
2492
|
-
else if (a.key === "ArrowDown")
|
|
2603
|
+
else if (a.key === "ArrowDown") k({
|
|
2493
2604
|
direction: "down",
|
|
2494
|
-
stepSize:
|
|
2605
|
+
stepSize: qt
|
|
2495
2606
|
});
|
|
2496
2607
|
else if (a.key === "ArrowRight") {
|
|
2497
2608
|
if (!n.duration) return;
|
|
2498
|
-
r(Math.min(n.currentTime +
|
|
2499
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2609
|
+
r(Math.min(n.currentTime + Jt, n.duration));
|
|
2610
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Jt, 0)) : (a.key === "<" || a.key === ">") && y ? y(a.key === ">" ? 1 : -1) : c = !1;
|
|
2500
2611
|
c && a.preventDefault();
|
|
2501
2612
|
};
|
|
2502
2613
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2504,24 +2615,25 @@ ${Ct}
|
|
|
2504
2615
|
};
|
|
2505
2616
|
}, [
|
|
2506
2617
|
n,
|
|
2507
|
-
|
|
2618
|
+
k,
|
|
2508
2619
|
v,
|
|
2620
|
+
y,
|
|
2509
2621
|
e,
|
|
2510
2622
|
t
|
|
2511
2623
|
]);
|
|
2512
|
-
let
|
|
2513
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2624
|
+
let j = d((e) => {
|
|
2625
|
+
e.preventDefault(), e.deltaY < 0 ? k({
|
|
2514
2626
|
direction: "up",
|
|
2515
|
-
stepSize:
|
|
2516
|
-
}) :
|
|
2627
|
+
stepSize: qt
|
|
2628
|
+
}) : k({
|
|
2517
2629
|
direction: "down",
|
|
2518
|
-
stepSize:
|
|
2630
|
+
stepSize: qt
|
|
2519
2631
|
});
|
|
2520
|
-
}, [
|
|
2632
|
+
}, [k]);
|
|
2521
2633
|
f(() => {
|
|
2522
|
-
if (
|
|
2523
|
-
}, [
|
|
2524
|
-
let
|
|
2634
|
+
if (b) return b.addEventListener("wheel", j, { passive: !1 }), () => b.removeEventListener("wheel", j);
|
|
2635
|
+
}, [b, j]);
|
|
2636
|
+
let M = (e) => {
|
|
2525
2637
|
if (!g || g.active || g.armed || e.pointerType === "touch") return;
|
|
2526
2638
|
let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
|
|
2527
2639
|
g.arm({
|
|
@@ -2530,29 +2642,29 @@ ${Ct}
|
|
|
2530
2642
|
width: r,
|
|
2531
2643
|
height: i
|
|
2532
2644
|
});
|
|
2533
|
-
},
|
|
2645
|
+
}, N = !!g?.armed;
|
|
2534
2646
|
return f(() => {
|
|
2535
|
-
if (!
|
|
2536
|
-
clearInterval(
|
|
2647
|
+
if (!N) return;
|
|
2648
|
+
clearInterval(C.current);
|
|
2537
2649
|
let e = Infinity, t = setInterval(() => {
|
|
2538
2650
|
if (Date.now() > e) {
|
|
2539
2651
|
clearInterval(t);
|
|
2540
2652
|
return;
|
|
2541
2653
|
}
|
|
2542
|
-
let n =
|
|
2654
|
+
let n = S.current, r = document.activeElement;
|
|
2543
2655
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2544
|
-
},
|
|
2545
|
-
return
|
|
2546
|
-
e = Date.now() +
|
|
2656
|
+
}, Yt);
|
|
2657
|
+
return C.current = t, () => {
|
|
2658
|
+
e = Date.now() + Xt;
|
|
2547
2659
|
};
|
|
2548
|
-
}, [
|
|
2660
|
+
}, [N]), f(() => () => clearInterval(C.current), []), /* @__PURE__ */ O("div", {
|
|
2549
2661
|
className: "control-bar",
|
|
2550
|
-
css:
|
|
2662
|
+
css: Zt,
|
|
2551
2663
|
style: { ...c ? {
|
|
2552
2664
|
opacity: "0",
|
|
2553
2665
|
pointerEvents: "none"
|
|
2554
|
-
} :
|
|
2555
|
-
children: [/* @__PURE__ */ D(
|
|
2666
|
+
} : N ? { pointerEvents: "none" } : {} },
|
|
2667
|
+
children: [/* @__PURE__ */ D(St, {}), /* @__PURE__ */ O("div", {
|
|
2556
2668
|
className: "actions",
|
|
2557
2669
|
children: [/* @__PURE__ */ O("div", {
|
|
2558
2670
|
className: "left",
|
|
@@ -2564,37 +2676,37 @@ ${Ct}
|
|
|
2564
2676
|
className: "play",
|
|
2565
2677
|
type: "button",
|
|
2566
2678
|
onClick: () => n.togglePaused(),
|
|
2567
|
-
"aria-label":
|
|
2568
|
-
children: D(
|
|
2679
|
+
"aria-label": E ? "Replay" : r ? "Play" : "Pause",
|
|
2680
|
+
children: D(E ? z : r ? R : L, {})
|
|
2569
2681
|
}),
|
|
2570
|
-
toolTipText: /* @__PURE__ */ D("span", { children:
|
|
2682
|
+
toolTipText: /* @__PURE__ */ D("span", { children: E ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2571
2683
|
}),
|
|
2572
|
-
/* @__PURE__ */ D(
|
|
2684
|
+
/* @__PURE__ */ D(Kt, { ref: x }),
|
|
2573
2685
|
/* @__PURE__ */ D("div", {
|
|
2574
2686
|
className: "time",
|
|
2575
|
-
children:
|
|
2687
|
+
children: Ke(o ?? i, a)
|
|
2576
2688
|
})
|
|
2577
2689
|
]
|
|
2578
2690
|
}), /* @__PURE__ */ O("div", {
|
|
2579
2691
|
className: "right",
|
|
2580
2692
|
children: [
|
|
2581
|
-
/* @__PURE__ */ D(jt, {}),
|
|
2582
|
-
/* @__PURE__ */ D(Lt, {}),
|
|
2583
2693
|
/* @__PURE__ */ D(Ft, {}),
|
|
2694
|
+
/* @__PURE__ */ D(Vt, {}),
|
|
2695
|
+
/* @__PURE__ */ D(zt, {}),
|
|
2584
2696
|
g ? /* @__PURE__ */ D($, {
|
|
2585
2697
|
id: "picture-in-picture",
|
|
2586
2698
|
tooltipPlace: "top-end",
|
|
2587
2699
|
text: /* @__PURE__ */ D("button", {
|
|
2588
|
-
ref:
|
|
2700
|
+
ref: S,
|
|
2589
2701
|
className: g.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2590
2702
|
type: "button",
|
|
2591
|
-
onPointerEnter:
|
|
2592
|
-
onPointerMove:
|
|
2703
|
+
onPointerEnter: M,
|
|
2704
|
+
onPointerMove: M,
|
|
2593
2705
|
onClick: g.active ? g.exit : void 0,
|
|
2594
2706
|
"aria-label": "Picture in picture",
|
|
2595
2707
|
"aria-pressed": g.active,
|
|
2596
2708
|
children: /* @__PURE__ */ D("img", {
|
|
2597
|
-
src:
|
|
2709
|
+
src: Ct,
|
|
2598
2710
|
alt: ""
|
|
2599
2711
|
})
|
|
2600
2712
|
}),
|
|
@@ -2606,15 +2718,15 @@ ${Ct}
|
|
|
2606
2718
|
className: "picture-in-picture",
|
|
2607
2719
|
type: "button",
|
|
2608
2720
|
onClick: l,
|
|
2609
|
-
disabled:
|
|
2610
|
-
"aria-label":
|
|
2611
|
-
"aria-pressed":
|
|
2612
|
-
children:
|
|
2613
|
-
src:
|
|
2721
|
+
disabled: w && !T,
|
|
2722
|
+
"aria-label": w ? "Put the subtitles in the video" : "Picture in picture",
|
|
2723
|
+
"aria-pressed": w ? p : void 0,
|
|
2724
|
+
children: w ? D(p ? Tt : Et, {}) : /* @__PURE__ */ D("img", {
|
|
2725
|
+
src: Ct,
|
|
2614
2726
|
alt: ""
|
|
2615
2727
|
})
|
|
2616
2728
|
}),
|
|
2617
|
-
toolTipText: /* @__PURE__ */ D("span", { children:
|
|
2729
|
+
toolTipText: /* @__PURE__ */ D("span", { children: w ? T ? p ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture" })
|
|
2618
2730
|
}) : null,
|
|
2619
2731
|
/* @__PURE__ */ D($, {
|
|
2620
2732
|
id: "full-screen",
|
|
@@ -2633,7 +2745,7 @@ ${Ct}
|
|
|
2633
2745
|
})]
|
|
2634
2746
|
})]
|
|
2635
2747
|
});
|
|
2636
|
-
},
|
|
2748
|
+
}, $t = 9e3, en = _`
|
|
2637
2749
|
position: absolute;
|
|
2638
2750
|
inset: 0;
|
|
2639
2751
|
z-index: 2;
|
|
@@ -2676,18 +2788,18 @@ ${Ct}
|
|
|
2676
2788
|
line-height: 1;
|
|
2677
2789
|
color: #fff;
|
|
2678
2790
|
}
|
|
2679
|
-
`,
|
|
2680
|
-
let e =
|
|
2791
|
+
`, tn = () => {
|
|
2792
|
+
let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2681
2793
|
return f(() => {
|
|
2682
2794
|
if (t !== "burn-in" || !e) {
|
|
2683
2795
|
r(!1);
|
|
2684
2796
|
return;
|
|
2685
2797
|
}
|
|
2686
2798
|
r(!0);
|
|
2687
|
-
let n = setTimeout(() => r(!1),
|
|
2799
|
+
let n = setTimeout(() => r(!1), $t);
|
|
2688
2800
|
return () => clearTimeout(n);
|
|
2689
2801
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2690
|
-
css:
|
|
2802
|
+
css: en,
|
|
2691
2803
|
className: n ? "show" : "",
|
|
2692
2804
|
role: "status",
|
|
2693
2805
|
children: /* @__PURE__ */ O("div", {
|
|
@@ -2702,10 +2814,10 @@ ${Ct}
|
|
|
2702
2814
|
})]
|
|
2703
2815
|
})
|
|
2704
2816
|
});
|
|
2705
|
-
},
|
|
2817
|
+
}, nn = 1, rn = 6e3, an = 1, on = {
|
|
2706
2818
|
opening: "Skip Opening",
|
|
2707
2819
|
ending: "Skip Ending"
|
|
2708
|
-
},
|
|
2820
|
+
}, sn = _`
|
|
2709
2821
|
position: absolute;
|
|
2710
2822
|
inset: 0;
|
|
2711
2823
|
z-index: 2;
|
|
@@ -2756,10 +2868,10 @@ ${Ct}
|
|
|
2756
2868
|
bottom: calc(9 * var(--mp-unit));
|
|
2757
2869
|
}
|
|
2758
2870
|
}
|
|
2759
|
-
`,
|
|
2760
|
-
let e =
|
|
2871
|
+
`, cn = () => {
|
|
2872
|
+
let e = K((e) => e.chapters), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.seekPreview), i = K(), a = p(() => yt(e), [e]), o = p(() => {
|
|
2761
2873
|
if (typeof t != "number") return;
|
|
2762
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2874
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - nn <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2763
2875
|
return r ? {
|
|
2764
2876
|
kind: r,
|
|
2765
2877
|
end: e[n].end
|
|
@@ -2771,7 +2883,7 @@ ${Ct}
|
|
|
2771
2883
|
]), s = m(0), [c, l] = h(0);
|
|
2772
2884
|
f(() => {
|
|
2773
2885
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2774
|
-
s.current = e, e < n -
|
|
2886
|
+
s.current = e, e < n - an && l((e) => e + 1);
|
|
2775
2887
|
}, [t]);
|
|
2776
2888
|
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2777
2889
|
return f(() => {
|
|
@@ -2780,12 +2892,12 @@ ${Ct}
|
|
|
2780
2892
|
return;
|
|
2781
2893
|
}
|
|
2782
2894
|
d(!0);
|
|
2783
|
-
let e = setTimeout(() => d(!1),
|
|
2895
|
+
let e = setTimeout(() => d(!1), rn);
|
|
2784
2896
|
return () => clearTimeout(e);
|
|
2785
2897
|
}, [g, c]), f(() => {
|
|
2786
2898
|
o || d(!1);
|
|
2787
2899
|
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2788
|
-
css:
|
|
2900
|
+
css: sn,
|
|
2789
2901
|
className: u && !r ? "show" : "",
|
|
2790
2902
|
children: /* @__PURE__ */ D("button", {
|
|
2791
2903
|
type: "button",
|
|
@@ -2793,10 +2905,10 @@ ${Ct}
|
|
|
2793
2905
|
onClick: () => {
|
|
2794
2906
|
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2795
2907
|
},
|
|
2796
|
-
children:
|
|
2908
|
+
children: on[o.kind]
|
|
2797
2909
|
})
|
|
2798
2910
|
}) : null;
|
|
2799
|
-
},
|
|
2911
|
+
}, ln = 3e3, un = _`
|
|
2800
2912
|
position: absolute;
|
|
2801
2913
|
inset: 0;
|
|
2802
2914
|
z-index: 2;
|
|
@@ -2807,10 +2919,10 @@ ${Ct}
|
|
|
2807
2919
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2808
2920
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2809
2921
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2810
|
-
`,
|
|
2922
|
+
`, dn = (e, t) => {
|
|
2811
2923
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2812
2924
|
return `path(evenodd, 'M0 0H${t.width}V${t.height}H0Z M${n} ${r}H${n + e.width}V${r + e.height}H${n}Z')`;
|
|
2813
|
-
},
|
|
2925
|
+
}, fn = _`
|
|
2814
2926
|
position: relative;
|
|
2815
2927
|
background-color: black;
|
|
2816
2928
|
display: flex;
|
|
@@ -2867,14 +2979,14 @@ ${Ct}
|
|
|
2867
2979
|
&.hide {
|
|
2868
2980
|
cursor: none;
|
|
2869
2981
|
}
|
|
2870
|
-
`,
|
|
2982
|
+
`, pn = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2871
2983
|
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2872
|
-
return u(e) && e.type === l ?
|
|
2984
|
+
return u(e) && e.type === l ? pn(e.props.children, `${r}/`) : [{
|
|
2873
2985
|
key: r,
|
|
2874
2986
|
item: e
|
|
2875
2987
|
}];
|
|
2876
|
-
}),
|
|
2877
|
-
let s =
|
|
2988
|
+
}), mn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2989
|
+
let s = K(), c = K((e) => e.hideUI), l = K((e) => e.setHideUI), u = K((e) => e.hasMedia), d = K((e) => e.passThroughPictureInPicture), p = m(void 0), h = m("mouse"), g = m({
|
|
2878
2990
|
x: -1,
|
|
2879
2991
|
y: -1
|
|
2880
2992
|
}), _ = m(!1), v = m(null);
|
|
@@ -2894,12 +3006,12 @@ ${Ct}
|
|
|
2894
3006
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
2895
3007
|
}, S = () => {
|
|
2896
3008
|
if (x()) {
|
|
2897
|
-
p.current = setTimeout(S,
|
|
3009
|
+
p.current = setTimeout(S, ln);
|
|
2898
3010
|
return;
|
|
2899
3011
|
}
|
|
2900
3012
|
y();
|
|
2901
3013
|
}, C = () => {
|
|
2902
|
-
l(!1), clearTimeout(p.current), p.current = setTimeout(S,
|
|
3014
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, ln);
|
|
2903
3015
|
}, w = (e) => {
|
|
2904
3016
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
2905
3017
|
x: e.clientX,
|
|
@@ -2911,7 +3023,7 @@ ${Ct}
|
|
|
2911
3023
|
_.current = !1;
|
|
2912
3024
|
}, k = m(!0);
|
|
2913
3025
|
return /* @__PURE__ */ O("div", {
|
|
2914
|
-
css:
|
|
3026
|
+
css: fn,
|
|
2915
3027
|
ref: b,
|
|
2916
3028
|
onPointerMove: w,
|
|
2917
3029
|
onPointerDown: T,
|
|
@@ -2926,9 +3038,9 @@ ${Ct}
|
|
|
2926
3038
|
className: c ? "hide" : "",
|
|
2927
3039
|
tabIndex: a === "player" ? -1 : void 0,
|
|
2928
3040
|
children: [
|
|
2929
|
-
/* @__PURE__ */ D(
|
|
2930
|
-
|
|
2931
|
-
css:
|
|
3041
|
+
/* @__PURE__ */ D(Be, { onSubtitleRef: n }),
|
|
3042
|
+
pn(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
3043
|
+
css: un,
|
|
2932
3044
|
style: { ...c ? {
|
|
2933
3045
|
opacity: "0",
|
|
2934
3046
|
visibility: "hidden",
|
|
@@ -2936,15 +3048,15 @@ ${Ct}
|
|
|
2936
3048
|
} : {} },
|
|
2937
3049
|
children: t
|
|
2938
3050
|
}, e)),
|
|
2939
|
-
i === !1 ? null : /* @__PURE__ */ D(
|
|
3051
|
+
i === !1 ? null : /* @__PURE__ */ D(Qt, {
|
|
2940
3052
|
shortcuts: a,
|
|
2941
3053
|
root: v
|
|
2942
3054
|
}),
|
|
2943
|
-
/* @__PURE__ */ D(
|
|
2944
|
-
/* @__PURE__ */ D(
|
|
3055
|
+
/* @__PURE__ */ D(tn, {}),
|
|
3056
|
+
/* @__PURE__ */ D(cn, {}),
|
|
2945
3057
|
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
2946
3058
|
className: "pass-through",
|
|
2947
|
-
style: { clipPath:
|
|
3059
|
+
style: { clipPath: dn(d.armed, v.current.getBoundingClientRect()) },
|
|
2948
3060
|
onPointerOver: d.disarm
|
|
2949
3061
|
}) : null,
|
|
2950
3062
|
/* @__PURE__ */ O("div", {
|
|
@@ -2967,64 +3079,71 @@ ${Ct}
|
|
|
2967
3079
|
})
|
|
2968
3080
|
]
|
|
2969
3081
|
});
|
|
2970
|
-
},
|
|
2971
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: d, thumbnailsEnabled: g } = r ?? {},
|
|
2972
|
-
f(() => (
|
|
2973
|
-
let { expose:
|
|
2974
|
-
|
|
2975
|
-
let
|
|
3082
|
+
}, hn = ({ options: e, children: t }) => {
|
|
3083
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: d, thumbnailsEnabled: g, readsDownload: _ } = r ?? {}, v = x(), y = b(), [S, C] = h(null), [w, T] = h(null), E = n?.media ?? S;
|
|
3084
|
+
f(() => (v?.(E), () => v?.(null)), [E, v]), fe(E);
|
|
3085
|
+
let { expose: O } = e, k = O === !0 ? {} : O || void 0, A = m(k);
|
|
3086
|
+
A.current = k;
|
|
3087
|
+
let j = k ? k.id : void 0, M = k ? k.origin : void 0, N = k ? k.channel : void 0;
|
|
2976
3088
|
f(() => {
|
|
2977
|
-
if (!
|
|
3089
|
+
if (!O || !E) return;
|
|
2978
3090
|
let e, t = !1;
|
|
2979
3091
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
2980
|
-
t || (e = n(
|
|
3092
|
+
t || (e = n(E, A.current ?? {}));
|
|
2981
3093
|
}).catch(() => {}), () => {
|
|
2982
3094
|
t = !0, e?.();
|
|
2983
3095
|
};
|
|
2984
3096
|
}, [
|
|
2985
|
-
|
|
2986
|
-
!!
|
|
2987
|
-
A,
|
|
3097
|
+
E,
|
|
3098
|
+
!!O,
|
|
2988
3099
|
j,
|
|
2989
|
-
M
|
|
2990
|
-
|
|
2991
|
-
|
|
3100
|
+
M,
|
|
3101
|
+
N
|
|
3102
|
+
]);
|
|
3103
|
+
let P = p(() => Ne(), [o]);
|
|
3104
|
+
le(S, w, r, _ ? P.push : void 0);
|
|
3105
|
+
let F = r?.normalizeVolume ?? !0, [I, L] = h(F);
|
|
2992
3106
|
f(() => {
|
|
2993
|
-
F
|
|
2994
|
-
}, [
|
|
2995
|
-
let
|
|
2996
|
-
|
|
2997
|
-
let
|
|
2998
|
-
|
|
2999
|
-
let
|
|
3000
|
-
|
|
3107
|
+
L(F);
|
|
3108
|
+
}, [F]);
|
|
3109
|
+
let R = m(r?.onNormalizeVolumeChange);
|
|
3110
|
+
R.current = r?.onNormalizeVolumeChange;
|
|
3111
|
+
let z = r?.normalizerWorkletUrl, B = m(d ?? u);
|
|
3112
|
+
B.current = d ?? u;
|
|
3113
|
+
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } = Me(S, z, I, p(() => H && o && c && l && typeof V == "number" && V >= 0 ? _ ? {
|
|
3114
|
+
tap: P,
|
|
3115
|
+
audioStreamIndex: V
|
|
3116
|
+
} : {
|
|
3117
|
+
read: (e, t) => B.current(e, t),
|
|
3001
3118
|
length: o,
|
|
3002
3119
|
publicPath: c,
|
|
3003
3120
|
libavWorkerUrl: l,
|
|
3004
|
-
audioStreamIndex:
|
|
3121
|
+
audioStreamIndex: V
|
|
3005
3122
|
} : void 0, [
|
|
3006
|
-
|
|
3123
|
+
H,
|
|
3007
3124
|
o,
|
|
3008
3125
|
c,
|
|
3009
3126
|
l,
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3127
|
+
V,
|
|
3128
|
+
_,
|
|
3129
|
+
P
|
|
3130
|
+
]), p(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), te = p(() => z && typeof AudioWorkletNode == "function" ? {
|
|
3131
|
+
enabled: I,
|
|
3132
|
+
available: !ee,
|
|
3014
3133
|
setEnabled: (e) => {
|
|
3015
|
-
|
|
3134
|
+
L(e), R.current?.(e);
|
|
3016
3135
|
}
|
|
3017
3136
|
} : null, [
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
]), { thumbnails:
|
|
3137
|
+
z,
|
|
3138
|
+
I,
|
|
3139
|
+
ee
|
|
3140
|
+
]), { thumbnails: ne, requestThumbnail: U } = he({
|
|
3022
3141
|
publicPath: c,
|
|
3023
3142
|
workerUrl: l,
|
|
3024
3143
|
length: g === !1 ? void 0 : o,
|
|
3025
3144
|
read: d ?? u,
|
|
3026
3145
|
downloadedRanges: s
|
|
3027
|
-
}),
|
|
3146
|
+
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } = ge(S, w), q = Se(n?.media ?? null, n?.pictureInPicture), J = K((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
|
|
3028
3147
|
f(() => {
|
|
3029
3148
|
J({
|
|
3030
3149
|
title: i,
|
|
@@ -3039,30 +3158,30 @@ ${Ct}
|
|
|
3039
3158
|
s,
|
|
3040
3159
|
Y
|
|
3041
3160
|
]);
|
|
3042
|
-
let
|
|
3161
|
+
let ae = n?.thumbnails?.at;
|
|
3043
3162
|
f(() => {
|
|
3044
3163
|
J({
|
|
3045
|
-
thumbnails:
|
|
3046
|
-
thumbnailAt:
|
|
3047
|
-
requestThumbnail:
|
|
3048
|
-
togglePictureInPicture:
|
|
3049
|
-
pictureInPictureMode:
|
|
3050
|
-
burnedInSubtitles:
|
|
3164
|
+
thumbnails: W,
|
|
3165
|
+
thumbnailAt: ae,
|
|
3166
|
+
requestThumbnail: U,
|
|
3167
|
+
togglePictureInPicture: G,
|
|
3168
|
+
pictureInPictureMode: re,
|
|
3169
|
+
burnedInSubtitles: ie
|
|
3051
3170
|
});
|
|
3052
3171
|
}, [
|
|
3053
3172
|
J,
|
|
3054
|
-
U,
|
|
3055
|
-
re,
|
|
3056
|
-
te,
|
|
3057
3173
|
W,
|
|
3174
|
+
ae,
|
|
3175
|
+
U,
|
|
3058
3176
|
G,
|
|
3059
|
-
|
|
3177
|
+
re,
|
|
3178
|
+
ie
|
|
3060
3179
|
]), f(() => {
|
|
3061
|
-
J({ volumeNormalizer:
|
|
3062
|
-
}, [J,
|
|
3063
|
-
J({ passThroughPictureInPicture:
|
|
3064
|
-
}, [J,
|
|
3065
|
-
let X = n?.subtitles?.selection,
|
|
3180
|
+
J({ volumeNormalizer: te });
|
|
3181
|
+
}, [J, te]), f(() => {
|
|
3182
|
+
J({ passThroughPictureInPicture: q });
|
|
3183
|
+
}, [J, q]);
|
|
3184
|
+
let X = n?.subtitles?.selection, oe = n?.audioTracks?.selection;
|
|
3066
3185
|
f(() => {
|
|
3067
3186
|
X && J({
|
|
3068
3187
|
subtitleTracks: X.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
@@ -3075,31 +3194,31 @@ ${Ct}
|
|
|
3075
3194
|
subtitleOffLabel: X.offLabel
|
|
3076
3195
|
});
|
|
3077
3196
|
}, [J, X]), f(() => {
|
|
3078
|
-
|
|
3079
|
-
audioTracks:
|
|
3197
|
+
oe && J({
|
|
3198
|
+
audioTracks: oe.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3080
3199
|
id: e,
|
|
3081
3200
|
label: t,
|
|
3082
3201
|
disabled: n
|
|
3083
3202
|
})),
|
|
3084
|
-
selectedAudioTrack:
|
|
3085
|
-
selectAudioTrack: (e) =>
|
|
3203
|
+
selectedAudioTrack: oe.selectedId ?? void 0,
|
|
3204
|
+
selectAudioTrack: (e) => oe.select(String(e))
|
|
3086
3205
|
});
|
|
3087
|
-
}, [J,
|
|
3088
|
-
let
|
|
3206
|
+
}, [J, oe]);
|
|
3207
|
+
let se = n?.quality?.selection ?? null;
|
|
3089
3208
|
return f(() => {
|
|
3090
|
-
J({ quality:
|
|
3091
|
-
}, [J,
|
|
3209
|
+
J({ quality: se });
|
|
3210
|
+
}, [J, se]), f(() => {
|
|
3092
3211
|
a && J({ chapters: a });
|
|
3093
|
-
}, [J, a]), /* @__PURE__ */ D(
|
|
3094
|
-
ref:
|
|
3095
|
-
onVideoRef: n ? void 0 :
|
|
3096
|
-
onSubtitleRef:
|
|
3212
|
+
}, [J, a]), /* @__PURE__ */ D(mn, {
|
|
3213
|
+
ref: y,
|
|
3214
|
+
onVideoRef: n ? void 0 : C,
|
|
3215
|
+
onSubtitleRef: T,
|
|
3097
3216
|
overlay: e.overlay,
|
|
3098
3217
|
controls: e.controls,
|
|
3099
3218
|
shortcuts: e.shortcuts,
|
|
3100
3219
|
children: t
|
|
3101
3220
|
});
|
|
3102
|
-
},
|
|
3221
|
+
}, gn = _`
|
|
3103
3222
|
/**
|
|
3104
3223
|
* The chrome's whole scale, in one place.
|
|
3105
3224
|
*
|
|
@@ -3169,17 +3288,17 @@ ${Ct}
|
|
|
3169
3288
|
height: 100%;
|
|
3170
3289
|
width: 100%;
|
|
3171
3290
|
overflow: hidden;
|
|
3172
|
-
`,
|
|
3173
|
-
css:
|
|
3174
|
-
children: /* @__PURE__ */ D(
|
|
3291
|
+
`, _n = (e) => /* @__PURE__ */ D("div", {
|
|
3292
|
+
css: gn,
|
|
3293
|
+
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(hn, {
|
|
3175
3294
|
options: e,
|
|
3176
3295
|
children: e.children
|
|
3177
3296
|
}) })
|
|
3178
|
-
}),
|
|
3297
|
+
}), vn = (e) => !!e && typeof e == "object" && "at" in e, yn = (e) => !!e && typeof e == "object" && "selection" in e, bn = ({ blob: e, name: t }) => ({
|
|
3179
3298
|
length: e.size,
|
|
3180
3299
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3181
3300
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3182
|
-
}),
|
|
3301
|
+
}), xn = async (e, t) => {
|
|
3183
3302
|
let n = await fetch(e, {
|
|
3184
3303
|
headers: { Range: "bytes=0-1" },
|
|
3185
3304
|
credentials: t
|
|
@@ -3189,8 +3308,8 @@ ${Ct}
|
|
|
3189
3308
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3190
3309
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3191
3310
|
return i;
|
|
3192
|
-
},
|
|
3193
|
-
let i = t ?? await
|
|
3311
|
+
}, Sn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3312
|
+
let i = t ?? await xn(e, r);
|
|
3194
3313
|
return {
|
|
3195
3314
|
length: i,
|
|
3196
3315
|
name: n,
|
|
@@ -3203,11 +3322,12 @@ ${Ct}
|
|
|
3203
3322
|
});
|
|
3204
3323
|
if (!o.ok) throw Error(`The source could not be read: HTTP ${o.status}`);
|
|
3205
3324
|
return o.arrayBuffer();
|
|
3206
|
-
}
|
|
3325
|
+
},
|
|
3326
|
+
readsDownload: !0
|
|
3207
3327
|
};
|
|
3208
|
-
},
|
|
3209
|
-
if ("blob" in e) return
|
|
3210
|
-
if ("url" in e) return
|
|
3328
|
+
}, Cn = async (e) => {
|
|
3329
|
+
if ("blob" in e) return bn(e);
|
|
3330
|
+
if ("url" in e) return Sn(e);
|
|
3211
3331
|
if ("read" in e) return {
|
|
3212
3332
|
length: e.length,
|
|
3213
3333
|
name: e.name,
|
|
@@ -3216,4 +3336,4 @@ ${Ct}
|
|
|
3216
3336
|
throw Error(`Unknown source type: ${e}`);
|
|
3217
3337
|
};
|
|
3218
3338
|
//#endregion
|
|
3219
|
-
export {
|
|
3339
|
+
export { _n as MediaPlayer, _n as default, G as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, Cn as inputToRemuxerInput, yn as isDelegatedTracks, vn as isExternalThumbnails, W as sourceFeature, a as startPlayback, ge as usePictureInPicture, K as usePlayer, he as useSeekThumbnails };
|