@banou/media-player 0.10.21 → 0.10.22
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 +6 -1
- 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-Cr_7OImR.js} +120 -103
- package/dist/index.d.ts +1 -1
- package/dist/index.js +511 -442
- package/dist/react/hooks/use-playback.d.ts +2 -1
- package/dist/react/hooks/use-volume-normalizer.d.ts +6 -2
- 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 +3 -3
- 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 +21 -1
- package/src/lib/index.tsx +1 -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/video-player.tsx +26 -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-Cr_7OImR.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,9 +264,10 @@ 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
272
|
}, ue = 5e3, de = 6e4, fe = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
270
273
|
let [o, s] = h([]), c = m(null), l = m(r);
|
|
@@ -459,49 +462,50 @@ var W = {
|
|
|
459
462
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
460
463
|
for (let e of [...c]) e();
|
|
461
464
|
c.clear();
|
|
462
|
-
}, u = () => new Promise((e) => c.add(e)), d = (e, t
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
465
|
+
}, u = () => new Promise((e) => c.add(e)), d = async (e, t, n) => {
|
|
466
|
+
let r = Math.min(t + n, e.length);
|
|
467
|
+
for (; o && !o.some(([e, n]) => e <= t && r <= n);) if (a || await new Promise((e) => s.add(e))) throw Error("Cancelled");
|
|
468
|
+
return e.read(t, n);
|
|
469
|
+
}, f = (e) => {
|
|
466
470
|
for (let t of [...s]) t(e);
|
|
467
471
|
s.clear();
|
|
468
|
-
},
|
|
472
|
+
}, p;
|
|
469
473
|
try {
|
|
470
|
-
|
|
474
|
+
p = new Worker(r, { type: "module" });
|
|
471
475
|
} catch (e) {
|
|
472
476
|
return console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), {
|
|
473
477
|
update: () => {},
|
|
474
478
|
stop: () => {}
|
|
475
479
|
};
|
|
476
480
|
}
|
|
477
|
-
let
|
|
478
|
-
|
|
481
|
+
let m = new MessageChannel();
|
|
482
|
+
p.postMessage({
|
|
479
483
|
type: "port",
|
|
480
|
-
port:
|
|
481
|
-
}, [
|
|
482
|
-
let
|
|
484
|
+
port: m.port1
|
|
485
|
+
}, [m.port1]), t.port.postMessage({ analysis: m.port2 }, [m.port2]);
|
|
486
|
+
let h = {
|
|
483
487
|
spans: [],
|
|
484
488
|
end: null
|
|
485
|
-
},
|
|
486
|
-
|
|
489
|
+
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
490
|
+
p.onmessage = ({ data: e }) => {
|
|
487
491
|
if (e.type === "unsupported") {
|
|
488
492
|
U();
|
|
489
493
|
return;
|
|
490
494
|
}
|
|
491
|
-
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(
|
|
495
|
+
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
492
496
|
spans: e.spans,
|
|
493
497
|
end: e.end
|
|
494
|
-
}), e.type === "merged" && (
|
|
498
|
+
}), e.type === "merged" && (y = e.run), _.get(`${e.type}:${e.run}`)?.(h), _.delete(`${e.type}:${e.run}`), l();
|
|
495
499
|
};
|
|
496
|
-
let
|
|
500
|
+
let b = t.context, x = () => t.port.postMessage({
|
|
497
501
|
media: n.currentTime,
|
|
498
|
-
ctx:
|
|
502
|
+
ctx: b.currentTime,
|
|
499
503
|
rate: n.playbackRate,
|
|
500
504
|
paused: n.paused || n.seeking || n.readyState < 3
|
|
501
|
-
}),
|
|
505
|
+
}), S = () => p.postMessage({
|
|
502
506
|
type: "playhead",
|
|
503
507
|
time: n.currentTime
|
|
504
|
-
}),
|
|
508
|
+
}), C = setInterval(x, De), T = [
|
|
505
509
|
"play",
|
|
506
510
|
"playing",
|
|
507
511
|
"pause",
|
|
@@ -511,64 +515,64 @@ var W = {
|
|
|
511
515
|
"waiting",
|
|
512
516
|
"ended"
|
|
513
517
|
];
|
|
514
|
-
for (let e of
|
|
515
|
-
let
|
|
518
|
+
for (let e of T) n.addEventListener(e, x);
|
|
519
|
+
let E = Infinity, D = !1, O = 0, k = !1, A = 0, j = 0, M = /* @__PURE__ */ new Map(), N = (e) => {
|
|
516
520
|
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 + we) return r &&
|
|
521
|
+
for (let [e, n] of h.spans) e <= t && t < n && (t = n);
|
|
522
|
+
return t >= (h.end ?? E) - .05 ? null : t;
|
|
523
|
+
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
524
|
+
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
525
|
+
if (t !== null && t < e + we) return r && A <= t + 1 && t <= j + Te ? "read" : P(t);
|
|
522
526
|
if (r) return "read";
|
|
523
|
-
let i = t ??
|
|
524
|
-
return i === null ? "done" :
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
})])),
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
|
|
527
|
+
let i = t ?? N(0);
|
|
528
|
+
return i === null ? "done" : P(i);
|
|
529
|
+
}, I = () => {}, L = (e) => (e.catch(() => {}), Promise.race([e, new Promise((e) => {
|
|
530
|
+
I = () => e(void 0);
|
|
531
|
+
})])), R = () => {
|
|
532
|
+
S(), D && s.size && typeof F() == "number" && I(), l();
|
|
533
|
+
}, z = () => {
|
|
534
|
+
S(), l();
|
|
531
535
|
};
|
|
532
|
-
n.addEventListener("seeking",
|
|
533
|
-
let
|
|
534
|
-
if (!
|
|
535
|
-
|
|
536
|
-
let t =
|
|
537
|
-
|
|
536
|
+
n.addEventListener("seeking", R), n.addEventListener("seeked", z), n.addEventListener("timeupdate", z);
|
|
537
|
+
let B, V = async (e) => {
|
|
538
|
+
if (!k) return;
|
|
539
|
+
k = !1;
|
|
540
|
+
let t = v("ended", O);
|
|
541
|
+
p.postMessage({
|
|
538
542
|
type: "end",
|
|
539
|
-
run:
|
|
543
|
+
run: O,
|
|
540
544
|
finished: e
|
|
541
545
|
}), await t;
|
|
542
|
-
},
|
|
543
|
-
if (
|
|
544
|
-
let t =
|
|
545
|
-
|
|
546
|
+
}, H = async (e) => {
|
|
547
|
+
if (j = e.pts + e.duration, !e.data.byteLength) return;
|
|
548
|
+
let t = v("ack", O);
|
|
549
|
+
p.postMessage({
|
|
546
550
|
type: "fragment",
|
|
547
|
-
run:
|
|
551
|
+
run: O,
|
|
548
552
|
data: e.data
|
|
549
553
|
}, [e.data]), await t;
|
|
550
|
-
},
|
|
551
|
-
if (
|
|
552
|
-
publicPath:
|
|
553
|
-
workerUrl:
|
|
554
|
+
}, ee = async (t) => {
|
|
555
|
+
if (B = await w({
|
|
556
|
+
publicPath: t.publicPath,
|
|
557
|
+
workerUrl: t.libavWorkerUrl,
|
|
554
558
|
workerOptions: { type: "module" },
|
|
555
|
-
length:
|
|
556
|
-
read:
|
|
557
|
-
audioStreamIndex:
|
|
558
|
-
}), a) return e(
|
|
559
|
-
let
|
|
559
|
+
length: t.length,
|
|
560
|
+
read: (e, n) => d(t, e, n),
|
|
561
|
+
audioStreamIndex: t.audioStreamIndex
|
|
562
|
+
}), a) return e(B);
|
|
563
|
+
let n = await B.init();
|
|
560
564
|
if (!a) {
|
|
561
|
-
for (
|
|
565
|
+
for (E = n.info.input.duration || Infinity, p.postMessage({
|
|
562
566
|
type: "init",
|
|
563
|
-
data:
|
|
564
|
-
codec:
|
|
565
|
-
}, [
|
|
567
|
+
data: n.data,
|
|
568
|
+
codec: n.info.output.audioMimeType
|
|
569
|
+
}, [n.data]), k = !0, D = !0, p.postMessage({
|
|
566
570
|
type: "run",
|
|
567
|
-
run:
|
|
571
|
+
run: O,
|
|
568
572
|
pts: 0,
|
|
569
573
|
start: !0
|
|
570
574
|
}); !a;) {
|
|
571
|
-
let e =
|
|
575
|
+
let e = F();
|
|
572
576
|
if (e === "done") break;
|
|
573
577
|
if (e === "idle") {
|
|
574
578
|
await u();
|
|
@@ -576,45 +580,79 @@ var W = {
|
|
|
576
580
|
}
|
|
577
581
|
try {
|
|
578
582
|
if (e === "read") {
|
|
579
|
-
let e = await
|
|
583
|
+
let e = await L(B.read());
|
|
580
584
|
if (a) return;
|
|
581
585
|
if (!e) continue;
|
|
582
|
-
await
|
|
586
|
+
await H(e), e.finished && await V(!0);
|
|
583
587
|
} else {
|
|
584
|
-
await
|
|
585
|
-
let t =
|
|
586
|
-
|
|
587
|
-
let n = await
|
|
588
|
+
await V(!1), M.set(Math.round(e * 10), g);
|
|
589
|
+
let t = B.seek(Math.max(0, e - Ee));
|
|
590
|
+
f(!0);
|
|
591
|
+
let n = await L(t);
|
|
588
592
|
if (a) return;
|
|
589
593
|
if (!n) continue;
|
|
590
|
-
|
|
594
|
+
O++, k = !0, A = n.pts, p.postMessage({
|
|
591
595
|
type: "run",
|
|
592
|
-
run:
|
|
596
|
+
run: O,
|
|
593
597
|
pts: n.pts,
|
|
594
598
|
start: n.pts <= 0
|
|
595
|
-
}), await
|
|
599
|
+
}), await H(n), n.finished && await V(!0);
|
|
596
600
|
}
|
|
597
601
|
} catch {
|
|
598
602
|
if (a) return;
|
|
599
|
-
await
|
|
603
|
+
await V(!1), typeof F() != "number" && await u();
|
|
600
604
|
}
|
|
601
605
|
}
|
|
602
|
-
e(
|
|
606
|
+
e(B), B = void 0;
|
|
603
607
|
}
|
|
608
|
+
}, te = () => {}, ne = (e, t) => {
|
|
609
|
+
let n = !1, r = (e) => {
|
|
610
|
+
n && p.postMessage({
|
|
611
|
+
type: "end",
|
|
612
|
+
run: O,
|
|
613
|
+
finished: e
|
|
614
|
+
}), n = !1;
|
|
615
|
+
};
|
|
616
|
+
te = e.attach(t, (e, t) => {
|
|
617
|
+
if (e.type === "init") {
|
|
618
|
+
r(!1);
|
|
619
|
+
let t = e.data.slice(0);
|
|
620
|
+
p.postMessage({
|
|
621
|
+
type: "init",
|
|
622
|
+
data: t,
|
|
623
|
+
codec: e.audioMimeType
|
|
624
|
+
}, [t]);
|
|
625
|
+
} else if (e.type === "run") r(!1), n = !0, p.postMessage({
|
|
626
|
+
type: "run",
|
|
627
|
+
run: ++O,
|
|
628
|
+
pts: e.pts,
|
|
629
|
+
start: !t && e.pts <= 0,
|
|
630
|
+
join: t
|
|
631
|
+
});
|
|
632
|
+
else if (e.type === "end") r(!0);
|
|
633
|
+
else if (n) {
|
|
634
|
+
let t = e.data.slice(0);
|
|
635
|
+
p.postMessage({
|
|
636
|
+
type: "fragment",
|
|
637
|
+
run: O,
|
|
638
|
+
data: t
|
|
639
|
+
}, [t]);
|
|
640
|
+
}
|
|
641
|
+
});
|
|
604
642
|
}, U = () => {
|
|
605
643
|
if (!a) {
|
|
606
|
-
a = !0,
|
|
607
|
-
for (let e of
|
|
608
|
-
n.removeEventListener("seeking",
|
|
609
|
-
for (let e of
|
|
610
|
-
|
|
644
|
+
a = !0, f(!0), l(), clearInterval(C);
|
|
645
|
+
for (let e of T) n.removeEventListener(e, x);
|
|
646
|
+
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z), te(), B && e(B), p.terminate(), t.port.postMessage({ analysis: null });
|
|
647
|
+
for (let e of _.values()) e(h);
|
|
648
|
+
_.clear();
|
|
611
649
|
}
|
|
612
650
|
};
|
|
613
|
-
return
|
|
651
|
+
return "tap" in i ? ne(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
|
|
614
652
|
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), U());
|
|
615
|
-
}),
|
|
653
|
+
}), S(), {
|
|
616
654
|
update: (e) => {
|
|
617
|
-
o = e,
|
|
655
|
+
o = e, f(!1);
|
|
618
656
|
},
|
|
619
657
|
stop: U
|
|
620
658
|
};
|
|
@@ -643,7 +681,7 @@ var W = {
|
|
|
643
681
|
u.current = i;
|
|
644
682
|
let d = m(null), p = m(r);
|
|
645
683
|
p.current = r;
|
|
646
|
-
let { length: g, publicPath: _, libavWorkerUrl: v
|
|
684
|
+
let { length: g, publicPath: _, libavWorkerUrl: v } = r && "read" in r ? r : {}, y = r && "tap" in r ? r.tap : void 0, b = r?.audioStreamIndex;
|
|
647
685
|
return f(() => {
|
|
648
686
|
let r = p.current;
|
|
649
687
|
if (!c || !e || !t || !n || !r) return;
|
|
@@ -664,10 +702,33 @@ var W = {
|
|
|
664
702
|
g,
|
|
665
703
|
_,
|
|
666
704
|
v,
|
|
705
|
+
b,
|
|
667
706
|
y
|
|
668
707
|
]), f(() => {
|
|
669
708
|
d.current?.update(i);
|
|
670
709
|
}, [i]), { refused: o };
|
|
710
|
+
}, Ae = () => {
|
|
711
|
+
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
712
|
+
return {
|
|
713
|
+
push: (n) => {
|
|
714
|
+
n.type === "init" ? (e = n, t = void 0) : n.type === "run" ? t = {
|
|
715
|
+
pts: n.pts,
|
|
716
|
+
begun: !1
|
|
717
|
+
} : n.type === "fragment" && t && (t.begun = !0), r()?.take(n);
|
|
718
|
+
},
|
|
719
|
+
attach: (i, a) => {
|
|
720
|
+
let o = {
|
|
721
|
+
audioStreamIndex: i,
|
|
722
|
+
take: a
|
|
723
|
+
};
|
|
724
|
+
return n = o, r() && e && (a(e), t && a({
|
|
725
|
+
type: "run",
|
|
726
|
+
pts: t.pts
|
|
727
|
+
}, t.begun)), () => {
|
|
728
|
+
n === o && (n = void 0);
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
};
|
|
671
732
|
}, Z = {
|
|
672
733
|
headings: {
|
|
673
734
|
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 +756,7 @@ var W = {
|
|
|
695
756
|
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
757
|
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
758
|
}
|
|
698
|
-
},
|
|
759
|
+
}, je = _`
|
|
699
760
|
display: flex;
|
|
700
761
|
justify-content: center;
|
|
701
762
|
align-items: center;
|
|
@@ -708,7 +769,7 @@ var W = {
|
|
|
708
769
|
margin: auto;
|
|
709
770
|
pointer-events: none;
|
|
710
771
|
}
|
|
711
|
-
`,
|
|
772
|
+
`, Me = _`
|
|
712
773
|
position: absolute;
|
|
713
774
|
top: 0;
|
|
714
775
|
left: 0;
|
|
@@ -737,9 +798,9 @@ var W = {
|
|
|
737
798
|
|
|
738
799
|
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
800
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
740
|
-
`,
|
|
801
|
+
`, Ne = v`
|
|
741
802
|
to { transform: rotate(360deg); }
|
|
742
|
-
`,
|
|
803
|
+
`, Pe = _`
|
|
743
804
|
position: absolute;
|
|
744
805
|
inset: 0;
|
|
745
806
|
z-index: 2;
|
|
@@ -755,9 +816,9 @@ var W = {
|
|
|
755
816
|
border-radius: 50%;
|
|
756
817
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
757
818
|
border-top-color: #fff;
|
|
758
|
-
animation: ${
|
|
819
|
+
animation: ${Ne} 0.8s linear infinite;
|
|
759
820
|
}
|
|
760
|
-
`,
|
|
821
|
+
`, Fe = _`
|
|
761
822
|
position: absolute;
|
|
762
823
|
inset: auto 0 20%;
|
|
763
824
|
z-index: 3;
|
|
@@ -767,34 +828,34 @@ var W = {
|
|
|
767
828
|
${Z.bLarge.regular}
|
|
768
829
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
769
830
|
pointer-events: none;
|
|
770
|
-
`,
|
|
771
|
-
let t =
|
|
831
|
+
`, Ie = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Le = ({ onSubtitleRef: e }) => {
|
|
832
|
+
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
833
|
return /* @__PURE__ */ O(E, { children: [
|
|
773
834
|
t ? /* @__PURE__ */ D("div", {
|
|
774
835
|
className: "title",
|
|
775
|
-
css:
|
|
836
|
+
css: Me,
|
|
776
837
|
style: { ...n ? {
|
|
777
838
|
opacity: "0",
|
|
778
839
|
pointerEvents: "none"
|
|
779
840
|
} : {} },
|
|
780
841
|
children: t
|
|
781
842
|
}) : void 0,
|
|
782
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css:
|
|
843
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Pe }) : void 0,
|
|
783
844
|
r ? /* @__PURE__ */ D("div", {
|
|
784
|
-
css:
|
|
785
|
-
children:
|
|
845
|
+
css: Fe,
|
|
846
|
+
children: Ie(r)
|
|
786
847
|
}) : void 0,
|
|
787
848
|
/* @__PURE__ */ D("div", {
|
|
788
849
|
className: "subtitles",
|
|
789
850
|
ref: e,
|
|
790
|
-
css:
|
|
851
|
+
css: je
|
|
791
852
|
})
|
|
792
853
|
] });
|
|
793
|
-
},
|
|
854
|
+
}, Re = 1e-4, ze = 1, Be = (e) => Math.max(Re, Math.min(ze, e)) ** 2, Ve = (e) => Math.max(Re, Math.min(ze, e)) ** (ze / 2), He = (e) => {
|
|
794
855
|
if (e === void 0) return "0:00";
|
|
795
856
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
796
857
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
797
|
-
},
|
|
858
|
+
}, Ue = (e, t) => `${He(e)} / ${He(t)}`, We = (e) => _`
|
|
798
859
|
display: flex;
|
|
799
860
|
justify-content: flex-start;
|
|
800
861
|
|
|
@@ -842,17 +903,17 @@ var W = {
|
|
|
842
903
|
x: -1,
|
|
843
904
|
y: -1,
|
|
844
905
|
anchors: 0
|
|
845
|
-
},
|
|
906
|
+
}, Ge = (e) => {
|
|
846
907
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
847
|
-
},
|
|
908
|
+
}, Ke = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Ge, {
|
|
848
909
|
capture: !0,
|
|
849
910
|
passive: !0
|
|
850
911
|
}), () => {
|
|
851
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
912
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", Ge, { capture: !0 });
|
|
852
913
|
}), $ = ({ 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
914
|
let l = m(null), u = m(null);
|
|
854
915
|
return f(() => {
|
|
855
|
-
let e =
|
|
916
|
+
let e = Ke(), t = () => {
|
|
856
917
|
let e = l.current;
|
|
857
918
|
if (!e) return;
|
|
858
919
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -872,14 +933,14 @@ var W = {
|
|
|
872
933
|
"data-tooltip-delay-hide": i,
|
|
873
934
|
"data-tooltip-place": o,
|
|
874
935
|
children: n
|
|
875
|
-
}), !s && /* @__PURE__ */ D(
|
|
936
|
+
}), !s && /* @__PURE__ */ D(ne, {
|
|
876
937
|
ref: u,
|
|
877
|
-
css:
|
|
938
|
+
css: We(c),
|
|
878
939
|
id: e,
|
|
879
940
|
noArrow: !0,
|
|
880
941
|
children: t
|
|
881
942
|
})] });
|
|
882
|
-
},
|
|
943
|
+
}, qe = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
883
944
|
let [i, a] = h(!1), o = m(t);
|
|
884
945
|
o.current = t;
|
|
885
946
|
let s = m(null), c = d((t, r) => {
|
|
@@ -918,26 +979,26 @@ var W = {
|
|
|
918
979
|
style: { touchAction: "none" }
|
|
919
980
|
}
|
|
920
981
|
};
|
|
921
|
-
},
|
|
982
|
+
}, Je = 2, Ye = .005, Xe = "#000", Ze = "#0000", Qe = (e, t) => {
|
|
922
983
|
if (!t) return [];
|
|
923
984
|
let n = /* @__PURE__ */ new Set();
|
|
924
985
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
925
986
|
let r = e / t;
|
|
926
|
-
r <=
|
|
987
|
+
r <= Ye || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
927
988
|
}
|
|
928
989
|
return n.size ? [
|
|
929
990
|
0,
|
|
930
991
|
...[...n].sort((e, t) => e - t),
|
|
931
992
|
100
|
|
932
993
|
] : [];
|
|
933
|
-
},
|
|
934
|
-
let n =
|
|
994
|
+
}, $e = (e, t) => {
|
|
995
|
+
let n = Je / 2, r = e.length - 2, i = [];
|
|
935
996
|
for (let a = 0; a <= r; a += 1) {
|
|
936
997
|
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) ?
|
|
998
|
+
i.push(`${t(a) ? Xe : Ze} ${c} ${l}`), a !== r && i.push(`${Ze} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
938
999
|
}
|
|
939
1000
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
940
|
-
},
|
|
1001
|
+
}, et = /* @__PURE__ */ new Set([
|
|
941
1002
|
"op",
|
|
942
1003
|
"ops",
|
|
943
1004
|
"opening",
|
|
@@ -945,7 +1006,7 @@ var W = {
|
|
|
945
1006
|
"ncop",
|
|
946
1007
|
"オープニング",
|
|
947
1008
|
"op主題歌"
|
|
948
|
-
]),
|
|
1009
|
+
]), tt = /* @__PURE__ */ new Set([
|
|
949
1010
|
"ed",
|
|
950
1011
|
"eds",
|
|
951
1012
|
"ending",
|
|
@@ -958,13 +1019,13 @@ var W = {
|
|
|
958
1019
|
"エンドカード",
|
|
959
1020
|
"エンドロール",
|
|
960
1021
|
"ed主題歌"
|
|
961
|
-
]),
|
|
1022
|
+
]), nt = /* @__PURE__ */ new Set(["intro", "イントロ"]), rt = /* @__PURE__ */ new Set(["outro", "アウトロ"]), it = {
|
|
962
1023
|
"credits start": "ending",
|
|
963
1024
|
"credits end": null,
|
|
964
1025
|
"preview end": null,
|
|
965
1026
|
"end credits": "ending",
|
|
966
1027
|
"closing credits": "ending"
|
|
967
|
-
},
|
|
1028
|
+
}, at = /* @__PURE__ */ new Set([
|
|
968
1029
|
"theme",
|
|
969
1030
|
"themes",
|
|
970
1031
|
"song",
|
|
@@ -983,53 +1044,53 @@ var W = {
|
|
|
983
1044
|
"the",
|
|
984
1045
|
"主題歌",
|
|
985
1046
|
"ノンクレジット"
|
|
986
|
-
]),
|
|
1047
|
+
]), ot = /* @__PURE__ */ new Set([
|
|
987
1048
|
"post",
|
|
988
1049
|
"pre",
|
|
989
1050
|
"after",
|
|
990
1051
|
"before",
|
|
991
1052
|
"non"
|
|
992
|
-
]),
|
|
993
|
-
if (
|
|
994
|
-
if (
|
|
1053
|
+
]), st = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, ct = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), lt = (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) && !at.has(e)), ut = (e, t) => {
|
|
1054
|
+
if (et.has(e)) return "opening";
|
|
1055
|
+
if (tt.has(e)) return "ending";
|
|
995
1056
|
if (t) {
|
|
996
|
-
if (
|
|
997
|
-
if (
|
|
1057
|
+
if (nt.has(e)) return "opening";
|
|
1058
|
+
if (rt.has(e)) return "ending";
|
|
998
1059
|
}
|
|
999
|
-
},
|
|
1000
|
-
if (
|
|
1060
|
+
}, dt = (e, t) => {
|
|
1061
|
+
if (ct(e)) return;
|
|
1001
1062
|
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) =>
|
|
1063
|
+
if (n in it) return it[n] ?? void 0;
|
|
1064
|
+
let r = n.split(st).map((e) => e.trim()).filter(Boolean);
|
|
1065
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => ot.has(e)))) return;
|
|
1005
1066
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
1006
1067
|
for (let e of i) {
|
|
1007
|
-
let n =
|
|
1068
|
+
let n = lt(e);
|
|
1008
1069
|
if (n.length !== 1) continue;
|
|
1009
|
-
let r =
|
|
1070
|
+
let r = ut(n[0], t);
|
|
1010
1071
|
if (r) return r;
|
|
1011
1072
|
}
|
|
1012
|
-
},
|
|
1073
|
+
}, ft = 15, pt = 87, mt = 93, ht = (e) => {
|
|
1013
1074
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
1014
1075
|
if (!n) return t;
|
|
1015
1076
|
let r = e.map((e, t) => ({
|
|
1016
1077
|
index: t,
|
|
1017
1078
|
start: e.start,
|
|
1018
1079
|
length: e.end - e.start
|
|
1019
|
-
})).filter(({ length: e }) => e >=
|
|
1080
|
+
})).filter(({ length: e }) => e >= pt && e <= mt), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
1020
1081
|
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 }) =>
|
|
1082
|
+
}, gt = (e) => {
|
|
1083
|
+
let t = e.map(({ title: e }) => dt(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
1084
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
1024
1085
|
let i = e.map((e, n) => {
|
|
1025
|
-
if (e.end - e.start <
|
|
1086
|
+
if (e.end - e.start < ft) return;
|
|
1026
1087
|
let r = t[n];
|
|
1027
1088
|
if (r) return r;
|
|
1028
|
-
let i =
|
|
1089
|
+
let i = dt(e.title, !0);
|
|
1029
1090
|
return i && !t.includes(i) ? i : void 0;
|
|
1030
1091
|
});
|
|
1031
|
-
return e.every(({ title: e }) =>
|
|
1032
|
-
},
|
|
1092
|
+
return e.every(({ title: e }) => ct(e)) ? ht(e) : i;
|
|
1093
|
+
}, _t = _`
|
|
1033
1094
|
position: relative;
|
|
1034
1095
|
height: calc(.4 * var(--mp-unit));
|
|
1035
1096
|
|
|
@@ -1248,8 +1309,8 @@ var W = {
|
|
|
1248
1309
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1249
1310
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1250
1311
|
}
|
|
1251
|
-
`,
|
|
1252
|
-
let e =
|
|
1312
|
+
`, vt = 4, yt = () => {
|
|
1313
|
+
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
1314
|
C(e), u(e);
|
|
1254
1315
|
}, T = !!S;
|
|
1255
1316
|
f(() => {
|
|
@@ -1257,13 +1318,13 @@ var W = {
|
|
|
1257
1318
|
}, [_, T]), f(() => {
|
|
1258
1319
|
v && w(void 0);
|
|
1259
1320
|
}, [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 } =
|
|
1321
|
+
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = qe({
|
|
1261
1322
|
ref: y,
|
|
1262
1323
|
onChange: (e) => {
|
|
1263
1324
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1264
1325
|
else if (!M.current) {
|
|
1265
1326
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1266
|
-
Math.abs(e - j.current) * t >
|
|
1327
|
+
Math.abs(e - j.current) * t > vt && (M.current = !0);
|
|
1267
1328
|
}
|
|
1268
1329
|
x(e), E.current !== "mouse" && w(e * r);
|
|
1269
1330
|
}
|
|
@@ -1315,7 +1376,7 @@ var W = {
|
|
|
1315
1376
|
b,
|
|
1316
1377
|
r
|
|
1317
1378
|
]);
|
|
1318
|
-
let
|
|
1379
|
+
let ne = p(() => {
|
|
1319
1380
|
if (!r) return 0;
|
|
1320
1381
|
if (N && b !== void 0) return b;
|
|
1321
1382
|
let e = g ?? t;
|
|
@@ -1326,22 +1387,22 @@ var W = {
|
|
|
1326
1387
|
N,
|
|
1327
1388
|
b,
|
|
1328
1389
|
g
|
|
1329
|
-
]),
|
|
1330
|
-
if (!
|
|
1331
|
-
let e = S / r * 100, t =
|
|
1332
|
-
return t >= 0 ? t :
|
|
1390
|
+
]), U = p(() => Qe(d, r), [d, r]), W = U.length > 0, G = p(() => {
|
|
1391
|
+
if (!W || S === void 0 || !r) return -1;
|
|
1392
|
+
let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
|
|
1393
|
+
return t >= 0 ? t : U.length - 2;
|
|
1333
1394
|
}, [
|
|
1334
|
-
G,
|
|
1335
1395
|
W,
|
|
1396
|
+
U,
|
|
1336
1397
|
S,
|
|
1337
1398
|
r
|
|
1338
|
-
]),
|
|
1339
|
-
G,
|
|
1399
|
+
]), re = p(() => W ? $e(U, (e) => e !== G) : void 0, [
|
|
1340
1400
|
W,
|
|
1341
|
-
|
|
1342
|
-
|
|
1401
|
+
U,
|
|
1402
|
+
G
|
|
1403
|
+
]), ie = p(() => G >= 0 ? $e(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
|
|
1343
1404
|
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1344
|
-
}, [d, S]),
|
|
1405
|
+
}, [d, S]), J = p(() => {
|
|
1345
1406
|
if (S) {
|
|
1346
1407
|
if (l) return l(S);
|
|
1347
1408
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
|
|
@@ -1350,7 +1411,7 @@ var W = {
|
|
|
1350
1411
|
c,
|
|
1351
1412
|
l,
|
|
1352
1413
|
S
|
|
1353
|
-
]),
|
|
1414
|
+
]), Y = (e, t) => /* @__PURE__ */ O("div", {
|
|
1354
1415
|
className: e ? `track ${e}` : "track",
|
|
1355
1416
|
style: t ? { maskImage: t } : void 0,
|
|
1356
1417
|
children: [
|
|
@@ -1363,42 +1424,42 @@ var W = {
|
|
|
1363
1424
|
className: "play-container",
|
|
1364
1425
|
children: /* @__PURE__ */ D("div", {
|
|
1365
1426
|
className: "play",
|
|
1366
|
-
style: { transform: `scaleX(${
|
|
1427
|
+
style: { transform: `scaleX(${ne})` }
|
|
1367
1428
|
})
|
|
1368
1429
|
})
|
|
1369
1430
|
]
|
|
1370
1431
|
});
|
|
1371
1432
|
return /* @__PURE__ */ O("div", {
|
|
1372
|
-
css:
|
|
1433
|
+
css: _t,
|
|
1373
1434
|
ref: y,
|
|
1374
1435
|
className: [
|
|
1375
1436
|
"progress-bar",
|
|
1376
1437
|
N ? "dragging" : "",
|
|
1377
|
-
|
|
1438
|
+
W ? "segmented" : ""
|
|
1378
1439
|
].filter(Boolean).join(" "),
|
|
1379
1440
|
onPointerDown: z,
|
|
1380
1441
|
onPointerMove: z,
|
|
1381
1442
|
onMouseMove: B,
|
|
1382
1443
|
onMouseOut: V,
|
|
1383
1444
|
children: [
|
|
1384
|
-
|
|
1445
|
+
Y(void 0, re),
|
|
1385
1446
|
S ? /* @__PURE__ */ O("div", {
|
|
1386
1447
|
className: "cursor-time",
|
|
1387
1448
|
style: {
|
|
1388
|
-
left:
|
|
1389
|
-
maxWidth:
|
|
1449
|
+
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))))`,
|
|
1450
|
+
maxWidth: q ? "var(--thumbnail-width)" : void 0
|
|
1390
1451
|
},
|
|
1391
1452
|
children: [/* @__PURE__ */ D("span", {
|
|
1392
1453
|
className: "cursor-time-value",
|
|
1393
|
-
children:
|
|
1394
|
-
}),
|
|
1454
|
+
children: He(S)
|
|
1455
|
+
}), q ? /* @__PURE__ */ D("span", {
|
|
1395
1456
|
className: "chapter-title",
|
|
1396
|
-
children:
|
|
1457
|
+
children: q.title
|
|
1397
1458
|
}) : void 0]
|
|
1398
1459
|
}) : void 0,
|
|
1399
1460
|
/* @__PURE__ */ D("div", { className: "progress" }),
|
|
1400
1461
|
/* @__PURE__ */ D("div", { className: "hover" }),
|
|
1401
|
-
|
|
1462
|
+
ie ? Y("focus", ie) : void 0,
|
|
1402
1463
|
/* @__PURE__ */ D("div", { className: "scrubber" }),
|
|
1403
1464
|
/* @__PURE__ */ D("div", {
|
|
1404
1465
|
className: "padding",
|
|
@@ -1410,11 +1471,11 @@ var W = {
|
|
|
1410
1471
|
/* @__PURE__ */ D("div", {
|
|
1411
1472
|
className: "thumbnail",
|
|
1412
1473
|
style: { left: `clamp(var(--thumbnail-half), ${H(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1413
|
-
children:
|
|
1474
|
+
children: J?.url ? /* @__PURE__ */ D("img", { src: J.url }) : void 0
|
|
1414
1475
|
})
|
|
1415
1476
|
]
|
|
1416
1477
|
});
|
|
1417
|
-
},
|
|
1478
|
+
}, bt = "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", xt = {
|
|
1418
1479
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1419
1480
|
width: 24,
|
|
1420
1481
|
height: 24,
|
|
@@ -1424,8 +1485,8 @@ var W = {
|
|
|
1424
1485
|
strokeWidth: 2,
|
|
1425
1486
|
strokeLinecap: "round",
|
|
1426
1487
|
strokeLinejoin: "round"
|
|
1427
|
-
},
|
|
1428
|
-
...
|
|
1488
|
+
}, St = (e) => /* @__PURE__ */ O("svg", {
|
|
1489
|
+
...xt,
|
|
1429
1490
|
...e,
|
|
1430
1491
|
children: [
|
|
1431
1492
|
/* @__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 +1500,8 @@ var W = {
|
|
|
1439
1500
|
}),
|
|
1440
1501
|
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1441
1502
|
]
|
|
1442
|
-
}),
|
|
1443
|
-
...
|
|
1503
|
+
}), Ct = (e) => /* @__PURE__ */ O("svg", {
|
|
1504
|
+
...xt,
|
|
1444
1505
|
...e,
|
|
1445
1506
|
children: [
|
|
1446
1507
|
/* @__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 +1515,7 @@ var W = {
|
|
|
1454
1515
|
}),
|
|
1455
1516
|
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1456
1517
|
]
|
|
1457
|
-
}),
|
|
1518
|
+
}), wt = _`
|
|
1458
1519
|
.popover {
|
|
1459
1520
|
position: absolute;
|
|
1460
1521
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1581,7 +1642,7 @@ var W = {
|
|
|
1581
1642
|
${Z.bSmall.regular}
|
|
1582
1643
|
}
|
|
1583
1644
|
}
|
|
1584
|
-
`,
|
|
1645
|
+
`, Tt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1585
1646
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1586
1647
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1587
1648
|
return /* @__PURE__ */ O("div", {
|
|
@@ -1608,7 +1669,7 @@ var W = {
|
|
|
1608
1669
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1609
1670
|
]
|
|
1610
1671
|
});
|
|
1611
|
-
},
|
|
1672
|
+
}, Et = ({ onReset: e } = {}) => {
|
|
1612
1673
|
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1613
1674
|
c.current = e;
|
|
1614
1675
|
let l = () => {
|
|
@@ -1649,7 +1710,7 @@ var W = {
|
|
|
1649
1710
|
});
|
|
1650
1711
|
}
|
|
1651
1712
|
};
|
|
1652
|
-
},
|
|
1713
|
+
}, Dt = _`
|
|
1653
1714
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1654
1715
|
which is the width of the player box, so it can be clamped to it. */
|
|
1655
1716
|
position: static;
|
|
@@ -1665,7 +1726,7 @@ position: static;
|
|
|
1665
1726
|
}
|
|
1666
1727
|
}
|
|
1667
1728
|
|
|
1668
|
-
${
|
|
1729
|
+
${wt}
|
|
1669
1730
|
|
|
1670
1731
|
.popover.error-list {
|
|
1671
1732
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1737,23 +1798,23 @@ ${Ct}
|
|
|
1737
1798
|
}
|
|
1738
1799
|
}
|
|
1739
1800
|
}
|
|
1740
|
-
`,
|
|
1741
|
-
let n =
|
|
1801
|
+
`, Ot = (e) => new Date(e).toLocaleTimeString(), kt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : He(Math.max(0, e)), At = (e) => e.reduce((e, t) => e + t.count, 0), jt = (e) => e.map((e, t) => {
|
|
1802
|
+
let n = kt(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
1803
|
return [
|
|
1743
1804
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1744
1805
|
e.message,
|
|
1745
1806
|
e.detail
|
|
1746
1807
|
].filter(Boolean).join("\n");
|
|
1747
|
-
}).join("\n\n"),
|
|
1748
|
-
let e =
|
|
1808
|
+
}).join("\n\n"), Mt = () => {
|
|
1809
|
+
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Et(), [i, a] = h(!1);
|
|
1749
1810
|
if (e.length === 0) return null;
|
|
1750
1811
|
let o = () => {
|
|
1751
|
-
navigator.clipboard?.writeText(
|
|
1812
|
+
navigator.clipboard?.writeText(jt(e)).then(() => {
|
|
1752
1813
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1753
1814
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1754
|
-
}, s = `Playback errors (${
|
|
1815
|
+
}, s = `Playback errors (${At(e)})`;
|
|
1755
1816
|
return /* @__PURE__ */ O("div", {
|
|
1756
|
-
css:
|
|
1817
|
+
css: Dt,
|
|
1757
1818
|
ref: r,
|
|
1758
1819
|
children: [/* @__PURE__ */ D($, {
|
|
1759
1820
|
id: "errors",
|
|
@@ -1784,9 +1845,9 @@ ${Ct}
|
|
|
1784
1845
|
/* @__PURE__ */ O("span", {
|
|
1785
1846
|
className: "when",
|
|
1786
1847
|
children: [
|
|
1787
|
-
|
|
1788
|
-
e.count > 1 ? ` to ${
|
|
1789
|
-
|
|
1848
|
+
Ot(e.at),
|
|
1849
|
+
e.count > 1 ? ` to ${Ot(e.lastAt)}` : "",
|
|
1850
|
+
kt(e.atMediaTime) ? ` at ${kt(e.atMediaTime)}` : "",
|
|
1790
1851
|
e.recovered ? " recovered" : "",
|
|
1791
1852
|
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1792
1853
|
className: "count",
|
|
@@ -1806,7 +1867,7 @@ ${Ct}
|
|
|
1806
1867
|
}, `${e.at}-${t}`))]
|
|
1807
1868
|
})]
|
|
1808
1869
|
});
|
|
1809
|
-
},
|
|
1870
|
+
}, Nt = _`
|
|
1810
1871
|
display: flex;
|
|
1811
1872
|
align-items: center;
|
|
1812
1873
|
justify-content: center;
|
|
@@ -1859,8 +1920,8 @@ width: 100%;
|
|
|
1859
1920
|
}
|
|
1860
1921
|
}
|
|
1861
1922
|
}
|
|
1862
|
-
`,
|
|
1863
|
-
let e =
|
|
1923
|
+
`, Pt = () => {
|
|
1924
|
+
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 } = qe({
|
|
1864
1925
|
ref: r,
|
|
1865
1926
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1866
1927
|
}), d = (t) => {
|
|
@@ -1876,7 +1937,7 @@ width: 100%;
|
|
|
1876
1937
|
}, [t]);
|
|
1877
1938
|
let p = c(s);
|
|
1878
1939
|
return /* @__PURE__ */ O("div", {
|
|
1879
|
-
css:
|
|
1940
|
+
css: Nt,
|
|
1880
1941
|
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1881
1942
|
className: "playback-slider",
|
|
1882
1943
|
ref: n,
|
|
@@ -1894,7 +1955,7 @@ width: 100%;
|
|
|
1894
1955
|
})
|
|
1895
1956
|
})]
|
|
1896
1957
|
});
|
|
1897
|
-
},
|
|
1958
|
+
}, Ft = _`
|
|
1898
1959
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1899
1960
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1900
1961
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1912,7 +1973,7 @@ position: static;
|
|
|
1912
1973
|
}
|
|
1913
1974
|
}
|
|
1914
1975
|
|
|
1915
|
-
${
|
|
1976
|
+
${wt}
|
|
1916
1977
|
|
|
1917
1978
|
.switch {
|
|
1918
1979
|
position: relative;
|
|
@@ -1988,8 +2049,8 @@ ${Ct}
|
|
|
1988
2049
|
}
|
|
1989
2050
|
}
|
|
1990
2051
|
|
|
1991
|
-
`,
|
|
1992
|
-
let e =
|
|
2052
|
+
`, It = () => {
|
|
2053
|
+
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 } = Et({ onReset: () => c(0) }), g = (t) => {
|
|
1993
2054
|
e.setPlaybackRate(t), c(0);
|
|
1994
2055
|
}, _ = (e) => {
|
|
1995
2056
|
e !== void 0 && m(e, () => i(e));
|
|
@@ -1999,7 +2060,7 @@ ${Ct}
|
|
|
1999
2060
|
c(e);
|
|
2000
2061
|
};
|
|
2001
2062
|
return /* @__PURE__ */ O("div", {
|
|
2002
|
-
css:
|
|
2063
|
+
css: Ft,
|
|
2003
2064
|
ref: d,
|
|
2004
2065
|
children: [
|
|
2005
2066
|
/* @__PURE__ */ D($, {
|
|
@@ -2061,7 +2122,7 @@ ${Ct}
|
|
|
2061
2122
|
}),
|
|
2062
2123
|
/* @__PURE__ */ D("div", {
|
|
2063
2124
|
className: "slider no-hover",
|
|
2064
|
-
children: /* @__PURE__ */ D(
|
|
2125
|
+
children: /* @__PURE__ */ D(Pt, {})
|
|
2065
2126
|
}),
|
|
2066
2127
|
/* @__PURE__ */ O("div", {
|
|
2067
2128
|
className: "options no-hover",
|
|
@@ -2086,7 +2147,7 @@ ${Ct}
|
|
|
2086
2147
|
})
|
|
2087
2148
|
]
|
|
2088
2149
|
}),
|
|
2089
|
-
l && s === 2 && /* @__PURE__ */ D(
|
|
2150
|
+
l && s === 2 && /* @__PURE__ */ D(Tt, {
|
|
2090
2151
|
title: "Audio",
|
|
2091
2152
|
tracks: n,
|
|
2092
2153
|
selected: r,
|
|
@@ -2095,7 +2156,7 @@ ${Ct}
|
|
|
2095
2156
|
pending: f,
|
|
2096
2157
|
failed: p
|
|
2097
2158
|
}),
|
|
2098
|
-
l && s === 3 && a && /* @__PURE__ */ D(
|
|
2159
|
+
l && s === 3 && a && /* @__PURE__ */ D(Tt, {
|
|
2099
2160
|
title: "Quality",
|
|
2100
2161
|
tracks: a.options,
|
|
2101
2162
|
selected: a.selectedId ?? void 0,
|
|
@@ -2107,7 +2168,7 @@ ${Ct}
|
|
|
2107
2168
|
})
|
|
2108
2169
|
]
|
|
2109
2170
|
});
|
|
2110
|
-
},
|
|
2171
|
+
}, Lt = _`
|
|
2111
2172
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2112
2173
|
which is the width of the player box, so it can be clamped to it. */
|
|
2113
2174
|
position: static;
|
|
@@ -2123,13 +2184,13 @@ position: static;
|
|
|
2123
2184
|
}
|
|
2124
2185
|
}
|
|
2125
2186
|
|
|
2126
|
-
${
|
|
2127
|
-
`,
|
|
2128
|
-
let e =
|
|
2187
|
+
${wt}
|
|
2188
|
+
`, Rt = () => {
|
|
2189
|
+
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 } = Et();
|
|
2129
2190
|
if (e.length === 0) return null;
|
|
2130
2191
|
let u = t !== void 0;
|
|
2131
2192
|
return /* @__PURE__ */ O("div", {
|
|
2132
|
-
css:
|
|
2193
|
+
css: Lt,
|
|
2133
2194
|
ref: o,
|
|
2134
2195
|
children: [/* @__PURE__ */ D($, {
|
|
2135
2196
|
id: "subtitles",
|
|
@@ -2144,7 +2205,7 @@ ${Ct}
|
|
|
2144
2205
|
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
2145
2206
|
}),
|
|
2146
2207
|
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2147
|
-
}), i && /* @__PURE__ */ D(
|
|
2208
|
+
}), i && /* @__PURE__ */ D(Tt, {
|
|
2148
2209
|
title: "Subtitles",
|
|
2149
2210
|
tracks: e,
|
|
2150
2211
|
selected: t,
|
|
@@ -2154,13 +2215,13 @@ ${Ct}
|
|
|
2154
2215
|
failed: c
|
|
2155
2216
|
})]
|
|
2156
2217
|
});
|
|
2157
|
-
},
|
|
2218
|
+
}, zt = {
|
|
2158
2219
|
primary: "#EAEBEE",
|
|
2159
2220
|
secondary: "#D0D0D9",
|
|
2160
2221
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2161
2222
|
borderPrimary: "#384F70",
|
|
2162
2223
|
backgroundTooltip: "#222222"
|
|
2163
|
-
},
|
|
2224
|
+
}, Bt = _`
|
|
2164
2225
|
display: flex;
|
|
2165
2226
|
align-items: center;
|
|
2166
2227
|
|
|
@@ -2203,8 +2264,8 @@ ${Ct}
|
|
|
2203
2264
|
width: 10px;
|
|
2204
2265
|
height: 10px;
|
|
2205
2266
|
}
|
|
2206
|
-
`,
|
|
2207
|
-
let n =
|
|
2267
|
+
`, Vt = ({ value: e, onChange: t }) => {
|
|
2268
|
+
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } = qe({
|
|
2208
2269
|
ref: a,
|
|
2209
2270
|
onChange: t
|
|
2210
2271
|
}), s = (n) => {
|
|
@@ -2218,12 +2279,12 @@ ${Ct}
|
|
|
2218
2279
|
e && e.removeEventListener("wheel", s);
|
|
2219
2280
|
};
|
|
2220
2281
|
}, [e]);
|
|
2221
|
-
let c = e * 100, l = p(() => Math.round(r ? 0 :
|
|
2282
|
+
let c = e * 100, l = p(() => Math.round(r ? 0 : Ve(n) * 100), [n, r]);
|
|
2222
2283
|
return /* @__PURE__ */ D($, {
|
|
2223
2284
|
id: "volume-slider",
|
|
2224
2285
|
text: /* @__PURE__ */ D("div", {
|
|
2225
2286
|
ref: i,
|
|
2226
|
-
css:
|
|
2287
|
+
css: Bt,
|
|
2227
2288
|
...o,
|
|
2228
2289
|
children: /* @__PURE__ */ D("div", {
|
|
2229
2290
|
ref: a,
|
|
@@ -2242,7 +2303,7 @@ ${Ct}
|
|
|
2242
2303
|
children: [l, "%"]
|
|
2243
2304
|
})
|
|
2244
2305
|
});
|
|
2245
|
-
},
|
|
2306
|
+
}, Ht = _`
|
|
2246
2307
|
position: relative;
|
|
2247
2308
|
display: flex;
|
|
2248
2309
|
align-items: center;
|
|
@@ -2305,10 +2366,10 @@ ${Ct}
|
|
|
2305
2366
|
}
|
|
2306
2367
|
}
|
|
2307
2368
|
|
|
2308
|
-
`,
|
|
2309
|
-
let t =
|
|
2369
|
+
`, Ut = ({ ref: e }) => {
|
|
2370
|
+
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() => Ve(n), [n]);
|
|
2310
2371
|
return /* @__PURE__ */ O("div", {
|
|
2311
|
-
css:
|
|
2372
|
+
css: Ht,
|
|
2312
2373
|
children: [/* @__PURE__ */ D($, {
|
|
2313
2374
|
id: "sound",
|
|
2314
2375
|
text: /* @__PURE__ */ D("button", {
|
|
@@ -2328,16 +2389,16 @@ ${Ct}
|
|
|
2328
2389
|
className: "volume-slider-container",
|
|
2329
2390
|
children: /* @__PURE__ */ D("div", {
|
|
2330
2391
|
className: "volume-slider-background",
|
|
2331
|
-
children: /* @__PURE__ */ D(
|
|
2392
|
+
children: /* @__PURE__ */ D(Vt, {
|
|
2332
2393
|
value: r ? 0 : i,
|
|
2333
2394
|
onChange: (e) => {
|
|
2334
|
-
t.setVolume(
|
|
2395
|
+
t.setVolume(Be(e));
|
|
2335
2396
|
}
|
|
2336
2397
|
})
|
|
2337
2398
|
})
|
|
2338
2399
|
})]
|
|
2339
2400
|
});
|
|
2340
|
-
},
|
|
2401
|
+
}, Wt = .05, Gt = 5, Kt = 50, qt = 1e3, Jt = _`
|
|
2341
2402
|
position: absolute;
|
|
2342
2403
|
bottom: 0;
|
|
2343
2404
|
width: 100%;
|
|
@@ -2429,7 +2490,7 @@ ${Ct}
|
|
|
2429
2490
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2430
2491
|
of its own and so is never :hover */
|
|
2431
2492
|
:hover, &.armed {
|
|
2432
|
-
background-color: ${
|
|
2493
|
+
background-color: ${zt.hover};
|
|
2433
2494
|
}
|
|
2434
2495
|
|
|
2435
2496
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2467,10 +2528,10 @@ ${Ct}
|
|
|
2467
2528
|
}
|
|
2468
2529
|
}
|
|
2469
2530
|
}
|
|
2470
|
-
`,
|
|
2471
|
-
let n =
|
|
2472
|
-
let r =
|
|
2473
|
-
n.setVolume(
|
|
2531
|
+
`, Yt = ({ shortcuts: e = "window", root: t }) => {
|
|
2532
|
+
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, b] = h(null), x = m(null), S = m(void 0), C = u === "burn-in", w = _.length > 0, T = a > 0 && i === a, E = d(({ direction: e, stepSize: t }) => {
|
|
2533
|
+
let r = Ve(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2534
|
+
n.setVolume(Be(a)), o && !n.muted && n.toggleMuted();
|
|
2474
2535
|
}, [n]), k = m(!1);
|
|
2475
2536
|
f(() => {
|
|
2476
2537
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
@@ -2487,16 +2548,16 @@ ${Ct}
|
|
|
2487
2548
|
else if (a.key === "m") n.toggleMuted();
|
|
2488
2549
|
else if (a.key === "ArrowUp") E({
|
|
2489
2550
|
direction: "up",
|
|
2490
|
-
stepSize:
|
|
2551
|
+
stepSize: Wt
|
|
2491
2552
|
});
|
|
2492
2553
|
else if (a.key === "ArrowDown") E({
|
|
2493
2554
|
direction: "down",
|
|
2494
|
-
stepSize:
|
|
2555
|
+
stepSize: Wt
|
|
2495
2556
|
});
|
|
2496
2557
|
else if (a.key === "ArrowRight") {
|
|
2497
2558
|
if (!n.duration) return;
|
|
2498
|
-
r(Math.min(n.currentTime +
|
|
2499
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2559
|
+
r(Math.min(n.currentTime + Gt, n.duration));
|
|
2560
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Gt, 0)) : c = !1;
|
|
2500
2561
|
c && a.preventDefault();
|
|
2501
2562
|
};
|
|
2502
2563
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2512,10 +2573,10 @@ ${Ct}
|
|
|
2512
2573
|
let A = d((e) => {
|
|
2513
2574
|
e.preventDefault(), e.deltaY < 0 ? E({
|
|
2514
2575
|
direction: "up",
|
|
2515
|
-
stepSize:
|
|
2576
|
+
stepSize: Wt
|
|
2516
2577
|
}) : E({
|
|
2517
2578
|
direction: "down",
|
|
2518
|
-
stepSize:
|
|
2579
|
+
stepSize: Wt
|
|
2519
2580
|
});
|
|
2520
2581
|
}, [E]);
|
|
2521
2582
|
f(() => {
|
|
@@ -2541,18 +2602,18 @@ ${Ct}
|
|
|
2541
2602
|
}
|
|
2542
2603
|
let n = x.current, r = document.activeElement;
|
|
2543
2604
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2544
|
-
},
|
|
2605
|
+
}, Kt);
|
|
2545
2606
|
return S.current = t, () => {
|
|
2546
|
-
e = Date.now() +
|
|
2607
|
+
e = Date.now() + qt;
|
|
2547
2608
|
};
|
|
2548
2609
|
}, [M]), f(() => () => clearInterval(S.current), []), /* @__PURE__ */ O("div", {
|
|
2549
2610
|
className: "control-bar",
|
|
2550
|
-
css:
|
|
2611
|
+
css: Jt,
|
|
2551
2612
|
style: { ...c ? {
|
|
2552
2613
|
opacity: "0",
|
|
2553
2614
|
pointerEvents: "none"
|
|
2554
2615
|
} : M ? { pointerEvents: "none" } : {} },
|
|
2555
|
-
children: [/* @__PURE__ */ D(
|
|
2616
|
+
children: [/* @__PURE__ */ D(yt, {}), /* @__PURE__ */ O("div", {
|
|
2556
2617
|
className: "actions",
|
|
2557
2618
|
children: [/* @__PURE__ */ O("div", {
|
|
2558
2619
|
className: "left",
|
|
@@ -2569,18 +2630,18 @@ ${Ct}
|
|
|
2569
2630
|
}),
|
|
2570
2631
|
toolTipText: /* @__PURE__ */ D("span", { children: T ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2571
2632
|
}),
|
|
2572
|
-
/* @__PURE__ */ D(
|
|
2633
|
+
/* @__PURE__ */ D(Ut, { ref: b }),
|
|
2573
2634
|
/* @__PURE__ */ D("div", {
|
|
2574
2635
|
className: "time",
|
|
2575
|
-
children:
|
|
2636
|
+
children: Ue(o ?? i, a)
|
|
2576
2637
|
})
|
|
2577
2638
|
]
|
|
2578
2639
|
}), /* @__PURE__ */ O("div", {
|
|
2579
2640
|
className: "right",
|
|
2580
2641
|
children: [
|
|
2581
|
-
/* @__PURE__ */ D(
|
|
2582
|
-
/* @__PURE__ */ D(
|
|
2583
|
-
/* @__PURE__ */ D(
|
|
2642
|
+
/* @__PURE__ */ D(Mt, {}),
|
|
2643
|
+
/* @__PURE__ */ D(Rt, {}),
|
|
2644
|
+
/* @__PURE__ */ D(It, {}),
|
|
2584
2645
|
g ? /* @__PURE__ */ D($, {
|
|
2585
2646
|
id: "picture-in-picture",
|
|
2586
2647
|
tooltipPlace: "top-end",
|
|
@@ -2594,7 +2655,7 @@ ${Ct}
|
|
|
2594
2655
|
"aria-label": "Picture in picture",
|
|
2595
2656
|
"aria-pressed": g.active,
|
|
2596
2657
|
children: /* @__PURE__ */ D("img", {
|
|
2597
|
-
src:
|
|
2658
|
+
src: bt,
|
|
2598
2659
|
alt: ""
|
|
2599
2660
|
})
|
|
2600
2661
|
}),
|
|
@@ -2609,8 +2670,8 @@ ${Ct}
|
|
|
2609
2670
|
disabled: C && !w,
|
|
2610
2671
|
"aria-label": C ? "Put the subtitles in the video" : "Picture in picture",
|
|
2611
2672
|
"aria-pressed": C ? p : void 0,
|
|
2612
|
-
children: C ? D(p ?
|
|
2613
|
-
src:
|
|
2673
|
+
children: C ? D(p ? St : Ct, {}) : /* @__PURE__ */ D("img", {
|
|
2674
|
+
src: bt,
|
|
2614
2675
|
alt: ""
|
|
2615
2676
|
})
|
|
2616
2677
|
}),
|
|
@@ -2633,7 +2694,7 @@ ${Ct}
|
|
|
2633
2694
|
})]
|
|
2634
2695
|
})]
|
|
2635
2696
|
});
|
|
2636
|
-
},
|
|
2697
|
+
}, Xt = 9e3, Zt = _`
|
|
2637
2698
|
position: absolute;
|
|
2638
2699
|
inset: 0;
|
|
2639
2700
|
z-index: 2;
|
|
@@ -2676,18 +2737,18 @@ ${Ct}
|
|
|
2676
2737
|
line-height: 1;
|
|
2677
2738
|
color: #fff;
|
|
2678
2739
|
}
|
|
2679
|
-
`,
|
|
2680
|
-
let e =
|
|
2740
|
+
`, Qt = () => {
|
|
2741
|
+
let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2681
2742
|
return f(() => {
|
|
2682
2743
|
if (t !== "burn-in" || !e) {
|
|
2683
2744
|
r(!1);
|
|
2684
2745
|
return;
|
|
2685
2746
|
}
|
|
2686
2747
|
r(!0);
|
|
2687
|
-
let n = setTimeout(() => r(!1),
|
|
2748
|
+
let n = setTimeout(() => r(!1), Xt);
|
|
2688
2749
|
return () => clearTimeout(n);
|
|
2689
2750
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2690
|
-
css:
|
|
2751
|
+
css: Zt,
|
|
2691
2752
|
className: n ? "show" : "",
|
|
2692
2753
|
role: "status",
|
|
2693
2754
|
children: /* @__PURE__ */ O("div", {
|
|
@@ -2702,10 +2763,10 @@ ${Ct}
|
|
|
2702
2763
|
})]
|
|
2703
2764
|
})
|
|
2704
2765
|
});
|
|
2705
|
-
},
|
|
2766
|
+
}, $t = 1, en = 6e3, tn = 1, nn = {
|
|
2706
2767
|
opening: "Skip Opening",
|
|
2707
2768
|
ending: "Skip Ending"
|
|
2708
|
-
},
|
|
2769
|
+
}, rn = _`
|
|
2709
2770
|
position: absolute;
|
|
2710
2771
|
inset: 0;
|
|
2711
2772
|
z-index: 2;
|
|
@@ -2756,10 +2817,10 @@ ${Ct}
|
|
|
2756
2817
|
bottom: calc(9 * var(--mp-unit));
|
|
2757
2818
|
}
|
|
2758
2819
|
}
|
|
2759
|
-
`,
|
|
2760
|
-
let e =
|
|
2820
|
+
`, an = () => {
|
|
2821
|
+
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(() => gt(e), [e]), o = p(() => {
|
|
2761
2822
|
if (typeof t != "number") return;
|
|
2762
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2823
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - $t <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2763
2824
|
return r ? {
|
|
2764
2825
|
kind: r,
|
|
2765
2826
|
end: e[n].end
|
|
@@ -2771,7 +2832,7 @@ ${Ct}
|
|
|
2771
2832
|
]), s = m(0), [c, l] = h(0);
|
|
2772
2833
|
f(() => {
|
|
2773
2834
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2774
|
-
s.current = e, e < n -
|
|
2835
|
+
s.current = e, e < n - tn && l((e) => e + 1);
|
|
2775
2836
|
}, [t]);
|
|
2776
2837
|
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2777
2838
|
return f(() => {
|
|
@@ -2780,12 +2841,12 @@ ${Ct}
|
|
|
2780
2841
|
return;
|
|
2781
2842
|
}
|
|
2782
2843
|
d(!0);
|
|
2783
|
-
let e = setTimeout(() => d(!1),
|
|
2844
|
+
let e = setTimeout(() => d(!1), en);
|
|
2784
2845
|
return () => clearTimeout(e);
|
|
2785
2846
|
}, [g, c]), f(() => {
|
|
2786
2847
|
o || d(!1);
|
|
2787
2848
|
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2788
|
-
css:
|
|
2849
|
+
css: rn,
|
|
2789
2850
|
className: u && !r ? "show" : "",
|
|
2790
2851
|
children: /* @__PURE__ */ D("button", {
|
|
2791
2852
|
type: "button",
|
|
@@ -2793,10 +2854,10 @@ ${Ct}
|
|
|
2793
2854
|
onClick: () => {
|
|
2794
2855
|
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2795
2856
|
},
|
|
2796
|
-
children:
|
|
2857
|
+
children: nn[o.kind]
|
|
2797
2858
|
})
|
|
2798
2859
|
}) : null;
|
|
2799
|
-
},
|
|
2860
|
+
}, on = 3e3, sn = _`
|
|
2800
2861
|
position: absolute;
|
|
2801
2862
|
inset: 0;
|
|
2802
2863
|
z-index: 2;
|
|
@@ -2807,10 +2868,10 @@ ${Ct}
|
|
|
2807
2868
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2808
2869
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2809
2870
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2810
|
-
`,
|
|
2871
|
+
`, cn = (e, t) => {
|
|
2811
2872
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2812
2873
|
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
|
-
},
|
|
2874
|
+
}, ln = _`
|
|
2814
2875
|
position: relative;
|
|
2815
2876
|
background-color: black;
|
|
2816
2877
|
display: flex;
|
|
@@ -2867,14 +2928,14 @@ ${Ct}
|
|
|
2867
2928
|
&.hide {
|
|
2868
2929
|
cursor: none;
|
|
2869
2930
|
}
|
|
2870
|
-
`,
|
|
2931
|
+
`, un = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2871
2932
|
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2872
|
-
return u(e) && e.type === l ?
|
|
2933
|
+
return u(e) && e.type === l ? un(e.props.children, `${r}/`) : [{
|
|
2873
2934
|
key: r,
|
|
2874
2935
|
item: e
|
|
2875
2936
|
}];
|
|
2876
|
-
}),
|
|
2877
|
-
let s =
|
|
2937
|
+
}), dn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2938
|
+
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
2939
|
x: -1,
|
|
2879
2940
|
y: -1
|
|
2880
2941
|
}), _ = m(!1), v = m(null);
|
|
@@ -2894,12 +2955,12 @@ ${Ct}
|
|
|
2894
2955
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
2895
2956
|
}, S = () => {
|
|
2896
2957
|
if (x()) {
|
|
2897
|
-
p.current = setTimeout(S,
|
|
2958
|
+
p.current = setTimeout(S, on);
|
|
2898
2959
|
return;
|
|
2899
2960
|
}
|
|
2900
2961
|
y();
|
|
2901
2962
|
}, C = () => {
|
|
2902
|
-
l(!1), clearTimeout(p.current), p.current = setTimeout(S,
|
|
2963
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, on);
|
|
2903
2964
|
}, w = (e) => {
|
|
2904
2965
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
2905
2966
|
x: e.clientX,
|
|
@@ -2911,7 +2972,7 @@ ${Ct}
|
|
|
2911
2972
|
_.current = !1;
|
|
2912
2973
|
}, k = m(!0);
|
|
2913
2974
|
return /* @__PURE__ */ O("div", {
|
|
2914
|
-
css:
|
|
2975
|
+
css: ln,
|
|
2915
2976
|
ref: b,
|
|
2916
2977
|
onPointerMove: w,
|
|
2917
2978
|
onPointerDown: T,
|
|
@@ -2926,9 +2987,9 @@ ${Ct}
|
|
|
2926
2987
|
className: c ? "hide" : "",
|
|
2927
2988
|
tabIndex: a === "player" ? -1 : void 0,
|
|
2928
2989
|
children: [
|
|
2929
|
-
/* @__PURE__ */ D(
|
|
2930
|
-
|
|
2931
|
-
css:
|
|
2990
|
+
/* @__PURE__ */ D(Le, { onSubtitleRef: n }),
|
|
2991
|
+
un(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
2992
|
+
css: sn,
|
|
2932
2993
|
style: { ...c ? {
|
|
2933
2994
|
opacity: "0",
|
|
2934
2995
|
visibility: "hidden",
|
|
@@ -2936,15 +2997,15 @@ ${Ct}
|
|
|
2936
2997
|
} : {} },
|
|
2937
2998
|
children: t
|
|
2938
2999
|
}, e)),
|
|
2939
|
-
i === !1 ? null : /* @__PURE__ */ D(
|
|
3000
|
+
i === !1 ? null : /* @__PURE__ */ D(Yt, {
|
|
2940
3001
|
shortcuts: a,
|
|
2941
3002
|
root: v
|
|
2942
3003
|
}),
|
|
2943
|
-
/* @__PURE__ */ D(
|
|
2944
|
-
/* @__PURE__ */ D(
|
|
3004
|
+
/* @__PURE__ */ D(Qt, {}),
|
|
3005
|
+
/* @__PURE__ */ D(an, {}),
|
|
2945
3006
|
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
2946
3007
|
className: "pass-through",
|
|
2947
|
-
style: { clipPath:
|
|
3008
|
+
style: { clipPath: cn(d.armed, v.current.getBoundingClientRect()) },
|
|
2948
3009
|
onPointerOver: d.disarm
|
|
2949
3010
|
}) : null,
|
|
2950
3011
|
/* @__PURE__ */ O("div", {
|
|
@@ -2967,64 +3028,71 @@ ${Ct}
|
|
|
2967
3028
|
})
|
|
2968
3029
|
]
|
|
2969
3030
|
});
|
|
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
|
|
3031
|
+
}, fn = ({ options: e, children: t }) => {
|
|
3032
|
+
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;
|
|
3033
|
+
f(() => (v?.(E), () => v?.(null)), [E, v]);
|
|
3034
|
+
let { expose: O } = e, k = O === !0 ? {} : O || void 0, A = m(k);
|
|
3035
|
+
A.current = k;
|
|
3036
|
+
let j = k ? k.id : void 0, M = k ? k.origin : void 0, N = k ? k.channel : void 0;
|
|
2976
3037
|
f(() => {
|
|
2977
|
-
if (!
|
|
3038
|
+
if (!O || !E) return;
|
|
2978
3039
|
let e, t = !1;
|
|
2979
3040
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
2980
|
-
t || (e = n(
|
|
3041
|
+
t || (e = n(E, A.current ?? {}));
|
|
2981
3042
|
}).catch(() => {}), () => {
|
|
2982
3043
|
t = !0, e?.();
|
|
2983
3044
|
};
|
|
2984
3045
|
}, [
|
|
2985
|
-
|
|
2986
|
-
!!
|
|
2987
|
-
A,
|
|
3046
|
+
E,
|
|
3047
|
+
!!O,
|
|
2988
3048
|
j,
|
|
2989
|
-
M
|
|
2990
|
-
|
|
2991
|
-
|
|
3049
|
+
M,
|
|
3050
|
+
N
|
|
3051
|
+
]);
|
|
3052
|
+
let P = p(() => Ae(), [o]);
|
|
3053
|
+
le(S, w, r, _ ? P.push : void 0);
|
|
3054
|
+
let F = r?.normalizeVolume ?? !0, [I, L] = h(F);
|
|
2992
3055
|
f(() => {
|
|
2993
|
-
F
|
|
2994
|
-
}, [
|
|
2995
|
-
let
|
|
2996
|
-
|
|
2997
|
-
let
|
|
2998
|
-
|
|
2999
|
-
let
|
|
3000
|
-
|
|
3056
|
+
L(F);
|
|
3057
|
+
}, [F]);
|
|
3058
|
+
let R = m(r?.onNormalizeVolumeChange);
|
|
3059
|
+
R.current = r?.onNormalizeVolumeChange;
|
|
3060
|
+
let z = r?.normalizerWorkletUrl, B = m(d ?? u);
|
|
3061
|
+
B.current = d ?? u;
|
|
3062
|
+
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } = ke(S, z, I, p(() => H && o && c && l && typeof V == "number" && V >= 0 ? _ ? {
|
|
3063
|
+
tap: P,
|
|
3064
|
+
audioStreamIndex: V
|
|
3065
|
+
} : {
|
|
3066
|
+
read: (e, t) => B.current(e, t),
|
|
3001
3067
|
length: o,
|
|
3002
3068
|
publicPath: c,
|
|
3003
3069
|
libavWorkerUrl: l,
|
|
3004
|
-
audioStreamIndex:
|
|
3070
|
+
audioStreamIndex: V
|
|
3005
3071
|
} : void 0, [
|
|
3006
|
-
|
|
3072
|
+
H,
|
|
3007
3073
|
o,
|
|
3008
3074
|
c,
|
|
3009
3075
|
l,
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3076
|
+
V,
|
|
3077
|
+
_,
|
|
3078
|
+
P
|
|
3079
|
+
]), p(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), te = p(() => z && typeof AudioWorkletNode == "function" ? {
|
|
3080
|
+
enabled: I,
|
|
3081
|
+
available: !ee,
|
|
3014
3082
|
setEnabled: (e) => {
|
|
3015
|
-
|
|
3083
|
+
L(e), R.current?.(e);
|
|
3016
3084
|
}
|
|
3017
3085
|
} : null, [
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
]), { thumbnails:
|
|
3086
|
+
z,
|
|
3087
|
+
I,
|
|
3088
|
+
ee
|
|
3089
|
+
]), { thumbnails: ne, requestThumbnail: U } = fe({
|
|
3022
3090
|
publicPath: c,
|
|
3023
3091
|
workerUrl: l,
|
|
3024
3092
|
length: g === !1 ? void 0 : o,
|
|
3025
3093
|
read: d ?? u,
|
|
3026
3094
|
downloadedRanges: s
|
|
3027
|
-
}),
|
|
3095
|
+
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } = pe(S, w), q = ye(n?.media ?? null, n?.pictureInPicture), J = K((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
|
|
3028
3096
|
f(() => {
|
|
3029
3097
|
J({
|
|
3030
3098
|
title: i,
|
|
@@ -3039,30 +3107,30 @@ ${Ct}
|
|
|
3039
3107
|
s,
|
|
3040
3108
|
Y
|
|
3041
3109
|
]);
|
|
3042
|
-
let
|
|
3110
|
+
let ae = n?.thumbnails?.at;
|
|
3043
3111
|
f(() => {
|
|
3044
3112
|
J({
|
|
3045
|
-
thumbnails:
|
|
3046
|
-
thumbnailAt:
|
|
3047
|
-
requestThumbnail:
|
|
3048
|
-
togglePictureInPicture:
|
|
3049
|
-
pictureInPictureMode:
|
|
3050
|
-
burnedInSubtitles:
|
|
3113
|
+
thumbnails: W,
|
|
3114
|
+
thumbnailAt: ae,
|
|
3115
|
+
requestThumbnail: U,
|
|
3116
|
+
togglePictureInPicture: G,
|
|
3117
|
+
pictureInPictureMode: re,
|
|
3118
|
+
burnedInSubtitles: ie
|
|
3051
3119
|
});
|
|
3052
3120
|
}, [
|
|
3053
3121
|
J,
|
|
3054
|
-
U,
|
|
3055
|
-
re,
|
|
3056
|
-
te,
|
|
3057
3122
|
W,
|
|
3123
|
+
ae,
|
|
3124
|
+
U,
|
|
3058
3125
|
G,
|
|
3059
|
-
|
|
3126
|
+
re,
|
|
3127
|
+
ie
|
|
3060
3128
|
]), f(() => {
|
|
3061
|
-
J({ volumeNormalizer:
|
|
3062
|
-
}, [J,
|
|
3063
|
-
J({ passThroughPictureInPicture:
|
|
3064
|
-
}, [J,
|
|
3065
|
-
let X = n?.subtitles?.selection,
|
|
3129
|
+
J({ volumeNormalizer: te });
|
|
3130
|
+
}, [J, te]), f(() => {
|
|
3131
|
+
J({ passThroughPictureInPicture: q });
|
|
3132
|
+
}, [J, q]);
|
|
3133
|
+
let X = n?.subtitles?.selection, oe = n?.audioTracks?.selection;
|
|
3066
3134
|
f(() => {
|
|
3067
3135
|
X && J({
|
|
3068
3136
|
subtitleTracks: X.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
@@ -3075,31 +3143,31 @@ ${Ct}
|
|
|
3075
3143
|
subtitleOffLabel: X.offLabel
|
|
3076
3144
|
});
|
|
3077
3145
|
}, [J, X]), f(() => {
|
|
3078
|
-
|
|
3079
|
-
audioTracks:
|
|
3146
|
+
oe && J({
|
|
3147
|
+
audioTracks: oe.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3080
3148
|
id: e,
|
|
3081
3149
|
label: t,
|
|
3082
3150
|
disabled: n
|
|
3083
3151
|
})),
|
|
3084
|
-
selectedAudioTrack:
|
|
3085
|
-
selectAudioTrack: (e) =>
|
|
3152
|
+
selectedAudioTrack: oe.selectedId ?? void 0,
|
|
3153
|
+
selectAudioTrack: (e) => oe.select(String(e))
|
|
3086
3154
|
});
|
|
3087
|
-
}, [J,
|
|
3088
|
-
let
|
|
3155
|
+
}, [J, oe]);
|
|
3156
|
+
let se = n?.quality?.selection ?? null;
|
|
3089
3157
|
return f(() => {
|
|
3090
|
-
J({ quality:
|
|
3091
|
-
}, [J,
|
|
3158
|
+
J({ quality: se });
|
|
3159
|
+
}, [J, se]), f(() => {
|
|
3092
3160
|
a && J({ chapters: a });
|
|
3093
|
-
}, [J, a]), /* @__PURE__ */ D(
|
|
3094
|
-
ref:
|
|
3095
|
-
onVideoRef: n ? void 0 :
|
|
3096
|
-
onSubtitleRef:
|
|
3161
|
+
}, [J, a]), /* @__PURE__ */ D(dn, {
|
|
3162
|
+
ref: y,
|
|
3163
|
+
onVideoRef: n ? void 0 : C,
|
|
3164
|
+
onSubtitleRef: T,
|
|
3097
3165
|
overlay: e.overlay,
|
|
3098
3166
|
controls: e.controls,
|
|
3099
3167
|
shortcuts: e.shortcuts,
|
|
3100
3168
|
children: t
|
|
3101
3169
|
});
|
|
3102
|
-
},
|
|
3170
|
+
}, pn = _`
|
|
3103
3171
|
/**
|
|
3104
3172
|
* The chrome's whole scale, in one place.
|
|
3105
3173
|
*
|
|
@@ -3169,17 +3237,17 @@ ${Ct}
|
|
|
3169
3237
|
height: 100%;
|
|
3170
3238
|
width: 100%;
|
|
3171
3239
|
overflow: hidden;
|
|
3172
|
-
`,
|
|
3173
|
-
css:
|
|
3174
|
-
children: /* @__PURE__ */ D(
|
|
3240
|
+
`, mn = (e) => /* @__PURE__ */ D("div", {
|
|
3241
|
+
css: pn,
|
|
3242
|
+
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(fn, {
|
|
3175
3243
|
options: e,
|
|
3176
3244
|
children: e.children
|
|
3177
3245
|
}) })
|
|
3178
|
-
}),
|
|
3246
|
+
}), hn = (e) => !!e && typeof e == "object" && "at" in e, gn = (e) => !!e && typeof e == "object" && "selection" in e, _n = ({ blob: e, name: t }) => ({
|
|
3179
3247
|
length: e.size,
|
|
3180
3248
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3181
3249
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3182
|
-
}),
|
|
3250
|
+
}), vn = async (e, t) => {
|
|
3183
3251
|
let n = await fetch(e, {
|
|
3184
3252
|
headers: { Range: "bytes=0-1" },
|
|
3185
3253
|
credentials: t
|
|
@@ -3189,8 +3257,8 @@ ${Ct}
|
|
|
3189
3257
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3190
3258
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3191
3259
|
return i;
|
|
3192
|
-
},
|
|
3193
|
-
let i = t ?? await
|
|
3260
|
+
}, yn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3261
|
+
let i = t ?? await vn(e, r);
|
|
3194
3262
|
return {
|
|
3195
3263
|
length: i,
|
|
3196
3264
|
name: n,
|
|
@@ -3203,11 +3271,12 @@ ${Ct}
|
|
|
3203
3271
|
});
|
|
3204
3272
|
if (!o.ok) throw Error(`The source could not be read: HTTP ${o.status}`);
|
|
3205
3273
|
return o.arrayBuffer();
|
|
3206
|
-
}
|
|
3274
|
+
},
|
|
3275
|
+
readsDownload: !0
|
|
3207
3276
|
};
|
|
3208
|
-
},
|
|
3209
|
-
if ("blob" in e) return
|
|
3210
|
-
if ("url" in e) return
|
|
3277
|
+
}, bn = async (e) => {
|
|
3278
|
+
if ("blob" in e) return _n(e);
|
|
3279
|
+
if ("url" in e) return yn(e);
|
|
3211
3280
|
if ("read" in e) return {
|
|
3212
3281
|
length: e.length,
|
|
3213
3282
|
name: e.name,
|
|
@@ -3216,4 +3285,4 @@ ${Ct}
|
|
|
3216
3285
|
throw Error(`Unknown source type: ${e}`);
|
|
3217
3286
|
};
|
|
3218
3287
|
//#endregion
|
|
3219
|
-
export {
|
|
3288
|
+
export { mn as MediaPlayer, mn as default, G as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, bn as inputToRemuxerInput, gn as isDelegatedTracks, hn as isExternalThumbnails, W as sourceFeature, a as startPlayback, pe as usePictureInPicture, K as usePlayer, fe as useSeekThumbnails };
|