@banou/media-player 0.10.50 → 0.10.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/index.js +1 -1
- package/dist/{engine-Cdwc76gM.js → engine-D_C7Ngyd.js} +252 -219
- package/dist/index.js +170 -148
- package/dist/remote/index.js +60 -39
- package/package.json +1 -1
- package/src/lib/engine/picture-in-picture.ts +38 -4
- package/src/lib/engine/playback.ts +104 -86
- package/src/lib/react/hooks/use-playback.ts +61 -15
- package/src/lib/remote/index.ts +57 -23
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t, m as n, n as r, o as i, p as a, r as o, s, t as c, u as l } from "./engine-
|
|
1
|
+
import { c as e, l as t, m as n, n as r, o as i, p as a, r as o, s, t as c, u as l } from "./engine-D_C7Ngyd.js";
|
|
2
2
|
import { languageOf as u, playsIn as d, startingTracks as f } from "./language/index.js";
|
|
3
3
|
import { n as p, r as m, t as h } from "./chapters-EBYXcEml.js";
|
|
4
4
|
import { Children as g, Fragment as _, createContext as v, isValidElement as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useRef as w, useState as T, useSyncExternalStore as E } from "react";
|
|
@@ -8,8 +8,8 @@ import { definePlayerFeature as M, videoFeatures as N } from "@videojs/core/dom"
|
|
|
8
8
|
import { makeRemuxer as P } from "libav-wasm";
|
|
9
9
|
import { Fragment as F, jsx as I, jsxs as L } from "@emotion/react/jsx-runtime";
|
|
10
10
|
import { createMediaElementSource as R } from "@banou/ponyfill/web-audio";
|
|
11
|
-
import { Captions as z, CaptionsOff as B, Check as V, ChevronLeft as H, ChevronRight as
|
|
12
|
-
import { Tooltip as
|
|
11
|
+
import { Captions as z, CaptionsOff as B, Check as V, ChevronLeft as H, ChevronRight as U, Copy as ee, Maximize as W, Minimize as te, Pause as G, Play as K, RotateCcw as ne, Settings as q, TriangleAlert as re, Volume1 as ie, Volume2 as J, VolumeX as ae } from "lucide-react";
|
|
12
|
+
import { Tooltip as oe } from "react-tooltip";
|
|
13
13
|
//#region src/lib/react/source-feature.ts
|
|
14
14
|
var se = {
|
|
15
15
|
indexes: [],
|
|
@@ -198,45 +198,47 @@ var se = {
|
|
|
198
198
|
let V = w({
|
|
199
199
|
audio: [],
|
|
200
200
|
subtitles: []
|
|
201
|
-
}), H = b(() => V.current.audio.find((e) => e.streamIndex === a.selectedAudioTrack), [a]),
|
|
202
|
-
|
|
203
|
-
let
|
|
201
|
+
}), H = b(() => V.current.audio.find((e) => e.streamIndex === a.selectedAudioTrack), [a]), U = w(o);
|
|
202
|
+
U.current = o;
|
|
203
|
+
let ee = w(E);
|
|
204
|
+
ee.current = E;
|
|
205
|
+
let W = {
|
|
204
206
|
audio: n?.preferredAudioLanguage,
|
|
205
207
|
original: n?.originalLanguage,
|
|
206
208
|
subtitles: n?.preferredSubtitleLanguage,
|
|
207
209
|
alwaysSubtitles: n?.alwaysShowSubtitles
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
let
|
|
211
|
-
|
|
212
|
-
let
|
|
213
|
-
|
|
214
|
-
let
|
|
215
|
-
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
-
let
|
|
219
|
-
|
|
220
|
-
let
|
|
221
|
-
|
|
222
|
-
let
|
|
223
|
-
|
|
210
|
+
}, te = w(W);
|
|
211
|
+
te.current = W;
|
|
212
|
+
let G = w(n?.onPreferredAudioLanguageChange);
|
|
213
|
+
G.current = n?.onPreferredAudioLanguageChange;
|
|
214
|
+
let K = w(n?.onPreferredSubtitleLanguageChange);
|
|
215
|
+
K.current = n?.onPreferredSubtitleLanguageChange;
|
|
216
|
+
let ne = w(n?.onAlwaysShowSubtitlesChange);
|
|
217
|
+
ne.current = n?.onAlwaysShowSubtitlesChange;
|
|
218
|
+
let q = w(n?.onSeek);
|
|
219
|
+
q.current = n?.onSeek;
|
|
220
|
+
let re = w(n?.onPlaybackError);
|
|
221
|
+
re.current = n?.onPlaybackError;
|
|
222
|
+
let ie = w(r);
|
|
223
|
+
ie.current = r;
|
|
224
|
+
let J = Q(), ae = w(J);
|
|
225
|
+
ae.current = J, S(() => {
|
|
224
226
|
let { audio: e, subtitles: t } = V.current;
|
|
225
|
-
t.length && a.setSourceState({ subtitleTracks: Ce(t,
|
|
226
|
-
}, [a,
|
|
227
|
+
t.length && a.setSourceState({ subtitleTracks: Ce(t, J) }), e.length && a.setSourceState({ audioTracks: Ce(e, J) });
|
|
228
|
+
}, [a, J]);
|
|
227
229
|
let oe = b((e) => {
|
|
228
230
|
let t = typeof e == "number" ? e : void 0, n = a.selectedSubtitleTrack === void 0;
|
|
229
231
|
z.current = B.current, a.setSourceState({ selectedSubtitleTrack: t }), L.current?.selectSubtitleStream(t);
|
|
230
232
|
let r = V.current.subtitles.find((e) => e.streamIndex === t), i = t === void 0 ? null : u(r) ?? (n ? r?.title?.trim() || "und" : void 0);
|
|
231
|
-
i !== void 0 &&
|
|
232
|
-
}, [a, H]),
|
|
233
|
-
let n = ++
|
|
233
|
+
i !== void 0 && K.current?.(i), i && d(H(), i) && ne.current?.(!0);
|
|
234
|
+
}, [a, H]), se = w(0), Y = b((e, t = !1) => {
|
|
235
|
+
let n = ++se.current, r = L.current;
|
|
234
236
|
if (!r || O <= 0 || t) {
|
|
235
237
|
a.setSourceState({ seekingTo: void 0 }), a.seek(e);
|
|
236
238
|
return;
|
|
237
239
|
}
|
|
238
240
|
let i = typeof window < "u" && window.__mediaPlayerSeekDebug, o = performance.now(), s = !1, c = "prepared", l = () => {
|
|
239
|
-
if (!s && (s = !0, L.current === r &&
|
|
241
|
+
if (!s && (s = !0, L.current === r && se.current === n && (a.seek(e), i))) {
|
|
240
242
|
let t = r.videoElement, n = 0;
|
|
241
243
|
if (t) for (let r = 0; r < t.buffered.length; r++) t.buffered.start(r) <= e + 1 && e < t.buffered.end(r) && (n = t.buffered.end(r) - e);
|
|
242
244
|
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - o)}ms via ${c}, runway ${n.toFixed(1)}s${c === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
@@ -244,7 +246,7 @@ var se = {
|
|
|
244
246
|
};
|
|
245
247
|
a.setSourceState({ seekingTo: e });
|
|
246
248
|
let u = r.videoElement, d = () => {
|
|
247
|
-
u?.removeEventListener("seeked", f), clearTimeout(p),
|
|
249
|
+
u?.removeEventListener("seeked", f), clearTimeout(p), se.current === n && a.setSourceState({ seekingTo: void 0 });
|
|
248
250
|
}, f = () => {
|
|
249
251
|
s && d();
|
|
250
252
|
}, p = setTimeout(d, De);
|
|
@@ -255,34 +257,45 @@ var se = {
|
|
|
255
257
|
r.prepareSeek(e).catch(() => {}).finally(() => {
|
|
256
258
|
clearTimeout(m), l();
|
|
257
259
|
});
|
|
258
|
-
}, [a, O]),
|
|
260
|
+
}, [a, O]), ce = b((e) => {
|
|
259
261
|
if (typeof e != "number" || B.current === void 0) return;
|
|
260
262
|
a.setSourceState({ selectedAudioTrack: e }), j({
|
|
261
263
|
size: B.current,
|
|
262
264
|
streamIndex: e
|
|
263
265
|
});
|
|
264
266
|
let t = u(V.current.audio.find((t) => t.streamIndex === e));
|
|
265
|
-
t !== void 0 &&
|
|
266
|
-
}, [a]),
|
|
267
|
+
t !== void 0 && G.current?.(t);
|
|
268
|
+
}, [a]), le = X((e) => e.setSourceState);
|
|
267
269
|
S(() => {
|
|
268
|
-
|
|
270
|
+
le({
|
|
269
271
|
selectSubtitleTrack: oe,
|
|
270
|
-
selectAudioTrack:
|
|
271
|
-
requestSeek:
|
|
272
|
+
selectAudioTrack: ce,
|
|
273
|
+
requestSeek: Y
|
|
272
274
|
});
|
|
273
275
|
}, [
|
|
274
|
-
|
|
276
|
+
le,
|
|
275
277
|
oe,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
+
ce,
|
|
279
|
+
Y
|
|
278
280
|
]), S(() => {
|
|
279
281
|
if (!e || !t || !c || !o) return;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
+
R.current && R.current.size !== c && (R.current = null);
|
|
283
|
+
let n = !1, r = !1, u = !1, d = !1, b = !1, S = () => {
|
|
284
|
+
u = !0, d = !1, b = !1;
|
|
285
|
+
}, w = () => {
|
|
286
|
+
if (b) {
|
|
287
|
+
b = !1;
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
u = !1, d = !1;
|
|
291
|
+
}, T = () => {
|
|
292
|
+
u && e.paused && (d = !0, b = !0);
|
|
293
|
+
};
|
|
294
|
+
e.addEventListener("play", S), e.addEventListener("pause", w), e.addEventListener("error", T), a.setSourceState({
|
|
282
295
|
playbackError: null,
|
|
283
296
|
ready: !1
|
|
284
297
|
});
|
|
285
|
-
let
|
|
298
|
+
let E = (t, n) => {
|
|
286
299
|
let r = Date.now(), i = Oe(t), o = ke(t), s = a.playbackErrors, c = s[s.length - 1];
|
|
287
300
|
if (c && c.message === i && c.detail === o && c.recovered === n) {
|
|
288
301
|
let e = {
|
|
@@ -303,10 +316,10 @@ var se = {
|
|
|
303
316
|
recovered: n
|
|
304
317
|
};
|
|
305
318
|
a.setSourceState({ playbackErrors: [...s, l] });
|
|
306
|
-
},
|
|
319
|
+
}, D = (e) => {
|
|
307
320
|
if (n) return;
|
|
308
321
|
let t = i(e);
|
|
309
|
-
if (
|
|
322
|
+
if (E(e, t), t) {
|
|
310
323
|
let t = performance.now();
|
|
311
324
|
t - F.current.at > Te && (F.current = {
|
|
312
325
|
count: 0,
|
|
@@ -319,14 +332,14 @@ var se = {
|
|
|
319
332
|
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), I.current && clearTimeout(I.current), I.current = setTimeout(() => P((e) => e + 1), n);
|
|
320
333
|
return;
|
|
321
334
|
}
|
|
322
|
-
console.error("playback failed", e), a.setSourceState({ playbackError: e }),
|
|
335
|
+
console.error("playback failed", e), a.setSourceState({ playbackError: e }), re.current?.(e);
|
|
323
336
|
};
|
|
324
337
|
return (async () => {
|
|
325
338
|
try {
|
|
326
|
-
let
|
|
339
|
+
let i = await s({
|
|
327
340
|
videoElement: e,
|
|
328
341
|
subtitleContainer: t,
|
|
329
|
-
read: (e, t) =>
|
|
342
|
+
read: (e, t) => U.current(e, t),
|
|
330
343
|
length: c,
|
|
331
344
|
publicPath: l,
|
|
332
345
|
libavWorkerUrl: p,
|
|
@@ -339,53 +352,63 @@ var se = {
|
|
|
339
352
|
cjkFontUrl: x,
|
|
340
353
|
bufferSize: C,
|
|
341
354
|
audioStreamIndex: M,
|
|
342
|
-
chooseAudioStream: (e) => e[f(e, [],
|
|
355
|
+
chooseAudioStream: (e) => e[f(e, [], te.current).audio]?.streamIndex,
|
|
343
356
|
onReady: () => {
|
|
344
357
|
if (n) return;
|
|
345
|
-
a.setSourceState({ ready: !0 });
|
|
358
|
+
r = !0, a.setSourceState({ ready: !0 });
|
|
346
359
|
let t = R.current;
|
|
347
|
-
R.current = null
|
|
360
|
+
R.current = null;
|
|
361
|
+
let i = !!t && t.size === c;
|
|
362
|
+
i && t.time > 0 ? e.currentTime = t.time : a.setSourceState({ seekingTo: void 0 });
|
|
363
|
+
let o = i ? t.play : ee.current;
|
|
364
|
+
u = o, o && e.play().catch(() => {
|
|
365
|
+
e.paused && !d && (u = !1);
|
|
366
|
+
});
|
|
348
367
|
},
|
|
349
|
-
onError:
|
|
368
|
+
onError: D,
|
|
350
369
|
onRecovered: () => {
|
|
351
370
|
n || a.setSourceState({ playbackError: null });
|
|
352
371
|
},
|
|
353
|
-
onSeek: (e) =>
|
|
354
|
-
onOutput: (e) =>
|
|
372
|
+
onSeek: (e) => q.current?.(e),
|
|
373
|
+
onOutput: (e) => ie.current?.(e),
|
|
355
374
|
onSubtitleStreams: (e) => {
|
|
356
375
|
if (n) return;
|
|
357
376
|
V.current.subtitles = e;
|
|
358
|
-
let t = H(), r = f(t ? [t] : [], e,
|
|
377
|
+
let t = H(), r = f(t ? [t] : [], e, te.current).subtitles;
|
|
359
378
|
a.setSourceState({
|
|
360
|
-
subtitleTracks: Ce(e,
|
|
379
|
+
subtitleTracks: Ce(e, ae.current),
|
|
361
380
|
...z.current === c ? {} : { selectedSubtitleTrack: r === null ? void 0 : e[Math.max(r, 0)]?.streamIndex }
|
|
362
381
|
});
|
|
363
382
|
},
|
|
364
383
|
onAudioStreams: (e, t) => {
|
|
365
384
|
n || (V.current.audio = e, a.setSourceState({
|
|
366
|
-
audioTracks: Ce(e,
|
|
385
|
+
audioTracks: Ce(e, ae.current),
|
|
367
386
|
selectedAudioTrack: t
|
|
368
387
|
}));
|
|
369
388
|
}
|
|
370
389
|
});
|
|
371
390
|
if (n) {
|
|
372
|
-
|
|
391
|
+
i.destroy();
|
|
373
392
|
return;
|
|
374
393
|
}
|
|
375
|
-
L.current =
|
|
376
|
-
indexes:
|
|
377
|
-
chapters: k.current ??
|
|
394
|
+
L.current = i, a.setSourceState({
|
|
395
|
+
indexes: i.indexes,
|
|
396
|
+
chapters: k.current ?? i.chapters
|
|
378
397
|
});
|
|
379
|
-
let
|
|
380
|
-
|
|
398
|
+
let o = a.selectedSubtitleTrack;
|
|
399
|
+
i.selectSubtitleStream(typeof o == "number" ? o : void 0);
|
|
381
400
|
} catch (e) {
|
|
382
|
-
|
|
401
|
+
D(e);
|
|
383
402
|
}
|
|
384
403
|
})(), () => {
|
|
385
|
-
n = !0, R.current = {
|
|
404
|
+
n = !0, e.removeEventListener("play", S), e.removeEventListener("pause", w), e.removeEventListener("error", T), r ? R.current = {
|
|
386
405
|
time: a.state.seekingTo ?? e.currentTime,
|
|
387
|
-
size: c
|
|
388
|
-
|
|
406
|
+
size: c,
|
|
407
|
+
play: !e.ended && (d ? u : !e.paused)
|
|
408
|
+
} : R.current?.size === c && a.state.seekingTo !== void 0 && (R.current = {
|
|
409
|
+
...R.current,
|
|
410
|
+
time: a.state.seekingTo
|
|
411
|
+
}), L.current?.destroy(), L.current = null, a.setSourceState({ ready: !1 });
|
|
389
412
|
};
|
|
390
413
|
}, [
|
|
391
414
|
a,
|
|
@@ -404,7 +427,6 @@ var se = {
|
|
|
404
427
|
x,
|
|
405
428
|
C,
|
|
406
429
|
M,
|
|
407
|
-
E,
|
|
408
430
|
N
|
|
409
431
|
]);
|
|
410
432
|
}, je = 1001 / 24e3, Me = (e, t) => new Promise((n) => {
|
|
@@ -710,7 +732,7 @@ var se = {
|
|
|
710
732
|
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
711
733
|
p.onmessage = ({ data: e }) => {
|
|
712
734
|
if (e.type === "unsupported") {
|
|
713
|
-
|
|
735
|
+
G();
|
|
714
736
|
return;
|
|
715
737
|
}
|
|
716
738
|
if (e.spans) {
|
|
@@ -770,7 +792,7 @@ var se = {
|
|
|
770
792
|
run: D,
|
|
771
793
|
finished: e
|
|
772
794
|
}), await t;
|
|
773
|
-
},
|
|
795
|
+
}, U = async (e) => {
|
|
774
796
|
if (A = e.pts + e.duration, !e.data.byteLength) return;
|
|
775
797
|
let t = v("ack", D);
|
|
776
798
|
p.postMessage({
|
|
@@ -778,7 +800,7 @@ var se = {
|
|
|
778
800
|
run: D,
|
|
779
801
|
data: e.data
|
|
780
802
|
}, [e.data]), await t;
|
|
781
|
-
},
|
|
803
|
+
}, ee = async (t) => {
|
|
782
804
|
if (V = await P({
|
|
783
805
|
publicPath: t.publicPath,
|
|
784
806
|
workerUrl: t.libavWorkerUrl,
|
|
@@ -811,7 +833,7 @@ var se = {
|
|
|
811
833
|
let e = await R(V.read());
|
|
812
834
|
if (a) return;
|
|
813
835
|
if (!e) continue;
|
|
814
|
-
await
|
|
836
|
+
await U(e), e.finished && await H(!0);
|
|
815
837
|
} else {
|
|
816
838
|
await H(!1), j.set(Math.round(e * 10), g);
|
|
817
839
|
let t = V.seek(Math.max(0, e - $e));
|
|
@@ -825,7 +847,7 @@ var se = {
|
|
|
825
847
|
pts: n.timestampOffset,
|
|
826
848
|
from: r.pts,
|
|
827
849
|
start: r.pts <= 0
|
|
828
|
-
}), await
|
|
850
|
+
}), await U(r), r.finished && await H(!0);
|
|
829
851
|
}
|
|
830
852
|
} catch {
|
|
831
853
|
if (a) return;
|
|
@@ -834,7 +856,7 @@ var se = {
|
|
|
834
856
|
}
|
|
835
857
|
a || await H(!1), !a && (e(V), V = void 0);
|
|
836
858
|
}
|
|
837
|
-
},
|
|
859
|
+
}, W = () => {}, te = (e, t) => {
|
|
838
860
|
let n = !1, r = (e) => {
|
|
839
861
|
n && p.postMessage({
|
|
840
862
|
type: "end",
|
|
@@ -842,7 +864,7 @@ var se = {
|
|
|
842
864
|
finished: e
|
|
843
865
|
}), n = !1;
|
|
844
866
|
};
|
|
845
|
-
|
|
867
|
+
W = e.attach(t, (e, t) => {
|
|
846
868
|
if (e.type === "init") {
|
|
847
869
|
r(!1);
|
|
848
870
|
let t = e.data.slice(0);
|
|
@@ -869,22 +891,22 @@ var se = {
|
|
|
869
891
|
}, [t]);
|
|
870
892
|
}
|
|
871
893
|
});
|
|
872
|
-
},
|
|
894
|
+
}, G = () => {
|
|
873
895
|
if (!a) {
|
|
874
896
|
a = !0, f(!0), l(), clearInterval(C);
|
|
875
897
|
for (let e of w) n.removeEventListener(e, x);
|
|
876
|
-
n.removeEventListener("seeking", z), n.removeEventListener("seeked", B), n.removeEventListener("timeupdate", B),
|
|
898
|
+
n.removeEventListener("seeking", z), n.removeEventListener("seeked", B), n.removeEventListener("timeupdate", B), W(), V && e(V), p.terminate(), t.port.postMessage({ analysis: null });
|
|
877
899
|
for (let e of _.values()) e(h);
|
|
878
900
|
_.clear();
|
|
879
901
|
}
|
|
880
902
|
};
|
|
881
|
-
return "tap" in i ?
|
|
882
|
-
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e),
|
|
903
|
+
return "tap" in i ? te(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
|
|
904
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), G());
|
|
883
905
|
}), S(), {
|
|
884
906
|
update: (e) => {
|
|
885
907
|
o = e, f(!1);
|
|
886
908
|
},
|
|
887
|
-
stop:
|
|
909
|
+
stop: G
|
|
888
910
|
};
|
|
889
911
|
}, nt = (e, t, n, r, i) => {
|
|
890
912
|
let a = w(null), [o, s] = T(!1), [c, l] = T(null);
|
|
@@ -1165,7 +1187,7 @@ var se = {
|
|
|
1165
1187
|
"data-tooltip-delay-hide": i,
|
|
1166
1188
|
"data-tooltip-place": o,
|
|
1167
1189
|
children: n
|
|
1168
|
-
}), !s && /* @__PURE__ */ I(
|
|
1190
|
+
}), !s && /* @__PURE__ */ I(oe, {
|
|
1169
1191
|
ref: u,
|
|
1170
1192
|
css: yt(c),
|
|
1171
1193
|
id: e,
|
|
@@ -1467,9 +1489,9 @@ var se = {
|
|
|
1467
1489
|
B.current = e.pointerType;
|
|
1468
1490
|
}, H = (e) => {
|
|
1469
1491
|
B.current !== "touch" && E(z(e.clientX));
|
|
1470
|
-
},
|
|
1492
|
+
}, U = () => {
|
|
1471
1493
|
_.current && E(void 0);
|
|
1472
|
-
},
|
|
1494
|
+
}, ee = (e) => r ? e / r * 100 : 0, W = (e, t, n) => {
|
|
1473
1495
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1474
1496
|
return /* @__PURE__ */ I("div", {
|
|
1475
1497
|
className: "loaded-part",
|
|
@@ -1478,10 +1500,10 @@ var se = {
|
|
|
1478
1500
|
marginLeft: `${i}%`
|
|
1479
1501
|
}
|
|
1480
1502
|
}, e);
|
|
1481
|
-
},
|
|
1503
|
+
}, te = C(() => i === void 0 ? r ? o.map(([e, t], n) => W(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1482
1504
|
if (!i || !r) return null;
|
|
1483
1505
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1484
|
-
return !a || !o ? null :
|
|
1506
|
+
return !a || !o ? null : W(t, a.timestamp / r, o.timestamp / r);
|
|
1485
1507
|
}) ?? [], [
|
|
1486
1508
|
r,
|
|
1487
1509
|
i,
|
|
@@ -1498,7 +1520,7 @@ var se = {
|
|
|
1498
1520
|
v,
|
|
1499
1521
|
r
|
|
1500
1522
|
]);
|
|
1501
|
-
let
|
|
1523
|
+
let G = C(() => {
|
|
1502
1524
|
if (!r) return 0;
|
|
1503
1525
|
if (N && v !== void 0) return v;
|
|
1504
1526
|
let e = f ?? t;
|
|
@@ -1509,22 +1531,22 @@ var se = {
|
|
|
1509
1531
|
N,
|
|
1510
1532
|
v,
|
|
1511
1533
|
f
|
|
1512
|
-
]),
|
|
1513
|
-
if (!
|
|
1514
|
-
let e = b / r * 100, t =
|
|
1515
|
-
return t >= 0 ? t :
|
|
1534
|
+
]), K = C(() => p(d, r), [d, r]), ne = K.length > 0, q = C(() => {
|
|
1535
|
+
if (!ne || b === void 0 || !r) return -1;
|
|
1536
|
+
let e = b / r * 100, t = K.findIndex((t, n) => n < K.length - 1 && e >= t && e < K[n + 1]);
|
|
1537
|
+
return t >= 0 ? t : K.length - 2;
|
|
1516
1538
|
}, [
|
|
1517
|
-
|
|
1518
|
-
|
|
1539
|
+
ne,
|
|
1540
|
+
K,
|
|
1519
1541
|
b,
|
|
1520
1542
|
r
|
|
1521
|
-
]),
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
]),
|
|
1543
|
+
]), re = C(() => ne ? m(K, (e) => e !== q) : void 0, [
|
|
1544
|
+
ne,
|
|
1545
|
+
K,
|
|
1546
|
+
q
|
|
1547
|
+
]), ie = C(() => q >= 0 ? m(K, (e) => e === q) : void 0, [K, q]), J = C(() => {
|
|
1526
1548
|
if (b !== void 0) return d.find(({ start: e, end: t }) => e <= b && b < t);
|
|
1527
|
-
}, [d, b]),
|
|
1549
|
+
}, [d, b]), ae = C(() => {
|
|
1528
1550
|
if (b) {
|
|
1529
1551
|
if (l) return l(b);
|
|
1530
1552
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
|
|
@@ -1533,20 +1555,20 @@ var se = {
|
|
|
1533
1555
|
c,
|
|
1534
1556
|
l,
|
|
1535
1557
|
b
|
|
1536
|
-
]),
|
|
1558
|
+
]), oe = (e, t) => /* @__PURE__ */ L("div", {
|
|
1537
1559
|
className: e ? `track ${e}` : "track",
|
|
1538
1560
|
style: t ? { maskImage: t } : void 0,
|
|
1539
1561
|
children: [
|
|
1540
1562
|
/* @__PURE__ */ I("div", { className: "background-bar" }),
|
|
1541
1563
|
/* @__PURE__ */ I("div", {
|
|
1542
1564
|
className: "loaded",
|
|
1543
|
-
children:
|
|
1565
|
+
children: te
|
|
1544
1566
|
}),
|
|
1545
1567
|
/* @__PURE__ */ I("div", {
|
|
1546
1568
|
className: "play-container",
|
|
1547
1569
|
children: /* @__PURE__ */ I("div", {
|
|
1548
1570
|
className: "play",
|
|
1549
|
-
style: { transform: `scaleX(${
|
|
1571
|
+
style: { transform: `scaleX(${G})` }
|
|
1550
1572
|
})
|
|
1551
1573
|
})
|
|
1552
1574
|
]
|
|
@@ -1557,31 +1579,31 @@ var se = {
|
|
|
1557
1579
|
className: [
|
|
1558
1580
|
"progress-bar",
|
|
1559
1581
|
N ? "dragging" : "",
|
|
1560
|
-
|
|
1582
|
+
ne ? "segmented" : ""
|
|
1561
1583
|
].filter(Boolean).join(" "),
|
|
1562
1584
|
onPointerDown: V,
|
|
1563
1585
|
onPointerMove: V,
|
|
1564
1586
|
onMouseMove: H,
|
|
1565
|
-
onMouseOut:
|
|
1587
|
+
onMouseOut: U,
|
|
1566
1588
|
children: [
|
|
1567
|
-
|
|
1589
|
+
oe(void 0, re),
|
|
1568
1590
|
b ? /* @__PURE__ */ L("div", {
|
|
1569
1591
|
className: "cursor-time",
|
|
1570
1592
|
style: {
|
|
1571
|
-
left:
|
|
1572
|
-
maxWidth:
|
|
1593
|
+
left: J ? `clamp(var(--thumbnail-half), ${ee(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${ee(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1594
|
+
maxWidth: J ? "var(--thumbnail-width)" : void 0
|
|
1573
1595
|
},
|
|
1574
1596
|
children: [/* @__PURE__ */ I("span", {
|
|
1575
1597
|
className: "cursor-time-value",
|
|
1576
1598
|
children: _t(b)
|
|
1577
|
-
}),
|
|
1599
|
+
}), J ? /* @__PURE__ */ I("span", {
|
|
1578
1600
|
className: "chapter-title",
|
|
1579
|
-
children:
|
|
1601
|
+
children: J.title
|
|
1580
1602
|
}) : void 0]
|
|
1581
1603
|
}) : void 0,
|
|
1582
1604
|
/* @__PURE__ */ I("div", { className: "progress" }),
|
|
1583
1605
|
/* @__PURE__ */ I("div", { className: "hover" }),
|
|
1584
|
-
|
|
1606
|
+
ie ? oe("focus", ie) : void 0,
|
|
1585
1607
|
/* @__PURE__ */ I("div", { className: "scrubber" }),
|
|
1586
1608
|
/* @__PURE__ */ I("div", {
|
|
1587
1609
|
className: "padding",
|
|
@@ -1592,8 +1614,8 @@ var se = {
|
|
|
1592
1614
|
}),
|
|
1593
1615
|
/* @__PURE__ */ I("div", {
|
|
1594
1616
|
className: "thumbnail",
|
|
1595
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
1596
|
-
children:
|
|
1617
|
+
style: { left: `clamp(var(--thumbnail-half), ${ee(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1618
|
+
children: ae?.url ? /* @__PURE__ */ I("img", { src: ae.url }) : void 0
|
|
1597
1619
|
})
|
|
1598
1620
|
]
|
|
1599
1621
|
});
|
|
@@ -1949,7 +1971,7 @@ ${Nt}
|
|
|
1949
1971
|
onClick: i,
|
|
1950
1972
|
"aria-label": u,
|
|
1951
1973
|
"aria-expanded": r,
|
|
1952
|
-
children: /* @__PURE__ */ I(
|
|
1974
|
+
children: /* @__PURE__ */ I(re, { className: "alert-triangle" })
|
|
1953
1975
|
}),
|
|
1954
1976
|
toolTipText: /* @__PURE__ */ I("span", { children: u })
|
|
1955
1977
|
}), r && /* @__PURE__ */ L("div", {
|
|
@@ -1961,7 +1983,7 @@ ${Nt}
|
|
|
1961
1983
|
type: "button",
|
|
1962
1984
|
onClick: l,
|
|
1963
1985
|
"aria-label": t(a.copyErrors),
|
|
1964
|
-
children: [I(s ? V :
|
|
1986
|
+
children: [I(s ? V : ee, {}), /* @__PURE__ */ I("span", { children: t(s ? a.copied : a.copy) })]
|
|
1965
1987
|
})]
|
|
1966
1988
|
}), e.map((e, r) => /* @__PURE__ */ L("div", {
|
|
1967
1989
|
className: "entry no-hover",
|
|
@@ -2207,7 +2229,7 @@ ${Nt}
|
|
|
2207
2229
|
onClick: m,
|
|
2208
2230
|
"aria-label": t(a.settings),
|
|
2209
2231
|
"aria-expanded": p,
|
|
2210
|
-
children: /* @__PURE__ */ I(
|
|
2232
|
+
children: /* @__PURE__ */ I(q, {})
|
|
2211
2233
|
}),
|
|
2212
2234
|
toolTipText: /* @__PURE__ */ I("span", { children: t(a.settings) })
|
|
2213
2235
|
}),
|
|
@@ -2222,14 +2244,14 @@ ${Nt}
|
|
|
2222
2244
|
}) : null,
|
|
2223
2245
|
i.length > 1 ? /* @__PURE__ */ L("div", {
|
|
2224
2246
|
onClick: w(2),
|
|
2225
|
-
children: [/* @__PURE__ */ I("div", { children: t(a.audio) }), /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(
|
|
2247
|
+
children: [/* @__PURE__ */ I("div", { children: t(a.audio) }), /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(U, {}) })]
|
|
2226
2248
|
}) : null,
|
|
2227
2249
|
S > 1 ? /* @__PURE__ */ L("div", {
|
|
2228
2250
|
onClick: w(3),
|
|
2229
2251
|
children: [/* @__PURE__ */ I("div", { children: t(a.quality) }), /* @__PURE__ */ L("div", { children: [C ? /* @__PURE__ */ I("span", {
|
|
2230
2252
|
className: "secondary",
|
|
2231
2253
|
children: C
|
|
2232
|
-
}) : null, /* @__PURE__ */ I(
|
|
2254
|
+
}) : null, /* @__PURE__ */ I(U, {})] })]
|
|
2233
2255
|
}) : null,
|
|
2234
2256
|
/* @__PURE__ */ L("div", {
|
|
2235
2257
|
onClick: w(1),
|
|
@@ -2239,7 +2261,7 @@ ${Nt}
|
|
|
2239
2261
|
minimumFractionDigits: 2,
|
|
2240
2262
|
maximumFractionDigits: 2
|
|
2241
2263
|
})
|
|
2242
|
-
}), /* @__PURE__ */ I(
|
|
2264
|
+
}), /* @__PURE__ */ I(U, {})] })]
|
|
2243
2265
|
}),
|
|
2244
2266
|
l ? /* @__PURE__ */ L("div", {
|
|
2245
2267
|
role: "switch",
|
|
@@ -2509,7 +2531,7 @@ ${Nt}
|
|
|
2509
2531
|
ref: e,
|
|
2510
2532
|
"aria-label": n(a.mute),
|
|
2511
2533
|
"aria-pressed": i || r === 0,
|
|
2512
|
-
children: I(i || r === 0 ?
|
|
2534
|
+
children: I(i || r === 0 ? ae : r <= .5 ? ie : J, {
|
|
2513
2535
|
size: 18,
|
|
2514
2536
|
color: "#fff"
|
|
2515
2537
|
})
|
|
@@ -2764,7 +2786,7 @@ ${Nt}
|
|
|
2764
2786
|
type: "button",
|
|
2765
2787
|
onClick: () => r.togglePaused(),
|
|
2766
2788
|
"aria-label": i(j ? a.replay : o ? a.play : a.pause),
|
|
2767
|
-
children: I(j ?
|
|
2789
|
+
children: I(j ? ne : o ? K : G, {})
|
|
2768
2790
|
}),
|
|
2769
2791
|
toolTipText: /* @__PURE__ */ I("span", { children: i(j ? a.replayKey : o ? a.playKey : a.pauseKey) })
|
|
2770
2792
|
}),
|
|
@@ -2824,7 +2846,7 @@ ${Nt}
|
|
|
2824
2846
|
onClick: P,
|
|
2825
2847
|
"aria-label": i(a.fullScreen),
|
|
2826
2848
|
"aria-pressed": d,
|
|
2827
|
-
children: I(d ?
|
|
2849
|
+
children: I(d ? te : W, {})
|
|
2828
2850
|
}),
|
|
2829
2851
|
toolTipText: /* @__PURE__ */ I("span", { children: i(d ? a.exitFullScreenKey : a.fullScreenKey) })
|
|
2830
2852
|
})
|
|
@@ -3192,7 +3214,7 @@ ${Nt}
|
|
|
3192
3214
|
}
|
|
3193
3215
|
})), B = D === !0 ? {} : D || void 0, V = w(B);
|
|
3194
3216
|
V.current = B;
|
|
3195
|
-
let H = B ? B.id : void 0,
|
|
3217
|
+
let H = B ? B.id : void 0, U = B ? B.origin : void 0, ee = B ? B.channel : void 0;
|
|
3196
3218
|
S(() => {
|
|
3197
3219
|
if (!D || !E) return;
|
|
3198
3220
|
let e, t = !1;
|
|
@@ -3208,36 +3230,36 @@ ${Nt}
|
|
|
3208
3230
|
E,
|
|
3209
3231
|
!!D,
|
|
3210
3232
|
H,
|
|
3211
|
-
|
|
3212
|
-
|
|
3233
|
+
U,
|
|
3234
|
+
ee
|
|
3213
3235
|
]);
|
|
3214
|
-
let
|
|
3236
|
+
let W = X((e) => e.chapters), te = JSON.stringify(W);
|
|
3215
3237
|
S(() => {
|
|
3216
|
-
z.chapters =
|
|
3217
|
-
}, [
|
|
3218
|
-
let
|
|
3238
|
+
z.chapters = W, z.endingOffered = M, z.dispatchEvent(new Event("chapterschange"));
|
|
3239
|
+
}, [te, M]);
|
|
3240
|
+
let G = e.autoplayNext;
|
|
3219
3241
|
S(() => {
|
|
3220
|
-
P === null && R(
|
|
3221
|
-
}, [
|
|
3222
|
-
let
|
|
3223
|
-
|
|
3242
|
+
P === null && R(G);
|
|
3243
|
+
}, [G, P]);
|
|
3244
|
+
let K = w(e.onAutoplayNextChange);
|
|
3245
|
+
K.current = e.onAutoplayNextChange, S(() => {
|
|
3224
3246
|
z.autoplayNext = L ?? null, z.dispatchEvent(new Event("autoplaynextchange"));
|
|
3225
3247
|
}, [L]);
|
|
3226
|
-
let
|
|
3248
|
+
let ne = e.fullscreen ?? (O === null ? void 0 : {
|
|
3227
3249
|
active: O,
|
|
3228
3250
|
request: () => z.dispatchEvent(new Event("fullscreenrequest"))
|
|
3229
|
-
}),
|
|
3230
|
-
Ae(v, b, r, h ?
|
|
3231
|
-
let
|
|
3251
|
+
}), q = C(() => rt(), [o]);
|
|
3252
|
+
Ae(v, b, r, h ? q.push : void 0);
|
|
3253
|
+
let re = r?.normalizeVolume ?? !0, [ie, J] = T(re);
|
|
3232
3254
|
S(() => {
|
|
3233
|
-
|
|
3234
|
-
}, [
|
|
3235
|
-
let
|
|
3236
|
-
|
|
3237
|
-
let
|
|
3255
|
+
J(re);
|
|
3256
|
+
}, [re]);
|
|
3257
|
+
let ae = w(r?.onNormalizeVolumeChange);
|
|
3258
|
+
ae.current = r?.onNormalizeVolumeChange;
|
|
3259
|
+
let oe = r?.normalizerWorkletUrl, se = w(p ?? f);
|
|
3238
3260
|
se.current = p ?? f;
|
|
3239
|
-
let Y = X((e) => e.selectedAudioTrack), ce = !!f, { refused: le } = nt(v,
|
|
3240
|
-
tap:
|
|
3261
|
+
let Y = X((e) => e.selectedAudioTrack), ce = !!f, { refused: le } = nt(v, oe, ie, C(() => ce && o && c && l && typeof Y == "number" && Y >= 0 ? h ? {
|
|
3262
|
+
tap: q,
|
|
3241
3263
|
audioStreamIndex: Y
|
|
3242
3264
|
} : {
|
|
3243
3265
|
read: (e, t) => se.current(e, t),
|
|
@@ -3252,16 +3274,16 @@ ${Nt}
|
|
|
3252
3274
|
l,
|
|
3253
3275
|
Y,
|
|
3254
3276
|
h,
|
|
3255
|
-
|
|
3256
|
-
]), C(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ue = C(() =>
|
|
3257
|
-
enabled:
|
|
3277
|
+
q
|
|
3278
|
+
]), C(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ue = C(() => oe && typeof AudioWorkletNode == "function" ? {
|
|
3279
|
+
enabled: ie,
|
|
3258
3280
|
available: !le,
|
|
3259
3281
|
setEnabled: (e) => {
|
|
3260
|
-
|
|
3282
|
+
J(e), ae.current?.(e);
|
|
3261
3283
|
}
|
|
3262
3284
|
} : null, [
|
|
3263
|
-
|
|
3264
|
-
|
|
3285
|
+
oe,
|
|
3286
|
+
ie,
|
|
3265
3287
|
le
|
|
3266
3288
|
]), { thumbnails: de, requestThumbnail: fe } = ze({
|
|
3267
3289
|
publicPath: c,
|
|
@@ -3308,7 +3330,7 @@ ${Nt}
|
|
|
3308
3330
|
Z({ autoplayNext: L === void 0 ? null : {
|
|
3309
3331
|
enabled: L,
|
|
3310
3332
|
setEnabled: (e) => {
|
|
3311
|
-
R(e),
|
|
3333
|
+
R(e), K.current?.(e);
|
|
3312
3334
|
}
|
|
3313
3335
|
} });
|
|
3314
3336
|
}, [Z, L]), S(() => {
|
|
@@ -3366,7 +3388,7 @@ ${Nt}
|
|
|
3366
3388
|
overlay: e.overlay,
|
|
3367
3389
|
controls: e.controls,
|
|
3368
3390
|
shortcuts: e.shortcuts,
|
|
3369
|
-
fullscreen:
|
|
3391
|
+
fullscreen: ne,
|
|
3370
3392
|
endingOffered: M,
|
|
3371
3393
|
children: t
|
|
3372
3394
|
});
|