@banou/media-player 0.10.41 → 0.10.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +248 -232
- package/dist/react/hooks/use-frame-step.d.ts +3 -3
- package/package.json +1 -1
- package/src/lib/audio/volume-normalizer.ts +15 -1
- package/src/lib/react/hooks/use-frame-step.ts +28 -11
- package/src/lib/react/hooks/use-playback.ts +10 -6
- package/src/lib/react/hooks/use-thumbnails.ts +22 -1
- package/src/lib/utils/chapters.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -187,7 +187,10 @@ var se = {
|
|
|
187
187
|
S(() => (F.current = {
|
|
188
188
|
count: 0,
|
|
189
189
|
at: 0
|
|
190
|
-
}, a.setSourceState({
|
|
190
|
+
}, a.setSourceState({
|
|
191
|
+
playbackErrors: [],
|
|
192
|
+
seekingTo: void 0
|
|
193
|
+
}), () => {
|
|
191
194
|
I.current && clearTimeout(I.current);
|
|
192
195
|
}), [c]);
|
|
193
196
|
let L = w(null), R = w(null), z = w(void 0), B = w(c);
|
|
@@ -233,7 +236,7 @@ var se = {
|
|
|
233
236
|
return;
|
|
234
237
|
}
|
|
235
238
|
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), i = !1, o = "prepared", s = () => {
|
|
236
|
-
if (!i && (i = !0, a.seek(e), n)) {
|
|
239
|
+
if (!i && (i = !0, L.current === t && (a.seek(e), n))) {
|
|
237
240
|
let n = t.videoElement, i = 0;
|
|
238
241
|
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);
|
|
239
242
|
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${o}, runway ${i.toFixed(1)}s${o === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
@@ -339,7 +342,7 @@ var se = {
|
|
|
339
342
|
if (n) return;
|
|
340
343
|
a.setSourceState({ ready: !0 });
|
|
341
344
|
let t = R.current;
|
|
342
|
-
R.current = null, t && t.size === c && t.time > 0
|
|
345
|
+
R.current = null, t && t.size === c && t.time > 0 ? e.currentTime = t.time : a.setSourceState({ seekingTo: void 0 }), E && e.play().catch(() => {});
|
|
343
346
|
},
|
|
344
347
|
onError: u,
|
|
345
348
|
onRecovered: () => {
|
|
@@ -378,7 +381,7 @@ var se = {
|
|
|
378
381
|
}
|
|
379
382
|
})(), () => {
|
|
380
383
|
n = !0, R.current = {
|
|
381
|
-
time: e.currentTime,
|
|
384
|
+
time: a.state.seekingTo ?? e.currentTime,
|
|
382
385
|
size: c
|
|
383
386
|
}, L.current?.destroy(), L.current = null, a.setSourceState({ ready: !1 });
|
|
384
387
|
};
|
|
@@ -439,31 +442,31 @@ var se = {
|
|
|
439
442
|
}) }), () => r({ stepFrame: void 0 })) : void 0;
|
|
440
443
|
let o, s = !1, c = [], l = () => {
|
|
441
444
|
s = !0, o = void 0;
|
|
442
|
-
}, u = () => {
|
|
443
|
-
o = void 0, c.length = 0;
|
|
445
|
+
}, u = () => {}, d = () => {
|
|
446
|
+
o = void 0, c.length = 0, u();
|
|
444
447
|
};
|
|
445
|
-
t.addEventListener("seeking", l), t.addEventListener("emptied",
|
|
446
|
-
let
|
|
448
|
+
t.addEventListener("seeking", l), t.addEventListener("emptied", d);
|
|
449
|
+
let f = 0, p = (e, n) => {
|
|
447
450
|
let r = s;
|
|
448
|
-
!t.paused && !t.seeking && (s = !1), !r && !t.paused && t.playbackRate <= 1 && o && n.presentedFrames === o.presentedFrames + 1 && n.mediaTime > o.mediaTime && (c.push(n.mediaTime - o.mediaTime), c.length > 60 && c.shift()), o = r ? void 0 : n,
|
|
451
|
+
!t.paused && !t.seeking && (s = !1), !r && !t.paused && t.playbackRate <= 1 && o && n.presentedFrames === o.presentedFrames + 1 && n.mediaTime > o.mediaTime && (c.push(n.mediaTime - o.mediaTime), c.length > 60 && c.shift()), o = r ? void 0 : n, f = t.requestVideoFrameCallback(p);
|
|
449
452
|
};
|
|
450
|
-
|
|
451
|
-
let
|
|
453
|
+
f = t.requestVideoFrameCallback(p);
|
|
454
|
+
let m = () => {
|
|
452
455
|
if (c.length < 5) return je;
|
|
453
|
-
let e = [...c].sort((e, t) => e - t), t = e[e.length
|
|
456
|
+
let e = [...c].sort((e, t) => e - t), t = e[Math.floor(e.length / 10)], n = e.filter((e) => Math.abs(e - t) <= t / 4);
|
|
454
457
|
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
455
|
-
},
|
|
456
|
-
t.
|
|
457
|
-
let r =
|
|
458
|
-
let n =
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
458
|
+
}, h = !0, g = Ne(async (e) => {
|
|
459
|
+
if (!h || t.readyState === HTMLMediaElement.HAVE_NOTHING || !t.paused && (t.pause(), await Me(t, 100), !h)) return;
|
|
460
|
+
let r = m(), i = n.state.seekingTo, a = i === void 0 ? o ? o.mediaTime + (e > 0 ? 1.5 : -.5) * r : t.currentTime + e * r : i + e * r, s = Math.max(0, Math.min(a, t.duration || a)), c = new Promise((e) => {
|
|
461
|
+
let n = () => {
|
|
462
|
+
clearTimeout(r), t.removeEventListener("seeked", n), e();
|
|
463
|
+
}, r = setTimeout(n, 15e3);
|
|
464
|
+
u = n, t.addEventListener("seeked", n);
|
|
462
465
|
}), { requestSeek: l } = n.state;
|
|
463
466
|
l ? l(s) : t.currentTime = s, await c;
|
|
464
467
|
});
|
|
465
|
-
return r({ stepFrame:
|
|
466
|
-
t.removeEventListener("seeking", l), t.removeEventListener("emptied",
|
|
468
|
+
return r({ stepFrame: g }), () => {
|
|
469
|
+
h = !1, t.removeEventListener("seeking", l), t.removeEventListener("emptied", d), t.cancelVideoFrameCallback(f), r({ stepFrame: void 0 });
|
|
467
470
|
};
|
|
468
471
|
}, [
|
|
469
472
|
e,
|
|
@@ -471,13 +474,17 @@ var se = {
|
|
|
471
474
|
n,
|
|
472
475
|
r
|
|
473
476
|
]);
|
|
474
|
-
}, Fe = 5e3, Ie = 6e4, Le = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: i }) => {
|
|
477
|
+
}, Fe = 5e3, Ie = 6e4, Le = 1e6, Re = (e, t) => !e || e.some(([e, n]) => e <= 0 && n >= Math.min(Le, t)), ze = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: i }) => {
|
|
475
478
|
let [a, s] = T([]), c = w(null), l = w(r);
|
|
476
479
|
l.current = r;
|
|
477
480
|
let u = C(() => i?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), d = w(u);
|
|
478
|
-
|
|
481
|
+
d.current = u;
|
|
482
|
+
let f = w(null);
|
|
483
|
+
return S(() => {
|
|
479
484
|
if (!n || !r || !e || !t) return;
|
|
480
|
-
let i = !1, a = null, u,
|
|
485
|
+
let i = !1, a = null, u, p = Fe, m = () => {
|
|
486
|
+
f.current = null;
|
|
487
|
+
let r = !Re(d.current, n);
|
|
481
488
|
o({
|
|
482
489
|
publicPath: e,
|
|
483
490
|
workerUrl: t,
|
|
@@ -493,25 +500,29 @@ var se = {
|
|
|
493
500
|
}
|
|
494
501
|
a = e, c.current = e, e.update(d.current);
|
|
495
502
|
}, () => {
|
|
496
|
-
i || (u = setTimeout(
|
|
503
|
+
if (i || (u = setTimeout(m, p), p = Math.min(p * 2, Ie), !r)) return;
|
|
504
|
+
let e = () => {
|
|
505
|
+
clearTimeout(u), m();
|
|
506
|
+
};
|
|
507
|
+
Re(d.current, n) ? e() : f.current = e;
|
|
497
508
|
});
|
|
498
509
|
};
|
|
499
|
-
return
|
|
500
|
-
i = !0, clearTimeout(u), c.current = null, a?.destroy(), s([]);
|
|
510
|
+
return m(), () => {
|
|
511
|
+
i = !0, f.current = null, clearTimeout(u), c.current = null, a?.destroy(), s([]);
|
|
501
512
|
};
|
|
502
513
|
}, [
|
|
503
514
|
n,
|
|
504
515
|
e,
|
|
505
516
|
t
|
|
506
517
|
]), S(() => {
|
|
507
|
-
c.current?.update(u);
|
|
518
|
+
c.current?.update(u), n && Re(u, n) && f.current?.();
|
|
508
519
|
}, [u]), {
|
|
509
520
|
thumbnails: a,
|
|
510
521
|
requestThumbnail: b((e) => {
|
|
511
522
|
c.current?.prioritize(e);
|
|
512
523
|
}, [])
|
|
513
524
|
};
|
|
514
|
-
},
|
|
525
|
+
}, Be = (e, t) => {
|
|
515
526
|
let n = w(null), [i, a] = T(!1), [o] = T(() => r());
|
|
516
527
|
S(() => {
|
|
517
528
|
if (!e || !t || !o) return;
|
|
@@ -539,10 +550,10 @@ var se = {
|
|
|
539
550
|
mode: o,
|
|
540
551
|
burnedIn: i
|
|
541
552
|
};
|
|
542
|
-
},
|
|
543
|
-
let t =
|
|
553
|
+
}, Ve = "(hover: hover) and (pointer: fine)", He = () => typeof matchMedia == "function" ? matchMedia(Ve) : void 0, Ue = (e) => {
|
|
554
|
+
let t = He();
|
|
544
555
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
545
|
-
},
|
|
556
|
+
}, We = () => !!He()?.matches, Ge = () => !1, Ke = (e, t) => {
|
|
546
557
|
let [n, r] = T(!1), [i, a] = T(), o = w(t);
|
|
547
558
|
t && (o.current = t);
|
|
548
559
|
let s = w(!1), c = b((e) => {
|
|
@@ -565,7 +576,7 @@ var se = {
|
|
|
565
576
|
d,
|
|
566
577
|
u
|
|
567
578
|
]);
|
|
568
|
-
let f = E(
|
|
579
|
+
let f = E(Ue, We, Ge), [p, m] = T(!1);
|
|
569
580
|
S(() => {
|
|
570
581
|
if (!d) return;
|
|
571
582
|
let e = (e) => {
|
|
@@ -606,61 +617,66 @@ var se = {
|
|
|
606
617
|
u,
|
|
607
618
|
g
|
|
608
619
|
]);
|
|
609
|
-
},
|
|
620
|
+
}, qe = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
610
621
|
channelCountMode: "max",
|
|
611
622
|
processorOptions: n
|
|
612
|
-
})),
|
|
623
|
+
})), Je = /* @__PURE__ */ new WeakMap(), Ye = (e) => new Promise((t, n) => {
|
|
613
624
|
let r = () => {
|
|
614
625
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
615
626
|
};
|
|
616
627
|
e.addEventListener("statechange", r), r();
|
|
617
|
-
}),
|
|
618
|
-
let r =
|
|
628
|
+
}), Xe = (e, t, n = {}) => {
|
|
629
|
+
let r = Je.get(e);
|
|
619
630
|
if (r) return r.wake(), r;
|
|
620
|
-
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = () => 20 * Math.log10(Math.max(e.volume, 1e-6)),
|
|
631
|
+
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = !1, l = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), u = e.ownerDocument, d = () => {
|
|
621
632
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
622
|
-
},
|
|
633
|
+
}, f = (e) => {
|
|
623
634
|
for (let t of [
|
|
624
635
|
"pointerdown",
|
|
625
636
|
"pointerup",
|
|
626
637
|
"keydown"
|
|
627
|
-
]) e ?
|
|
628
|
-
},
|
|
629
|
-
|
|
630
|
-
|
|
638
|
+
]) e ? u.addEventListener(t, d, !0) : u.removeEventListener(t, d, !0);
|
|
639
|
+
}, p = () => {
|
|
640
|
+
c && i.state === "running" && i.suspend().catch(() => {});
|
|
641
|
+
let e = !s && !c && i.state === "suspended";
|
|
642
|
+
f(e), e && o && d();
|
|
631
643
|
};
|
|
632
|
-
i.addEventListener("statechange",
|
|
633
|
-
let
|
|
634
|
-
let r = await
|
|
644
|
+
i.addEventListener("statechange", p), p();
|
|
645
|
+
let m = (async () => {
|
|
646
|
+
let r = await qe(i, t, {
|
|
635
647
|
...n,
|
|
636
648
|
enabled: a,
|
|
637
|
-
inputGainDb:
|
|
649
|
+
inputGainDb: l()
|
|
638
650
|
});
|
|
639
|
-
await
|
|
651
|
+
await Ye(i);
|
|
640
652
|
let s = R(i, e);
|
|
641
653
|
return r.port.postMessage({
|
|
642
654
|
enabled: a,
|
|
643
|
-
inputGainDb:
|
|
644
|
-
}), s.connect(r).connect(i.destination), e.addEventListener("volumechange", () => r.port.postMessage({ inputGainDb:
|
|
655
|
+
inputGainDb: l()
|
|
656
|
+
}), s.connect(r).connect(i.destination), e.addEventListener("volumechange", () => r.port.postMessage({ inputGainDb: l() })), e.addEventListener("seeking", () => r.port.postMessage({ reset: "seek" })), e.addEventListener("emptied", () => r.port.postMessage({ reset: "source" })), e.addEventListener("pause", () => {
|
|
657
|
+
c = !0, i.state === "running" && i.suspend().catch(() => {});
|
|
658
|
+
}), e.addEventListener("play", () => {
|
|
659
|
+
c = !1, d();
|
|
660
|
+
}), o = r, r;
|
|
645
661
|
})();
|
|
646
|
-
|
|
647
|
-
s = !0,
|
|
662
|
+
m.catch(() => {
|
|
663
|
+
s = !0, f(!1), i.close().catch(() => {});
|
|
648
664
|
});
|
|
649
|
-
let
|
|
665
|
+
let h = {
|
|
650
666
|
context: i,
|
|
651
|
-
routed:
|
|
667
|
+
routed: m,
|
|
652
668
|
setEnabled: (e) => {
|
|
653
669
|
a = e, o?.port.postMessage({ enabled: a });
|
|
654
670
|
},
|
|
655
671
|
release: () => {
|
|
656
|
-
s = !0,
|
|
672
|
+
s = !0, f(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (Je.delete(e), i.close().catch(() => {}));
|
|
657
673
|
},
|
|
658
674
|
wake: () => {
|
|
659
|
-
i.state !== "closed" && (s = !1,
|
|
675
|
+
i.state !== "closed" && (s = !1, d(), p());
|
|
660
676
|
}
|
|
661
677
|
};
|
|
662
|
-
return
|
|
663
|
-
},
|
|
678
|
+
return Je.set(e, h), h;
|
|
679
|
+
}, Ze = 20, Qe = 5, $e = 1, et = 50, tt = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
664
680
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
665
681
|
for (let e of [...c]) e();
|
|
666
682
|
c.clear();
|
|
@@ -707,7 +723,7 @@ var se = {
|
|
|
707
723
|
}), S = () => p.postMessage({
|
|
708
724
|
type: "playhead",
|
|
709
725
|
time: n.currentTime
|
|
710
|
-
}), C = setInterval(x,
|
|
726
|
+
}), C = setInterval(x, et), w = [
|
|
711
727
|
"play",
|
|
712
728
|
"playing",
|
|
713
729
|
"pause",
|
|
@@ -724,7 +740,7 @@ var se = {
|
|
|
724
740
|
return t >= (h.end ?? T) - .05 ? null : t;
|
|
725
741
|
}, N = (e) => j.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
726
742
|
let e = n.currentTime, t = M(e), r = O && y !== D;
|
|
727
|
-
if (t !== null && t < e +
|
|
743
|
+
if (t !== null && t < e + Ze) return r && k <= t + 1 && t <= A + Qe ? "read" : N(t);
|
|
728
744
|
if (r) return "read";
|
|
729
745
|
let i = t ?? M(0);
|
|
730
746
|
return i === null ? "done" : N(i);
|
|
@@ -789,7 +805,7 @@ var se = {
|
|
|
789
805
|
await H(e), e.finished && await V(!0);
|
|
790
806
|
} else {
|
|
791
807
|
await V(!1), j.set(Math.round(e * 10), g);
|
|
792
|
-
let t = B.seek(Math.max(0, e -
|
|
808
|
+
let t = B.seek(Math.max(0, e - $e));
|
|
793
809
|
f(!0);
|
|
794
810
|
let r = await L(t);
|
|
795
811
|
if (a) return;
|
|
@@ -861,12 +877,12 @@ var se = {
|
|
|
861
877
|
},
|
|
862
878
|
stop: ne
|
|
863
879
|
};
|
|
864
|
-
},
|
|
880
|
+
}, nt = (e, t, n, r, i) => {
|
|
865
881
|
let a = w(null), [o, s] = T(!1), [c, l] = T(null);
|
|
866
882
|
S(() => {
|
|
867
883
|
if (e && t) {
|
|
868
884
|
if (n && !a.current) {
|
|
869
|
-
let r =
|
|
885
|
+
let r = Xe(e, t, { enabled: n });
|
|
870
886
|
a.current = r, r.routed.then((e) => {
|
|
871
887
|
a.current === r && l(e);
|
|
872
888
|
}, (e) => {
|
|
@@ -890,7 +906,7 @@ var se = {
|
|
|
890
906
|
return S(() => {
|
|
891
907
|
let r = f.current;
|
|
892
908
|
if (!c || !e || !t || !n || !r) return;
|
|
893
|
-
let i =
|
|
909
|
+
let i = tt({
|
|
894
910
|
node: c,
|
|
895
911
|
element: e,
|
|
896
912
|
scriptUrl: t,
|
|
@@ -912,7 +928,7 @@ var se = {
|
|
|
912
928
|
]), S(() => {
|
|
913
929
|
d.current?.update(i);
|
|
914
930
|
}, [i]), { refused: o };
|
|
915
|
-
},
|
|
931
|
+
}, rt = () => {
|
|
916
932
|
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
917
933
|
return {
|
|
918
934
|
push: (n) => {
|
|
@@ -958,7 +974,7 @@ var se = {
|
|
|
958
974
|
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 ",
|
|
959
975
|
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 "
|
|
960
976
|
}
|
|
961
|
-
},
|
|
977
|
+
}, it = D`
|
|
962
978
|
display: flex;
|
|
963
979
|
justify-content: center;
|
|
964
980
|
align-items: center;
|
|
@@ -971,7 +987,7 @@ var se = {
|
|
|
971
987
|
margin: auto;
|
|
972
988
|
pointer-events: none;
|
|
973
989
|
}
|
|
974
|
-
`,
|
|
990
|
+
`, at = D`
|
|
975
991
|
position: absolute;
|
|
976
992
|
top: 0;
|
|
977
993
|
left: 0;
|
|
@@ -1000,9 +1016,9 @@ var se = {
|
|
|
1000
1016
|
|
|
1001
1017
|
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%);
|
|
1002
1018
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
1003
|
-
`,
|
|
1019
|
+
`, ot = O`
|
|
1004
1020
|
to { transform: rotate(360deg); }
|
|
1005
|
-
`,
|
|
1021
|
+
`, st = D`
|
|
1006
1022
|
position: absolute;
|
|
1007
1023
|
inset: 0;
|
|
1008
1024
|
z-index: 2;
|
|
@@ -1018,9 +1034,9 @@ var se = {
|
|
|
1018
1034
|
border-radius: 50%;
|
|
1019
1035
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
1020
1036
|
border-top-color: #fff;
|
|
1021
|
-
animation: ${
|
|
1037
|
+
animation: ${ot} 0.8s linear infinite;
|
|
1022
1038
|
}
|
|
1023
|
-
`,
|
|
1039
|
+
`, ct = D`
|
|
1024
1040
|
position: absolute;
|
|
1025
1041
|
inset: auto 0 20%;
|
|
1026
1042
|
z-index: 3;
|
|
@@ -1030,36 +1046,36 @@ var se = {
|
|
|
1030
1046
|
${$.bLarge.regular}
|
|
1031
1047
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1032
1048
|
pointer-events: none;
|
|
1033
|
-
`,
|
|
1049
|
+
`, lt = new Set(Object.values(a)), ut = (e) => e instanceof Error && lt.has(e.label ?? ""), dt = (e, { format: t }) => ut(e) ? t(e.label, e.values) : e instanceof Error ? e.message : typeof e == "string" ? e : t(a.failed), ft = ({ onSubtitleRef: e }) => {
|
|
1034
1050
|
let t = Q(), n = X((e) => e.title), r = X((e) => e.hideUI), i = X((e) => e.playbackError), a = X((e) => e.ready), o = X((e) => e.size), s = X((e) => e.waiting), c = X((e) => e.seekingTo);
|
|
1035
1051
|
return /* @__PURE__ */ L(F, { children: [
|
|
1036
1052
|
n ? /* @__PURE__ */ I("div", {
|
|
1037
1053
|
className: "title",
|
|
1038
1054
|
dir: "auto",
|
|
1039
|
-
css:
|
|
1055
|
+
css: at,
|
|
1040
1056
|
style: { ...r ? {
|
|
1041
1057
|
opacity: "0",
|
|
1042
1058
|
pointerEvents: "none"
|
|
1043
1059
|
} : {} },
|
|
1044
1060
|
children: n
|
|
1045
1061
|
}) : void 0,
|
|
1046
|
-
((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */ I("div", { css:
|
|
1062
|
+
((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */ I("div", { css: st }) : void 0,
|
|
1047
1063
|
i ? /* @__PURE__ */ I("div", {
|
|
1048
|
-
css:
|
|
1064
|
+
css: ct,
|
|
1049
1065
|
dir: "auto",
|
|
1050
|
-
children:
|
|
1066
|
+
children: dt(i, t)
|
|
1051
1067
|
}) : void 0,
|
|
1052
1068
|
/* @__PURE__ */ I("div", {
|
|
1053
1069
|
className: "subtitles",
|
|
1054
1070
|
ref: e,
|
|
1055
|
-
css:
|
|
1071
|
+
css: it
|
|
1056
1072
|
})
|
|
1057
1073
|
] });
|
|
1058
|
-
},
|
|
1074
|
+
}, pt = 1e-4, mt = 1, ht = (e) => Math.max(pt, Math.min(mt, e)) ** 2, gt = (e) => Math.max(pt, Math.min(mt, e)) ** (mt / 2), _t = (e) => {
|
|
1059
1075
|
if (e === void 0) return "0:00";
|
|
1060
1076
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
1061
1077
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
1062
|
-
},
|
|
1078
|
+
}, vt = (e, t) => `${_t(e)} / ${_t(t)}`, yt = (e) => D`
|
|
1063
1079
|
display: flex;
|
|
1064
1080
|
justify-content: flex-start;
|
|
1065
1081
|
|
|
@@ -1105,25 +1121,25 @@ var se = {
|
|
|
1105
1121
|
${e === "lg" && D`
|
|
1106
1122
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
1107
1123
|
`}
|
|
1108
|
-
`,
|
|
1124
|
+
`, bt = {
|
|
1109
1125
|
x: -1,
|
|
1110
1126
|
y: -1,
|
|
1111
1127
|
anchors: 0
|
|
1112
|
-
},
|
|
1113
|
-
|
|
1114
|
-
},
|
|
1128
|
+
}, xt = (e) => {
|
|
1129
|
+
bt.x = e.clientX, bt.y = e.clientY;
|
|
1130
|
+
}, St = () => (bt.anchors++ === 0 && window.addEventListener("pointermove", xt, {
|
|
1115
1131
|
capture: !0,
|
|
1116
1132
|
passive: !0
|
|
1117
1133
|
}), () => {
|
|
1118
|
-
--
|
|
1119
|
-
}),
|
|
1120
|
-
let l = w(null), u = w(null), d = x(
|
|
1134
|
+
--bt.anchors === 0 && window.removeEventListener("pointermove", xt, { capture: !0 });
|
|
1135
|
+
}), Ct = v(!1), wt = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
1136
|
+
let l = w(null), u = w(null), d = x(Ct);
|
|
1121
1137
|
return S(() => {
|
|
1122
|
-
let e =
|
|
1138
|
+
let e = St(), t = () => {
|
|
1123
1139
|
let e = l.current;
|
|
1124
1140
|
if (!e) return;
|
|
1125
1141
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
1126
|
-
|
|
1142
|
+
bt.x >= t && bt.x < n && bt.y >= r && bt.y < i || u.current?.close();
|
|
1127
1143
|
}, n = ["fullscreenchange", "webkitfullscreenchange"];
|
|
1128
1144
|
for (let e of n) document.addEventListener(e, t);
|
|
1129
1145
|
return d && window.addEventListener("resize", t), () => {
|
|
@@ -1142,12 +1158,12 @@ var se = {
|
|
|
1142
1158
|
children: n
|
|
1143
1159
|
}), !s && /* @__PURE__ */ I(oe, {
|
|
1144
1160
|
ref: u,
|
|
1145
|
-
css:
|
|
1161
|
+
css: yt(c),
|
|
1146
1162
|
id: e,
|
|
1147
1163
|
noArrow: !0,
|
|
1148
1164
|
children: t
|
|
1149
1165
|
})] });
|
|
1150
|
-
},
|
|
1166
|
+
}, Tt = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
1151
1167
|
let [i, a] = T(!1), o = w(t);
|
|
1152
1168
|
o.current = t;
|
|
1153
1169
|
let s = w(null), c = b((t, r) => {
|
|
@@ -1186,7 +1202,7 @@ var se = {
|
|
|
1186
1202
|
style: { touchAction: "none" }
|
|
1187
1203
|
}
|
|
1188
1204
|
};
|
|
1189
|
-
},
|
|
1205
|
+
}, Et = D`
|
|
1190
1206
|
position: relative;
|
|
1191
1207
|
height: calc(.4 * var(--mp-unit));
|
|
1192
1208
|
|
|
@@ -1405,7 +1421,7 @@ var se = {
|
|
|
1405
1421
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1406
1422
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1407
1423
|
}
|
|
1408
|
-
`,
|
|
1424
|
+
`, Dt = 4, Ot = () => {
|
|
1409
1425
|
let e = X(), t = X((e) => e.currentTime), n = X((e) => e.requestSeek), r = X((e) => e.duration), i = X((e) => e.size), a = X((e) => e.downloadedRanges), o = X((e) => e.buffered), s = X((e) => e.indexes), c = X((e) => e.thumbnails), l = X((e) => e.thumbnailAt), u = X((e) => e.requestThumbnail), d = X((e) => e.chapters), f = X((e) => e.seekingTo), h = X((e) => e.setSourceState), g = X((e) => e.hideUI), _ = w(null), [v, y] = T(void 0), [b, x] = T(void 0), E = (e) => {
|
|
1410
1426
|
x(e), u(e);
|
|
1411
1427
|
}, D = !!b;
|
|
@@ -1414,13 +1430,13 @@ var se = {
|
|
|
1414
1430
|
}, [h, D]), S(() => {
|
|
1415
1431
|
g && E(void 0);
|
|
1416
1432
|
}, [g]);
|
|
1417
|
-
let O = w(void 0), k = w(0), A = w(void 0), j = w(void 0), M = w(!1), { dragging: N, handlers: P } =
|
|
1433
|
+
let O = w(void 0), k = w(0), A = w(void 0), j = w(void 0), M = w(!1), { dragging: N, handlers: P } = Tt({
|
|
1418
1434
|
ref: _,
|
|
1419
1435
|
onChange: (e) => {
|
|
1420
1436
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1421
1437
|
else if (!M.current) {
|
|
1422
1438
|
let t = _.current?.getBoundingClientRect().width ?? 0;
|
|
1423
|
-
Math.abs(e - j.current) * t >
|
|
1439
|
+
Math.abs(e - j.current) * t > Dt && (M.current = !0);
|
|
1424
1440
|
}
|
|
1425
1441
|
y(e), O.current !== "mouse" && E(e * r);
|
|
1426
1442
|
}
|
|
@@ -1526,7 +1542,7 @@ var se = {
|
|
|
1526
1542
|
]
|
|
1527
1543
|
});
|
|
1528
1544
|
return /* @__PURE__ */ L("div", {
|
|
1529
|
-
css:
|
|
1545
|
+
css: Et,
|
|
1530
1546
|
ref: _,
|
|
1531
1547
|
className: [
|
|
1532
1548
|
"progress-bar",
|
|
@@ -1547,7 +1563,7 @@ var se = {
|
|
|
1547
1563
|
},
|
|
1548
1564
|
children: [/* @__PURE__ */ I("span", {
|
|
1549
1565
|
className: "cursor-time-value",
|
|
1550
|
-
children:
|
|
1566
|
+
children: _t(b)
|
|
1551
1567
|
}), J ? /* @__PURE__ */ I("span", {
|
|
1552
1568
|
className: "chapter-title",
|
|
1553
1569
|
children: J.title
|
|
@@ -1571,7 +1587,7 @@ var se = {
|
|
|
1571
1587
|
})
|
|
1572
1588
|
]
|
|
1573
1589
|
});
|
|
1574
|
-
},
|
|
1590
|
+
}, kt = "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", At = {
|
|
1575
1591
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1576
1592
|
width: 24,
|
|
1577
1593
|
height: 24,
|
|
@@ -1581,8 +1597,8 @@ var se = {
|
|
|
1581
1597
|
strokeWidth: 2,
|
|
1582
1598
|
strokeLinecap: "round",
|
|
1583
1599
|
strokeLinejoin: "round"
|
|
1584
|
-
},
|
|
1585
|
-
...
|
|
1600
|
+
}, jt = (e) => /* @__PURE__ */ L("svg", {
|
|
1601
|
+
...At,
|
|
1586
1602
|
...e,
|
|
1587
1603
|
children: [
|
|
1588
1604
|
/* @__PURE__ */ I("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1596,8 +1612,8 @@ var se = {
|
|
|
1596
1612
|
}),
|
|
1597
1613
|
/* @__PURE__ */ I("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1598
1614
|
]
|
|
1599
|
-
}),
|
|
1600
|
-
...
|
|
1615
|
+
}), Mt = (e) => /* @__PURE__ */ L("svg", {
|
|
1616
|
+
...At,
|
|
1601
1617
|
...e,
|
|
1602
1618
|
children: [
|
|
1603
1619
|
/* @__PURE__ */ I("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1611,7 +1627,7 @@ var se = {
|
|
|
1611
1627
|
}),
|
|
1612
1628
|
/* @__PURE__ */ I("path", { d: "M6 9h3m2 0h2" })
|
|
1613
1629
|
]
|
|
1614
|
-
}),
|
|
1630
|
+
}), Nt = D`
|
|
1615
1631
|
.popover {
|
|
1616
1632
|
position: absolute;
|
|
1617
1633
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1739,7 +1755,7 @@ var se = {
|
|
|
1739
1755
|
${$.bSmall.regular}
|
|
1740
1756
|
}
|
|
1741
1757
|
}
|
|
1742
|
-
`,
|
|
1758
|
+
`, Pt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: o, pending: s, failed: c }) => {
|
|
1743
1759
|
let { format: l } = Q(), u = s !== void 0, d = (e, i, a) => {
|
|
1744
1760
|
let o = u && s === e, c = u || t.find((t) => t.id === e)?.disabled;
|
|
1745
1761
|
return /* @__PURE__ */ L("div", {
|
|
@@ -1767,7 +1783,7 @@ var se = {
|
|
|
1767
1783
|
t.map(({ id: e, label: t }) => d(e, t, "description"))
|
|
1768
1784
|
]
|
|
1769
1785
|
});
|
|
1770
|
-
},
|
|
1786
|
+
}, Ft = ({ onReset: e } = {}) => {
|
|
1771
1787
|
let t = w(null), [n, r] = T(!1), [i, a] = T(void 0), [o, s] = T(!1), c = w(e);
|
|
1772
1788
|
c.current = e;
|
|
1773
1789
|
let l = () => {
|
|
@@ -1808,7 +1824,7 @@ var se = {
|
|
|
1808
1824
|
});
|
|
1809
1825
|
}
|
|
1810
1826
|
};
|
|
1811
|
-
},
|
|
1827
|
+
}, It = D`
|
|
1812
1828
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1813
1829
|
which is the width of the player box, so it can be clamped to it. */
|
|
1814
1830
|
position: static;
|
|
@@ -1824,7 +1840,7 @@ position: static;
|
|
|
1824
1840
|
}
|
|
1825
1841
|
}
|
|
1826
1842
|
|
|
1827
|
-
${
|
|
1843
|
+
${Nt}
|
|
1828
1844
|
|
|
1829
1845
|
.popover.error-list {
|
|
1830
1846
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1896,25 +1912,25 @@ ${jt}
|
|
|
1896
1912
|
}
|
|
1897
1913
|
}
|
|
1898
1914
|
}
|
|
1899
|
-
`,
|
|
1900
|
-
let n =
|
|
1915
|
+
`, Lt = (e, t) => new Date(e).toLocaleTimeString(t), Rt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : _t(Math.max(0, e)), zt = (e) => e.reduce((e, t) => e + t.count, 0), Bt = (e) => e.map((e, t) => {
|
|
1916
|
+
let n = Rt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1901
1917
|
return [
|
|
1902
1918
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1903
1919
|
e.message,
|
|
1904
1920
|
e.detail
|
|
1905
1921
|
].filter(Boolean).join("\n");
|
|
1906
|
-
}).join("\n\n"),
|
|
1907
|
-
let e = X((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } =
|
|
1922
|
+
}).join("\n\n"), Vt = () => {
|
|
1923
|
+
let e = X((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } = Ft(), [s, c] = T(!1);
|
|
1908
1924
|
if (e.length === 0) return null;
|
|
1909
1925
|
let l = () => {
|
|
1910
|
-
navigator.clipboard?.writeText(
|
|
1926
|
+
navigator.clipboard?.writeText(Bt(e)).then(() => {
|
|
1911
1927
|
c(!0), setTimeout(() => c(!1), 2e3);
|
|
1912
1928
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1913
|
-
}, u = t(a.errors, { count:
|
|
1929
|
+
}, u = t(a.errors, { count: zt(e) });
|
|
1914
1930
|
return /* @__PURE__ */ L("div", {
|
|
1915
|
-
css:
|
|
1931
|
+
css: It,
|
|
1916
1932
|
ref: o,
|
|
1917
|
-
children: [/* @__PURE__ */ I(
|
|
1933
|
+
children: [/* @__PURE__ */ I(wt, {
|
|
1918
1934
|
id: "errors",
|
|
1919
1935
|
disabled: r,
|
|
1920
1936
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -1944,10 +1960,10 @@ ${jt}
|
|
|
1944
1960
|
className: "when",
|
|
1945
1961
|
children: [
|
|
1946
1962
|
e.count > 1 ? t(a.errorSpan, {
|
|
1947
|
-
start:
|
|
1948
|
-
end:
|
|
1949
|
-
}) :
|
|
1950
|
-
|
|
1963
|
+
start: Lt(e.at, n),
|
|
1964
|
+
end: Lt(e.lastAt, n)
|
|
1965
|
+
}) : Lt(e.at, n),
|
|
1966
|
+
Rt(e.atMediaTime) ? ` ${t(a.errorAt, { time: Rt(e.atMediaTime) })}` : "",
|
|
1951
1967
|
e.recovered ? ` ${t(a.recovered)}` : "",
|
|
1952
1968
|
e.count > 1 ? /* @__PURE__ */ I("span", {
|
|
1953
1969
|
className: "count",
|
|
@@ -1967,7 +1983,7 @@ ${jt}
|
|
|
1967
1983
|
}, `${e.at}-${r}`))]
|
|
1968
1984
|
})]
|
|
1969
1985
|
});
|
|
1970
|
-
},
|
|
1986
|
+
}, Ht = D`
|
|
1971
1987
|
display: flex;
|
|
1972
1988
|
align-items: center;
|
|
1973
1989
|
justify-content: center;
|
|
@@ -2020,8 +2036,8 @@ width: 100%;
|
|
|
2020
2036
|
}
|
|
2021
2037
|
}
|
|
2022
2038
|
}
|
|
2023
|
-
`,
|
|
2024
|
-
let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = w(null), o = w(null), s = .25, c = 2.75, l = (e, t = .05) => Math.round(e / t) * t, u = l(r || 1), d = (e) => (e - s) / c * 100, f = (e) => l(s + e * c), { handlers: p } =
|
|
2039
|
+
`, Ut = () => {
|
|
2040
|
+
let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = w(null), o = w(null), s = .25, c = 2.75, l = (e, t = .05) => Math.round(e / t) * t, u = l(r || 1), d = (e) => (e - s) / c * 100, f = (e) => l(s + e * c), { handlers: p } = Tt({
|
|
2025
2041
|
ref: o,
|
|
2026
2042
|
onChange: (t) => e.setPlaybackRate(f(t))
|
|
2027
2043
|
}), m = (t) => {
|
|
@@ -2037,7 +2053,7 @@ width: 100%;
|
|
|
2037
2053
|
}, [r]);
|
|
2038
2054
|
let h = d(u);
|
|
2039
2055
|
return /* @__PURE__ */ L("div", {
|
|
2040
|
-
css:
|
|
2056
|
+
css: Ht,
|
|
2041
2057
|
children: [/* @__PURE__ */ I("div", { children: t(a.speed, { rate: n(u, {
|
|
2042
2058
|
minimumFractionDigits: 2,
|
|
2043
2059
|
maximumFractionDigits: 2
|
|
@@ -2058,7 +2074,7 @@ width: 100%;
|
|
|
2058
2074
|
})
|
|
2059
2075
|
})]
|
|
2060
2076
|
});
|
|
2061
|
-
},
|
|
2077
|
+
}, Wt = D`
|
|
2062
2078
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
2063
2079
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
2064
2080
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -2076,7 +2092,7 @@ position: static;
|
|
|
2076
2092
|
}
|
|
2077
2093
|
}
|
|
2078
2094
|
|
|
2079
|
-
${
|
|
2095
|
+
${Nt}
|
|
2080
2096
|
|
|
2081
2097
|
.switch {
|
|
2082
2098
|
position: relative;
|
|
@@ -2153,13 +2169,13 @@ ${jt}
|
|
|
2153
2169
|
}
|
|
2154
2170
|
}
|
|
2155
2171
|
|
|
2156
|
-
`,
|
|
2172
|
+
`, Gt = [
|
|
2157
2173
|
.5,
|
|
2158
2174
|
1,
|
|
2159
2175
|
1.5,
|
|
2160
2176
|
2
|
|
2161
|
-
],
|
|
2162
|
-
let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = X((e) => e.audioTracks), o = X((e) => e.selectedAudioTrack), s = X((e) => e.selectAudioTrack), c = X((e) => e.quality), l = X((e) => e.volumeNormalizer), u = X((e) => e.autoplayNext), [d, f] = T(0), { open: p, toggle: m, containerRef: h, pending: g, failed: _, runSelect: v } =
|
|
2177
|
+
], Kt = () => {
|
|
2178
|
+
let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = X((e) => e.audioTracks), o = X((e) => e.selectedAudioTrack), s = X((e) => e.selectAudioTrack), c = X((e) => e.quality), l = X((e) => e.volumeNormalizer), u = X((e) => e.autoplayNext), [d, f] = T(0), { open: p, toggle: m, containerRef: h, pending: g, failed: _, runSelect: v } = Ft({ onReset: () => f(0) }), y = (t) => {
|
|
2163
2179
|
e.setPlaybackRate(t), f(0);
|
|
2164
2180
|
}, b = (e) => {
|
|
2165
2181
|
e !== void 0 && v(e, () => s(e));
|
|
@@ -2169,10 +2185,10 @@ ${jt}
|
|
|
2169
2185
|
f(e);
|
|
2170
2186
|
};
|
|
2171
2187
|
return /* @__PURE__ */ L("div", {
|
|
2172
|
-
css:
|
|
2188
|
+
css: Wt,
|
|
2173
2189
|
ref: h,
|
|
2174
2190
|
children: [
|
|
2175
|
-
/* @__PURE__ */ I(
|
|
2191
|
+
/* @__PURE__ */ I(wt, {
|
|
2176
2192
|
id: "settings",
|
|
2177
2193
|
disabled: p,
|
|
2178
2194
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -2240,18 +2256,18 @@ ${jt}
|
|
|
2240
2256
|
}),
|
|
2241
2257
|
/* @__PURE__ */ I("div", {
|
|
2242
2258
|
className: "slider no-hover",
|
|
2243
|
-
children: /* @__PURE__ */ I(
|
|
2259
|
+
children: /* @__PURE__ */ I(Ut, {})
|
|
2244
2260
|
}),
|
|
2245
2261
|
/* @__PURE__ */ I("div", {
|
|
2246
2262
|
className: "options no-hover",
|
|
2247
|
-
children:
|
|
2263
|
+
children: Gt.map((e) => /* @__PURE__ */ I("div", {
|
|
2248
2264
|
onClick: () => y(e),
|
|
2249
2265
|
children: t(a.speed, { rate: n(e) })
|
|
2250
2266
|
}, e))
|
|
2251
2267
|
})
|
|
2252
2268
|
]
|
|
2253
2269
|
}),
|
|
2254
|
-
p && d === 2 && /* @__PURE__ */ I(
|
|
2270
|
+
p && d === 2 && /* @__PURE__ */ I(Pt, {
|
|
2255
2271
|
title: t(a.audio),
|
|
2256
2272
|
tracks: i,
|
|
2257
2273
|
selected: o,
|
|
@@ -2260,7 +2276,7 @@ ${jt}
|
|
|
2260
2276
|
pending: g,
|
|
2261
2277
|
failed: _
|
|
2262
2278
|
}),
|
|
2263
|
-
p && d === 3 && c && /* @__PURE__ */ I(
|
|
2279
|
+
p && d === 3 && c && /* @__PURE__ */ I(Pt, {
|
|
2264
2280
|
title: t(a.quality),
|
|
2265
2281
|
tracks: c.options,
|
|
2266
2282
|
selected: c.selectedId ?? void 0,
|
|
@@ -2272,7 +2288,7 @@ ${jt}
|
|
|
2272
2288
|
})
|
|
2273
2289
|
]
|
|
2274
2290
|
});
|
|
2275
|
-
},
|
|
2291
|
+
}, qt = D`
|
|
2276
2292
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2277
2293
|
which is the width of the player box, so it can be clamped to it. */
|
|
2278
2294
|
position: static;
|
|
@@ -2288,15 +2304,15 @@ position: static;
|
|
|
2288
2304
|
}
|
|
2289
2305
|
}
|
|
2290
2306
|
|
|
2291
|
-
${
|
|
2292
|
-
`,
|
|
2293
|
-
let { format: e } = Q(), t = X((e) => e.subtitleTracks), n = X((e) => e.selectedSubtitleTrack), r = X((e) => e.selectSubtitleTrack), i = X((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } =
|
|
2307
|
+
${Nt}
|
|
2308
|
+
`, Jt = () => {
|
|
2309
|
+
let { format: e } = Q(), t = X((e) => e.subtitleTracks), n = X((e) => e.selectedSubtitleTrack), r = X((e) => e.selectSubtitleTrack), i = X((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } = Ft();
|
|
2294
2310
|
if (t.length === 0) return null;
|
|
2295
2311
|
let f = n !== void 0;
|
|
2296
2312
|
return /* @__PURE__ */ L("div", {
|
|
2297
|
-
css:
|
|
2313
|
+
css: qt,
|
|
2298
2314
|
ref: c,
|
|
2299
|
-
children: [/* @__PURE__ */ I(
|
|
2315
|
+
children: [/* @__PURE__ */ I(wt, {
|
|
2300
2316
|
id: "subtitles",
|
|
2301
2317
|
disabled: o,
|
|
2302
2318
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -2309,7 +2325,7 @@ ${jt}
|
|
|
2309
2325
|
children: f ? /* @__PURE__ */ I(z, { className: "captions" }) : /* @__PURE__ */ I(B, { className: "captions-off" })
|
|
2310
2326
|
}),
|
|
2311
2327
|
toolTipText: /* @__PURE__ */ I("span", { children: e(a.subtitles) })
|
|
2312
|
-
}), o && /* @__PURE__ */ I(
|
|
2328
|
+
}), o && /* @__PURE__ */ I(Pt, {
|
|
2313
2329
|
title: e(a.subtitles),
|
|
2314
2330
|
tracks: t,
|
|
2315
2331
|
selected: n,
|
|
@@ -2319,13 +2335,13 @@ ${jt}
|
|
|
2319
2335
|
failed: u
|
|
2320
2336
|
})]
|
|
2321
2337
|
});
|
|
2322
|
-
},
|
|
2338
|
+
}, Yt = {
|
|
2323
2339
|
primary: "#EAEBEE",
|
|
2324
2340
|
secondary: "#D0D0D9",
|
|
2325
2341
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2326
2342
|
borderPrimary: "#384F70",
|
|
2327
2343
|
backgroundTooltip: "#222222"
|
|
2328
|
-
},
|
|
2344
|
+
}, Xt = D`
|
|
2329
2345
|
display: flex;
|
|
2330
2346
|
align-items: center;
|
|
2331
2347
|
|
|
@@ -2368,8 +2384,8 @@ ${jt}
|
|
|
2368
2384
|
width: 10px;
|
|
2369
2385
|
height: 10px;
|
|
2370
2386
|
}
|
|
2371
|
-
`,
|
|
2372
|
-
let { number: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), a = w(null), o = w(null), { handlers: s } =
|
|
2387
|
+
`, Zt = ({ value: e, onChange: t }) => {
|
|
2388
|
+
let { number: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), a = w(null), o = w(null), { handlers: s } = Tt({
|
|
2373
2389
|
ref: o,
|
|
2374
2390
|
onChange: t
|
|
2375
2391
|
}), c = (n) => {
|
|
@@ -2383,12 +2399,12 @@ ${jt}
|
|
|
2383
2399
|
e && e.removeEventListener("wheel", c);
|
|
2384
2400
|
};
|
|
2385
2401
|
}, [e]);
|
|
2386
|
-
let l = e * 100, u = C(() => Math.round(i ? 0 :
|
|
2387
|
-
return /* @__PURE__ */ I(
|
|
2402
|
+
let l = e * 100, u = C(() => Math.round(i ? 0 : gt(r) * 100), [r, i]);
|
|
2403
|
+
return /* @__PURE__ */ I(wt, {
|
|
2388
2404
|
id: "volume-slider",
|
|
2389
2405
|
text: /* @__PURE__ */ I("div", {
|
|
2390
2406
|
ref: a,
|
|
2391
|
-
css:
|
|
2407
|
+
css: Xt,
|
|
2392
2408
|
...s,
|
|
2393
2409
|
children: /* @__PURE__ */ I("div", {
|
|
2394
2410
|
ref: o,
|
|
@@ -2407,7 +2423,7 @@ ${jt}
|
|
|
2407
2423
|
children: n(u / 100, { style: "percent" })
|
|
2408
2424
|
})
|
|
2409
2425
|
});
|
|
2410
|
-
},
|
|
2426
|
+
}, Qt = D`
|
|
2411
2427
|
position: relative;
|
|
2412
2428
|
display: flex;
|
|
2413
2429
|
align-items: center;
|
|
@@ -2470,11 +2486,11 @@ ${jt}
|
|
|
2470
2486
|
}
|
|
2471
2487
|
}
|
|
2472
2488
|
|
|
2473
|
-
`,
|
|
2474
|
-
let t = X(), { format: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), o = C(() =>
|
|
2489
|
+
`, $t = ({ ref: e }) => {
|
|
2490
|
+
let t = X(), { format: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), o = C(() => gt(r), [r]);
|
|
2475
2491
|
return /* @__PURE__ */ L("div", {
|
|
2476
|
-
css:
|
|
2477
|
-
children: [/* @__PURE__ */ I(
|
|
2492
|
+
css: Qt,
|
|
2493
|
+
children: [/* @__PURE__ */ I(wt, {
|
|
2478
2494
|
id: "sound",
|
|
2479
2495
|
text: /* @__PURE__ */ I("button", {
|
|
2480
2496
|
className: "sound",
|
|
@@ -2493,16 +2509,16 @@ ${jt}
|
|
|
2493
2509
|
className: "volume-slider-container",
|
|
2494
2510
|
children: /* @__PURE__ */ I("div", {
|
|
2495
2511
|
className: "volume-slider-background",
|
|
2496
|
-
children: /* @__PURE__ */ I(
|
|
2512
|
+
children: /* @__PURE__ */ I(Zt, {
|
|
2497
2513
|
value: i ? 0 : o,
|
|
2498
2514
|
onChange: (e) => {
|
|
2499
|
-
t.setVolume(
|
|
2515
|
+
t.setVolume(ht(e));
|
|
2500
2516
|
}
|
|
2501
2517
|
})
|
|
2502
2518
|
})
|
|
2503
2519
|
})]
|
|
2504
2520
|
});
|
|
2505
|
-
},
|
|
2521
|
+
}, en = .05, tn = 5, nn = 50, rn = 1e3, an = D`
|
|
2506
2522
|
position: absolute;
|
|
2507
2523
|
bottom: 0;
|
|
2508
2524
|
width: 100%;
|
|
@@ -2594,7 +2610,7 @@ ${jt}
|
|
|
2594
2610
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2595
2611
|
of its own and so is never :hover */
|
|
2596
2612
|
:hover, &.armed {
|
|
2597
|
-
background-color: ${
|
|
2613
|
+
background-color: ${Yt.hover};
|
|
2598
2614
|
}
|
|
2599
2615
|
|
|
2600
2616
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2632,12 +2648,12 @@ ${jt}
|
|
|
2632
2648
|
}
|
|
2633
2649
|
}
|
|
2634
2650
|
}
|
|
2635
|
-
`,
|
|
2651
|
+
`, on = ({ shortcuts: e = "window", root: t, fullscreen: n }) => {
|
|
2636
2652
|
let r = X(), { format: i } = Q(), o = X((e) => e.paused), s = X((e) => e.currentTime), c = X((e) => e.duration), l = X((e) => e.seekingTo), u = X((e) => e.fullscreen), d = n ? n.active : u, f = w(n);
|
|
2637
2653
|
f.current = n;
|
|
2638
2654
|
let p = X((e) => e.hideUI), m = X((e) => e.togglePictureInPicture), h = X((e) => e.pictureInPictureMode), g = X((e) => e.burnedInSubtitles), _ = X((e) => e.passThroughPictureInPicture), v = X((e) => e.subtitleTracks), y = X((e) => e.requestSeek), x = X((e) => e.stepFrame), [C, E] = T(null), D = w(null), O = w(void 0), k = h === "burn-in", A = v.length > 0, j = c > 0 && s === c, M = b(({ direction: e, stepSize: t }) => {
|
|
2639
|
-
let n =
|
|
2640
|
-
r.setVolume(
|
|
2655
|
+
let n = gt(r.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + i)), o = r.muted;
|
|
2656
|
+
r.setVolume(ht(a)), o && !r.muted && r.toggleMuted();
|
|
2641
2657
|
}, [r]), N = w(!1), P = b(() => {
|
|
2642
2658
|
f.current ? f.current.request() : r.toggleFullscreen();
|
|
2643
2659
|
}, [r]);
|
|
@@ -2656,16 +2672,16 @@ ${jt}
|
|
|
2656
2672
|
else if (a.key === "m") r.toggleMuted();
|
|
2657
2673
|
else if (a.key === "ArrowUp") M({
|
|
2658
2674
|
direction: "up",
|
|
2659
|
-
stepSize:
|
|
2675
|
+
stepSize: en
|
|
2660
2676
|
});
|
|
2661
2677
|
else if (a.key === "ArrowDown") M({
|
|
2662
2678
|
direction: "down",
|
|
2663
|
-
stepSize:
|
|
2679
|
+
stepSize: en
|
|
2664
2680
|
});
|
|
2665
2681
|
else if (a.key === "ArrowRight") {
|
|
2666
2682
|
if (!r.duration) return;
|
|
2667
|
-
n(Math.min(r.currentTime +
|
|
2668
|
-
} else a.key === "ArrowLeft" ? n(Math.max(r.currentTime -
|
|
2683
|
+
n(Math.min(r.currentTime + tn, r.duration));
|
|
2684
|
+
} else a.key === "ArrowLeft" ? n(Math.max(r.currentTime - tn, 0)) : (a.key === "<" || a.key === ">") && x ? x(a.key === ">" ? 1 : -1) : l = !1;
|
|
2669
2685
|
l && a.preventDefault();
|
|
2670
2686
|
};
|
|
2671
2687
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2683,10 +2699,10 @@ ${jt}
|
|
|
2683
2699
|
let F = b((e) => {
|
|
2684
2700
|
e.preventDefault(), e.deltaY < 0 ? M({
|
|
2685
2701
|
direction: "up",
|
|
2686
|
-
stepSize:
|
|
2702
|
+
stepSize: en
|
|
2687
2703
|
}) : M({
|
|
2688
2704
|
direction: "down",
|
|
2689
|
-
stepSize:
|
|
2705
|
+
stepSize: en
|
|
2690
2706
|
});
|
|
2691
2707
|
}, [M]);
|
|
2692
2708
|
S(() => {
|
|
@@ -2712,23 +2728,23 @@ ${jt}
|
|
|
2712
2728
|
}
|
|
2713
2729
|
let n = D.current, r = document.activeElement;
|
|
2714
2730
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2715
|
-
},
|
|
2731
|
+
}, nn);
|
|
2716
2732
|
return O.current = t, () => {
|
|
2717
|
-
e = Date.now() +
|
|
2733
|
+
e = Date.now() + rn;
|
|
2718
2734
|
};
|
|
2719
2735
|
}, [z]), S(() => () => clearInterval(O.current), []), /* @__PURE__ */ L("div", {
|
|
2720
2736
|
className: "control-bar",
|
|
2721
|
-
css:
|
|
2737
|
+
css: an,
|
|
2722
2738
|
style: { ...p ? {
|
|
2723
2739
|
opacity: "0",
|
|
2724
2740
|
pointerEvents: "none"
|
|
2725
2741
|
} : z ? { pointerEvents: "none" } : {} },
|
|
2726
|
-
children: [/* @__PURE__ */ I(
|
|
2742
|
+
children: [/* @__PURE__ */ I(Ot, {}), /* @__PURE__ */ L("div", {
|
|
2727
2743
|
className: "actions",
|
|
2728
2744
|
children: [/* @__PURE__ */ L("div", {
|
|
2729
2745
|
className: "left",
|
|
2730
2746
|
children: [
|
|
2731
|
-
/* @__PURE__ */ I(
|
|
2747
|
+
/* @__PURE__ */ I(wt, {
|
|
2732
2748
|
id: "play",
|
|
2733
2749
|
tooltipPlace: "top-start",
|
|
2734
2750
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -2740,19 +2756,19 @@ ${jt}
|
|
|
2740
2756
|
}),
|
|
2741
2757
|
toolTipText: /* @__PURE__ */ I("span", { children: i(j ? a.replayKey : o ? a.playKey : a.pauseKey) })
|
|
2742
2758
|
}),
|
|
2743
|
-
/* @__PURE__ */ I(
|
|
2759
|
+
/* @__PURE__ */ I($t, { ref: E }),
|
|
2744
2760
|
/* @__PURE__ */ I("div", {
|
|
2745
2761
|
className: "time",
|
|
2746
|
-
children:
|
|
2762
|
+
children: vt(l ?? s, c)
|
|
2747
2763
|
})
|
|
2748
2764
|
]
|
|
2749
2765
|
}), /* @__PURE__ */ L("div", {
|
|
2750
2766
|
className: "right",
|
|
2751
2767
|
children: [
|
|
2752
|
-
/* @__PURE__ */ I(
|
|
2768
|
+
/* @__PURE__ */ I(Vt, {}),
|
|
2769
|
+
/* @__PURE__ */ I(Jt, {}),
|
|
2753
2770
|
/* @__PURE__ */ I(Kt, {}),
|
|
2754
|
-
/* @__PURE__ */ I(
|
|
2755
|
-
_ ? /* @__PURE__ */ I(St, {
|
|
2771
|
+
_ ? /* @__PURE__ */ I(wt, {
|
|
2756
2772
|
id: "picture-in-picture",
|
|
2757
2773
|
tooltipPlace: "top-end",
|
|
2758
2774
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -2765,12 +2781,12 @@ ${jt}
|
|
|
2765
2781
|
"aria-label": i(a.pictureInPicture),
|
|
2766
2782
|
"aria-pressed": _.active,
|
|
2767
2783
|
children: /* @__PURE__ */ I("img", {
|
|
2768
|
-
src:
|
|
2784
|
+
src: kt,
|
|
2769
2785
|
alt: ""
|
|
2770
2786
|
})
|
|
2771
2787
|
}),
|
|
2772
2788
|
toolTipText: /* @__PURE__ */ I("span", { children: i(_.active ? a.exitPictureInPicture : a.pictureInPicture) })
|
|
2773
|
-
}) : m ? /* @__PURE__ */ I(
|
|
2789
|
+
}) : m ? /* @__PURE__ */ I(wt, {
|
|
2774
2790
|
id: "picture-in-picture",
|
|
2775
2791
|
tooltipPlace: "top-end",
|
|
2776
2792
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -2780,14 +2796,14 @@ ${jt}
|
|
|
2780
2796
|
disabled: k && !A,
|
|
2781
2797
|
"aria-label": i(k ? a.burnIn : a.pictureInPicture),
|
|
2782
2798
|
"aria-pressed": k ? g : void 0,
|
|
2783
|
-
children: k ? I(g ?
|
|
2784
|
-
src:
|
|
2799
|
+
children: k ? I(g ? jt : Mt, {}) : /* @__PURE__ */ I("img", {
|
|
2800
|
+
src: kt,
|
|
2785
2801
|
alt: ""
|
|
2786
2802
|
})
|
|
2787
2803
|
}),
|
|
2788
2804
|
toolTipText: /* @__PURE__ */ I("span", { children: i(k ? A ? g ? a.burnedIn : a.burnInOffer : a.noSubtitles : a.pictureInPicture) })
|
|
2789
2805
|
}) : null,
|
|
2790
|
-
/* @__PURE__ */ I(
|
|
2806
|
+
/* @__PURE__ */ I(wt, {
|
|
2791
2807
|
id: "full-screen",
|
|
2792
2808
|
tooltipPlace: "top-end",
|
|
2793
2809
|
text: /* @__PURE__ */ I("button", {
|
|
@@ -2804,7 +2820,7 @@ ${jt}
|
|
|
2804
2820
|
})]
|
|
2805
2821
|
})]
|
|
2806
2822
|
});
|
|
2807
|
-
},
|
|
2823
|
+
}, sn = 9e3, cn = D`
|
|
2808
2824
|
position: absolute;
|
|
2809
2825
|
inset: 0;
|
|
2810
2826
|
z-index: 2;
|
|
@@ -2847,7 +2863,7 @@ ${jt}
|
|
|
2847
2863
|
line-height: 1;
|
|
2848
2864
|
color: #fff;
|
|
2849
2865
|
}
|
|
2850
|
-
`,
|
|
2866
|
+
`, ln = () => {
|
|
2851
2867
|
let { format: e } = Q(), t = X((e) => e.burnedInSubtitles), n = X((e) => e.pictureInPictureMode), [r, i] = T(!1);
|
|
2852
2868
|
return S(() => {
|
|
2853
2869
|
if (n !== "burn-in" || !t) {
|
|
@@ -2855,10 +2871,10 @@ ${jt}
|
|
|
2855
2871
|
return;
|
|
2856
2872
|
}
|
|
2857
2873
|
i(!0);
|
|
2858
|
-
let e = setTimeout(() => i(!1),
|
|
2874
|
+
let e = setTimeout(() => i(!1), sn);
|
|
2859
2875
|
return () => clearTimeout(e);
|
|
2860
2876
|
}, [n, t]), n !== "burn-in" || !t ? null : /* @__PURE__ */ I("div", {
|
|
2861
|
-
css:
|
|
2877
|
+
css: cn,
|
|
2862
2878
|
className: r ? "show" : "",
|
|
2863
2879
|
role: "status",
|
|
2864
2880
|
children: /* @__PURE__ */ L("div", {
|
|
@@ -2873,10 +2889,10 @@ ${jt}
|
|
|
2873
2889
|
})]
|
|
2874
2890
|
})
|
|
2875
2891
|
});
|
|
2876
|
-
},
|
|
2892
|
+
}, un = 1, dn = 6e3, fn = 1, pn = {
|
|
2877
2893
|
opening: a.skipOpening,
|
|
2878
2894
|
ending: a.skipEnding
|
|
2879
|
-
},
|
|
2895
|
+
}, mn = D`
|
|
2880
2896
|
position: absolute;
|
|
2881
2897
|
inset: 0;
|
|
2882
2898
|
z-index: 2;
|
|
@@ -2927,13 +2943,13 @@ ${jt}
|
|
|
2927
2943
|
bottom: calc(9 * var(--mp-unit));
|
|
2928
2944
|
}
|
|
2929
2945
|
}
|
|
2930
|
-
`,
|
|
2946
|
+
`, hn = ({ endingOffered: e }) => {
|
|
2931
2947
|
let t = X((e) => e.chapters), n = X((e) => e.currentTime), r = X((e) => e.requestSeek), i = X((e) => e.seekPreview), a = X(), { format: o } = Q(), s = C(() => {
|
|
2932
2948
|
let n = h(t), r = e ? -1 : n.lastIndexOf("ending");
|
|
2933
2949
|
return n.map((e, t) => t === r ? void 0 : e);
|
|
2934
2950
|
}, [t, e]), c = C(() => {
|
|
2935
2951
|
if (typeof n != "number") return;
|
|
2936
|
-
let e = t.findIndex((e, t) => s[t] !== void 0 && e.start -
|
|
2952
|
+
let e = t.findIndex((e, t) => s[t] !== void 0 && e.start - un <= n && n < e.end), r = e >= 0 ? s[e] : void 0;
|
|
2937
2953
|
return r ? {
|
|
2938
2954
|
kind: r,
|
|
2939
2955
|
end: t[e].end
|
|
@@ -2945,7 +2961,7 @@ ${jt}
|
|
|
2945
2961
|
]), l = w(0), [u, d] = T(0);
|
|
2946
2962
|
S(() => {
|
|
2947
2963
|
let e = typeof n == "number" ? n : 0, t = l.current;
|
|
2948
|
-
l.current = e, e < t -
|
|
2964
|
+
l.current = e, e < t - fn && d((e) => e + 1);
|
|
2949
2965
|
}, [n]);
|
|
2950
2966
|
let [f, p] = T(!1), m = c ? `${c.kind}@${c.end}` : "";
|
|
2951
2967
|
return S(() => {
|
|
@@ -2954,12 +2970,12 @@ ${jt}
|
|
|
2954
2970
|
return;
|
|
2955
2971
|
}
|
|
2956
2972
|
p(!0);
|
|
2957
|
-
let e = setTimeout(() => p(!1),
|
|
2973
|
+
let e = setTimeout(() => p(!1), dn);
|
|
2958
2974
|
return () => clearTimeout(e);
|
|
2959
2975
|
}, [m, u]), S(() => {
|
|
2960
2976
|
c || p(!1);
|
|
2961
2977
|
}, [c]), c ? /* @__PURE__ */ I("div", {
|
|
2962
|
-
css:
|
|
2978
|
+
css: mn,
|
|
2963
2979
|
className: f && !i ? "show" : "",
|
|
2964
2980
|
children: /* @__PURE__ */ I("button", {
|
|
2965
2981
|
type: "button",
|
|
@@ -2967,10 +2983,10 @@ ${jt}
|
|
|
2967
2983
|
onClick: () => {
|
|
2968
2984
|
p(!1), r ? r(c.end) : a.seek(c.end);
|
|
2969
2985
|
},
|
|
2970
|
-
children: o(
|
|
2986
|
+
children: o(pn[c.kind])
|
|
2971
2987
|
})
|
|
2972
2988
|
}) : null;
|
|
2973
|
-
},
|
|
2989
|
+
}, gn = 3e3, _n = D`
|
|
2974
2990
|
position: absolute;
|
|
2975
2991
|
inset: 0;
|
|
2976
2992
|
z-index: 2;
|
|
@@ -2981,10 +2997,10 @@ ${jt}
|
|
|
2981
2997
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2982
2998
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2983
2999
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2984
|
-
`,
|
|
3000
|
+
`, vn = (e, t) => {
|
|
2985
3001
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2986
3002
|
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')`;
|
|
2987
|
-
},
|
|
3003
|
+
}, yn = D`
|
|
2988
3004
|
position: relative;
|
|
2989
3005
|
background-color: black;
|
|
2990
3006
|
display: flex;
|
|
@@ -3041,13 +3057,13 @@ ${jt}
|
|
|
3041
3057
|
&.hide {
|
|
3042
3058
|
cursor: none;
|
|
3043
3059
|
}
|
|
3044
|
-
`,
|
|
3060
|
+
`, bn = (e, t = "") => g.toArray(e).flatMap((e, n) => {
|
|
3045
3061
|
let r = `${t}${y(e) && e.key != null ? e.key : n}`;
|
|
3046
|
-
return y(e) && e.type === _ ?
|
|
3062
|
+
return y(e) && e.type === _ ? bn(e.props.children, `${r}/`) : [{
|
|
3047
3063
|
key: r,
|
|
3048
3064
|
item: e
|
|
3049
3065
|
}];
|
|
3050
|
-
}),
|
|
3066
|
+
}), xn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, children: c }) => {
|
|
3051
3067
|
let l = X(), u = X((e) => e.hideUI), d = X((e) => e.setHideUI), f = X((e) => e.hasMedia), p = X((e) => e.passThroughPictureInPicture), m = w(void 0), h = w("mouse"), g = w({
|
|
3052
3068
|
x: -1,
|
|
3053
3069
|
y: -1
|
|
@@ -3073,12 +3089,12 @@ ${jt}
|
|
|
3073
3089
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3074
3090
|
}, C = () => {
|
|
3075
3091
|
if (x()) {
|
|
3076
|
-
m.current = setTimeout(C,
|
|
3092
|
+
m.current = setTimeout(C, gn);
|
|
3077
3093
|
return;
|
|
3078
3094
|
}
|
|
3079
3095
|
y();
|
|
3080
3096
|
}, T = () => {
|
|
3081
|
-
d(!1), clearTimeout(m.current), m.current = setTimeout(C,
|
|
3097
|
+
d(!1), clearTimeout(m.current), m.current = setTimeout(C, gn);
|
|
3082
3098
|
}, E = (e) => {
|
|
3083
3099
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
3084
3100
|
x: e.clientX,
|
|
@@ -3090,7 +3106,7 @@ ${jt}
|
|
|
3090
3106
|
_.current = !1;
|
|
3091
3107
|
}, k = w(!0);
|
|
3092
3108
|
return /* @__PURE__ */ L("div", {
|
|
3093
|
-
css:
|
|
3109
|
+
css: yn,
|
|
3094
3110
|
ref: b,
|
|
3095
3111
|
onPointerMove: E,
|
|
3096
3112
|
onPointerDown: D,
|
|
@@ -3105,9 +3121,9 @@ ${jt}
|
|
|
3105
3121
|
className: u ? "hide" : "",
|
|
3106
3122
|
tabIndex: a === "player" ? -1 : void 0,
|
|
3107
3123
|
children: [
|
|
3108
|
-
/* @__PURE__ */ I(
|
|
3109
|
-
|
|
3110
|
-
css:
|
|
3124
|
+
/* @__PURE__ */ I(ft, { onSubtitleRef: n }),
|
|
3125
|
+
bn(r).map(({ key: e, item: t }) => /* @__PURE__ */ I("div", {
|
|
3126
|
+
css: _n,
|
|
3111
3127
|
style: { ...u ? {
|
|
3112
3128
|
opacity: "0",
|
|
3113
3129
|
visibility: "hidden",
|
|
@@ -3115,19 +3131,19 @@ ${jt}
|
|
|
3115
3131
|
} : {} },
|
|
3116
3132
|
children: t
|
|
3117
3133
|
}, e)),
|
|
3118
|
-
i === !1 ? null : /* @__PURE__ */ I(
|
|
3134
|
+
i === !1 ? null : /* @__PURE__ */ I(Ct, {
|
|
3119
3135
|
value: !!o,
|
|
3120
|
-
children: /* @__PURE__ */ I(
|
|
3136
|
+
children: /* @__PURE__ */ I(on, {
|
|
3121
3137
|
shortcuts: a,
|
|
3122
3138
|
root: v,
|
|
3123
3139
|
fullscreen: o
|
|
3124
3140
|
})
|
|
3125
3141
|
}),
|
|
3126
|
-
/* @__PURE__ */ I(
|
|
3127
|
-
/* @__PURE__ */ I(
|
|
3142
|
+
/* @__PURE__ */ I(ln, {}),
|
|
3143
|
+
/* @__PURE__ */ I(hn, { endingOffered: s }),
|
|
3128
3144
|
p?.armed && v.current ? /* @__PURE__ */ I("div", {
|
|
3129
3145
|
className: "pass-through",
|
|
3130
|
-
style: { clipPath:
|
|
3146
|
+
style: { clipPath: vn(p.armed, v.current.getBoundingClientRect()) },
|
|
3131
3147
|
onPointerOver: p.disarm
|
|
3132
3148
|
}) : null,
|
|
3133
3149
|
/* @__PURE__ */ L("div", {
|
|
@@ -3150,7 +3166,7 @@ ${jt}
|
|
|
3150
3166
|
})
|
|
3151
3167
|
]
|
|
3152
3168
|
});
|
|
3153
|
-
},
|
|
3169
|
+
}, Sn = (e, t) => ({ title: e.options.find((e) => e.id === t)?.label }), Cn = (e, t) => e instanceof Promise ? e.then(t) : t(), wn = ({ options: e, children: t }) => {
|
|
3154
3170
|
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: f, thumbnailRead: p, thumbnailsEnabled: m, readsDownload: h } = r ?? {}, g = j(), _ = A(), [v, y] = T(null), [b, x] = T(null), E = n?.media ?? v;
|
|
3155
3171
|
S(() => (g?.(E), () => g?.(null)), [E, g]), Pe(E, n?.stepFrame);
|
|
3156
3172
|
let { expose: D } = e, [O, k] = T(null), [M, N] = T(!0), [P, F] = T(null), [L, R] = T(e.autoplayNext), [z] = T(() => Object.assign(new EventTarget(), {
|
|
@@ -3198,7 +3214,7 @@ ${jt}
|
|
|
3198
3214
|
let G = e.fullscreen ?? (O === null ? void 0 : {
|
|
3199
3215
|
active: O,
|
|
3200
3216
|
request: () => z.dispatchEvent(new Event("fullscreenrequest"))
|
|
3201
|
-
}), K = C(() =>
|
|
3217
|
+
}), K = C(() => rt(), [o]);
|
|
3202
3218
|
Ae(v, b, r, h ? K.push : void 0);
|
|
3203
3219
|
let ie = r?.normalizeVolume ?? !0, [q, J] = T(ie);
|
|
3204
3220
|
S(() => {
|
|
@@ -3208,7 +3224,7 @@ ${jt}
|
|
|
3208
3224
|
ae.current = r?.onNormalizeVolumeChange;
|
|
3209
3225
|
let oe = r?.normalizerWorkletUrl, se = w(p ?? f);
|
|
3210
3226
|
se.current = p ?? f;
|
|
3211
|
-
let Y = X((e) => e.selectedAudioTrack), ce = !!f, { refused: le } =
|
|
3227
|
+
let Y = X((e) => e.selectedAudioTrack), ce = !!f, { refused: le } = nt(v, oe, q, C(() => ce && o && c && l && typeof Y == "number" && Y >= 0 ? h ? {
|
|
3212
3228
|
tap: K,
|
|
3213
3229
|
audioStreamIndex: Y
|
|
3214
3230
|
} : {
|
|
@@ -3235,13 +3251,13 @@ ${jt}
|
|
|
3235
3251
|
oe,
|
|
3236
3252
|
q,
|
|
3237
3253
|
le
|
|
3238
|
-
]), { thumbnails: de, requestThumbnail: fe } =
|
|
3254
|
+
]), { thumbnails: de, requestThumbnail: fe } = ze({
|
|
3239
3255
|
publicPath: c,
|
|
3240
3256
|
workerUrl: l,
|
|
3241
3257
|
length: m === !1 ? void 0 : o,
|
|
3242
3258
|
read: p ?? f,
|
|
3243
3259
|
downloadedRanges: s
|
|
3244
|
-
}), pe = n?.thumbnails?.all ?? de, { toggle: me, mode: he, burnedIn: ge } =
|
|
3260
|
+
}), pe = n?.thumbnails?.all ?? de, { toggle: me, mode: he, burnedIn: ge } = Be(v, b), _e = Ke(n?.media ?? null, n?.pictureInPicture), Z = X((e) => e.setSourceState), ve = n ? !!n.media : o !== void 0;
|
|
3245
3261
|
S(() => {
|
|
3246
3262
|
Z({
|
|
3247
3263
|
title: i,
|
|
@@ -3302,11 +3318,11 @@ ${jt}
|
|
|
3302
3318
|
})),
|
|
3303
3319
|
selectedSubtitleTrack: ye.selectedId ?? void 0,
|
|
3304
3320
|
selectSubtitleTrack: (e) => {
|
|
3305
|
-
let t = e == null ? null : String(e), n = t === null ? void 0 :
|
|
3306
|
-
return
|
|
3321
|
+
let t = e == null ? null : String(e), n = t === null ? void 0 : Sn(ye, t), r = ye.selectedId === null;
|
|
3322
|
+
return Cn(ye.select(t), () => {
|
|
3307
3323
|
let e = t === null ? null : u(n) ?? (r ? n?.title : void 0), i = xe.current;
|
|
3308
3324
|
e !== void 0 && i.options.onPreferredSubtitleLanguageChange?.(e);
|
|
3309
|
-
let a = i.audio &&
|
|
3325
|
+
let a = i.audio && Sn(i.audio, i.audio.selectedId ?? "");
|
|
3310
3326
|
e && d(a, e) && i.options.onAlwaysShowSubtitlesChange?.(!0);
|
|
3311
3327
|
});
|
|
3312
3328
|
},
|
|
@@ -3320,8 +3336,8 @@ ${jt}
|
|
|
3320
3336
|
disabled: n
|
|
3321
3337
|
})),
|
|
3322
3338
|
selectedAudioTrack: be.selectedId ?? void 0,
|
|
3323
|
-
selectAudioTrack: (e) =>
|
|
3324
|
-
let t = u(
|
|
3339
|
+
selectAudioTrack: (e) => Cn(be.select(String(e)), () => {
|
|
3340
|
+
let t = u(Sn(be, String(e)));
|
|
3325
3341
|
t !== void 0 && xe.current.options.onPreferredAudioLanguageChange?.(t);
|
|
3326
3342
|
})
|
|
3327
3343
|
});
|
|
@@ -3331,7 +3347,7 @@ ${jt}
|
|
|
3331
3347
|
Z({ quality: Se });
|
|
3332
3348
|
}, [Z, Se]), S(() => {
|
|
3333
3349
|
a && Z({ chapters: a });
|
|
3334
|
-
}, [Z, a]), /* @__PURE__ */ I(
|
|
3350
|
+
}, [Z, a]), /* @__PURE__ */ I(xn, {
|
|
3335
3351
|
ref: _,
|
|
3336
3352
|
onVideoRef: n ? void 0 : y,
|
|
3337
3353
|
onSubtitleRef: x,
|
|
@@ -3342,7 +3358,7 @@ ${jt}
|
|
|
3342
3358
|
endingOffered: M,
|
|
3343
3359
|
children: t
|
|
3344
3360
|
});
|
|
3345
|
-
},
|
|
3361
|
+
}, Tn = D`
|
|
3346
3362
|
/**
|
|
3347
3363
|
* The chrome's whole scale, in one place.
|
|
3348
3364
|
*
|
|
@@ -3412,20 +3428,20 @@ ${jt}
|
|
|
3412
3428
|
height: 100%;
|
|
3413
3429
|
width: 100%;
|
|
3414
3430
|
overflow: hidden;
|
|
3415
|
-
`,
|
|
3416
|
-
css:
|
|
3431
|
+
`, En = (e) => /* @__PURE__ */ I("div", {
|
|
3432
|
+
css: Tn,
|
|
3417
3433
|
children: /* @__PURE__ */ I(ce.Provider, { children: /* @__PURE__ */ I(ye, {
|
|
3418
3434
|
language: e.language,
|
|
3419
|
-
children: /* @__PURE__ */ I(
|
|
3435
|
+
children: /* @__PURE__ */ I(wn, {
|
|
3420
3436
|
options: e,
|
|
3421
3437
|
children: e.children
|
|
3422
3438
|
})
|
|
3423
3439
|
}) })
|
|
3424
|
-
}),
|
|
3440
|
+
}), Dn = (e) => !!e && typeof e == "object" && "at" in e, On = (e) => !!e && typeof e == "object" && "selection" in e, kn = ({ blob: e, name: t }) => ({
|
|
3425
3441
|
length: e.size,
|
|
3426
3442
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3427
3443
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3428
|
-
}),
|
|
3444
|
+
}), An = async (e, t) => {
|
|
3429
3445
|
let n = await fetch(e, {
|
|
3430
3446
|
headers: { Range: "bytes=0-1" },
|
|
3431
3447
|
credentials: t
|
|
@@ -3435,8 +3451,8 @@ ${jt}
|
|
|
3435
3451
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3436
3452
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3437
3453
|
return i;
|
|
3438
|
-
},
|
|
3439
|
-
let i = t ?? await
|
|
3454
|
+
}, jn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3455
|
+
let i = t ?? await An(e, r);
|
|
3440
3456
|
return {
|
|
3441
3457
|
length: i,
|
|
3442
3458
|
name: n,
|
|
@@ -3452,9 +3468,9 @@ ${jt}
|
|
|
3452
3468
|
},
|
|
3453
3469
|
readsDownload: !0
|
|
3454
3470
|
};
|
|
3455
|
-
},
|
|
3456
|
-
if ("blob" in e) return
|
|
3457
|
-
if ("url" in e) return
|
|
3471
|
+
}, Mn = async (e) => {
|
|
3472
|
+
if ("blob" in e) return kn(e);
|
|
3473
|
+
if ("url" in e) return jn(e);
|
|
3458
3474
|
if ("read" in e) return {
|
|
3459
3475
|
length: e.length,
|
|
3460
3476
|
name: e.name,
|
|
@@ -3463,4 +3479,4 @@ ${jt}
|
|
|
3463
3479
|
throw Error(`Unknown source type: ${e}`);
|
|
3464
3480
|
};
|
|
3465
3481
|
//#endregion
|
|
3466
|
-
export {
|
|
3482
|
+
export { En as MediaPlayer, En as default, ce as Player, t as SUBTITLES_OFF, c as createPictureInPicture, l as createSubtitleRenderer, o as createThumbnailGenerator, Mn as inputToRemuxerInput, On as isDelegatedTracks, Dn as isExternalThumbnails, Y as sourceFeature, s as startPlayback, Be as usePictureInPicture, X as usePlayer, ze as useSeekThumbnails };
|