@glitchlab/react-video-player 1.4.0 → 1.4.1
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +106 -104
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import we, { useState as k, useRef as H, useCallback as
|
|
3
|
+
import we, { useState as k, useRef as H, useCallback as P, useEffect as M, useImperativeHandle as Le, useMemo as K } from "react";
|
|
4
4
|
import $ from "hls.js";
|
|
5
5
|
function ae(e) {
|
|
6
6
|
var n, s, r = "";
|
|
@@ -448,12 +448,12 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
|
|
|
448
448
|
);
|
|
449
449
|
function re(e) {
|
|
450
450
|
if (!Number.isFinite(e) || e < 0) return "--:--";
|
|
451
|
-
const n = Math.floor(e), s = Math.floor(n / 3600), r = Math.floor(n % 3600 / 60),
|
|
451
|
+
const n = Math.floor(e), s = Math.floor(n / 3600), r = Math.floor(n % 3600 / 60), c = (n % 60).toString().padStart(2, "0");
|
|
452
452
|
if (s > 0) {
|
|
453
453
|
const u = r.toString().padStart(2, "0");
|
|
454
|
-
return `${s}:${u}:${
|
|
454
|
+
return `${s}:${u}:${c}`;
|
|
455
455
|
}
|
|
456
|
-
return `${r}:${
|
|
456
|
+
return `${r}:${c}`;
|
|
457
457
|
}
|
|
458
458
|
const _e = {
|
|
459
459
|
index: -1
|
|
@@ -491,30 +491,30 @@ const se = (() => {
|
|
|
491
491
|
container: s,
|
|
492
492
|
onTogglePlay: r,
|
|
493
493
|
qualityLevels: l = [],
|
|
494
|
-
currentLevel:
|
|
494
|
+
currentLevel: c = -1,
|
|
495
495
|
selectedLevel: u = -1,
|
|
496
|
-
onSelectLevel:
|
|
496
|
+
onSelectLevel: i
|
|
497
497
|
}) => {
|
|
498
|
-
const [p, d] = k(!0), C = H(null), b =
|
|
498
|
+
const [p, d] = k(!0), C = H(null), b = P(() => {
|
|
499
499
|
C.current !== null && (clearTimeout(C.current), C.current = null);
|
|
500
|
-
}, []), o =
|
|
500
|
+
}, []), o = P(() => {
|
|
501
501
|
b(), n && (C.current = setTimeout(() => d(!1), Ue));
|
|
502
|
-
}, [b, n]), a =
|
|
502
|
+
}, [b, n]), a = P(() => {
|
|
503
503
|
d(!0), o();
|
|
504
504
|
}, [o]);
|
|
505
|
-
return
|
|
505
|
+
return M(() => {
|
|
506
506
|
if (!n) {
|
|
507
507
|
b(), d(!0);
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
510
|
return o(), b;
|
|
511
|
-
}, [n, o, b]),
|
|
511
|
+
}, [n, o, b]), M(() => {
|
|
512
512
|
if (!s) return;
|
|
513
513
|
const m = () => a();
|
|
514
514
|
return s.addEventListener("mousemove", m), s.addEventListener("touchstart", m), s.addEventListener("focusin", m), () => {
|
|
515
515
|
s.removeEventListener("mousemove", m), s.removeEventListener("touchstart", m), s.removeEventListener("focusin", m);
|
|
516
516
|
};
|
|
517
|
-
}, [s, a]),
|
|
517
|
+
}, [s, a]), M(() => {
|
|
518
518
|
if (!s || !e) return;
|
|
519
519
|
const m = (f) => {
|
|
520
520
|
if (!(!s.contains(document.activeElement) || f.target.tagName === "INPUT" && f.key !== " "))
|
|
@@ -568,9 +568,9 @@ const se = (() => {
|
|
|
568
568
|
Ke,
|
|
569
569
|
{
|
|
570
570
|
levels: l,
|
|
571
|
-
currentLevel:
|
|
571
|
+
currentLevel: c,
|
|
572
572
|
selectedLevel: u,
|
|
573
|
-
onSelect:
|
|
573
|
+
onSelect: i
|
|
574
574
|
}
|
|
575
575
|
),
|
|
576
576
|
/* @__PURE__ */ t(Je, { video: e }),
|
|
@@ -582,12 +582,12 @@ const se = (() => {
|
|
|
582
582
|
);
|
|
583
583
|
};
|
|
584
584
|
function ee(e, n, s) {
|
|
585
|
-
|
|
585
|
+
M(() => {
|
|
586
586
|
if (!e) return;
|
|
587
|
-
const r = (
|
|
588
|
-
n.current && !n.current.contains(
|
|
589
|
-
}, l = (
|
|
590
|
-
|
|
587
|
+
const r = (c) => {
|
|
588
|
+
n.current && !n.current.contains(c.target) && s();
|
|
589
|
+
}, l = (c) => {
|
|
590
|
+
c.key === "Escape" && s();
|
|
591
591
|
};
|
|
592
592
|
return document.addEventListener("mousedown", r), document.addEventListener("keydown", l), () => {
|
|
593
593
|
document.removeEventListener("mousedown", r), document.removeEventListener("keydown", l);
|
|
@@ -608,8 +608,8 @@ const Oe = ({
|
|
|
608
608
|
children: e ? /* @__PURE__ */ t(Te, {}) : /* @__PURE__ */ t(Pe, {})
|
|
609
609
|
}
|
|
610
610
|
), qe = ({ video: e }) => {
|
|
611
|
-
const [n, s] = k(0), [r, l] = k(0), [
|
|
612
|
-
|
|
611
|
+
const [n, s] = k(0), [r, l] = k(0), [c, u] = k(0);
|
|
612
|
+
M(() => {
|
|
613
613
|
if (!e) return;
|
|
614
614
|
const b = () => s(e.currentTime), o = () => l(Number.isFinite(e.duration) ? e.duration : 0), a = () => {
|
|
615
615
|
const m = e.buffered;
|
|
@@ -629,8 +629,8 @@ const Oe = ({
|
|
|
629
629
|
e.removeEventListener("timeupdate", b), e.removeEventListener("durationchange", o), e.removeEventListener("loadedmetadata", o), e.removeEventListener("progress", a), e.removeEventListener("timeupdate", a);
|
|
630
630
|
};
|
|
631
631
|
}, [e]);
|
|
632
|
-
const
|
|
633
|
-
if (!e || !
|
|
632
|
+
const i = r > 0, p = i ? n / r * 100 : 0, d = i ? c / r * 100 : 0, C = (b) => {
|
|
633
|
+
if (!e || !i) return;
|
|
634
634
|
const o = Number(b.target.value) / 100 * r;
|
|
635
635
|
e.currentTime = o, s(o);
|
|
636
636
|
};
|
|
@@ -661,7 +661,7 @@ const Oe = ({
|
|
|
661
661
|
step: 0.1,
|
|
662
662
|
value: p,
|
|
663
663
|
onChange: C,
|
|
664
|
-
disabled: !
|
|
664
|
+
disabled: !i,
|
|
665
665
|
"aria-label": "Seek",
|
|
666
666
|
"aria-valuemin": 0,
|
|
667
667
|
"aria-valuemax": Math.floor(r),
|
|
@@ -671,11 +671,11 @@ const Oe = ({
|
|
|
671
671
|
] });
|
|
672
672
|
}, Fe = ({ video: e }) => {
|
|
673
673
|
const [n, s] = k(0), [r, l] = k(0);
|
|
674
|
-
return
|
|
674
|
+
return M(() => {
|
|
675
675
|
if (!e) return;
|
|
676
|
-
const
|
|
677
|
-
return
|
|
678
|
-
e.removeEventListener("timeupdate",
|
|
676
|
+
const c = () => s(e.currentTime), u = () => l(Number.isFinite(e.duration) ? e.duration : 0);
|
|
677
|
+
return c(), u(), e.addEventListener("timeupdate", c), e.addEventListener("durationchange", u), e.addEventListener("loadedmetadata", u), () => {
|
|
678
|
+
e.removeEventListener("timeupdate", c), e.removeEventListener("durationchange", u), e.removeEventListener("loadedmetadata", u);
|
|
679
679
|
};
|
|
680
680
|
}, [e]), /* @__PURE__ */ g("span", { className: "gvp-time", "aria-live": "off", children: [
|
|
681
681
|
re(n),
|
|
@@ -684,22 +684,22 @@ const Oe = ({
|
|
|
684
684
|
] });
|
|
685
685
|
}, Qe = ({ video: e }) => {
|
|
686
686
|
const [n, s] = k(1), [r, l] = k(!1);
|
|
687
|
-
|
|
687
|
+
M(() => {
|
|
688
688
|
if (!e) return;
|
|
689
689
|
const d = () => {
|
|
690
690
|
s(e.volume), l(e.muted);
|
|
691
691
|
};
|
|
692
692
|
return d(), e.addEventListener("volumechange", d), () => e.removeEventListener("volumechange", d);
|
|
693
693
|
}, [e]);
|
|
694
|
-
const
|
|
694
|
+
const c = () => {
|
|
695
695
|
e && (e.muted = !e.muted);
|
|
696
696
|
}, u = (d) => {
|
|
697
697
|
if (!e) return;
|
|
698
698
|
const C = Number(d.target.value) / 100;
|
|
699
699
|
e.volume = C, C > 0 && e.muted && (e.muted = !1);
|
|
700
700
|
};
|
|
701
|
-
let
|
|
702
|
-
r || n === 0 ?
|
|
701
|
+
let i = Ie;
|
|
702
|
+
r || n === 0 ? i = He : n < 0.5 && (i = Se);
|
|
703
703
|
const p = r ? 0 : Math.round(n * 100);
|
|
704
704
|
return /* @__PURE__ */ g("div", { className: I("gvp-volume", !se && "is-expandable"), children: [
|
|
705
705
|
/* @__PURE__ */ t(
|
|
@@ -709,8 +709,8 @@ const Oe = ({
|
|
|
709
709
|
className: "gvp-ctrl-btn",
|
|
710
710
|
"aria-label": r ? "Unmute" : "Mute",
|
|
711
711
|
"aria-pressed": r,
|
|
712
|
-
onClick:
|
|
713
|
-
children: /* @__PURE__ */ t(
|
|
712
|
+
onClick: c,
|
|
713
|
+
children: /* @__PURE__ */ t(i, {})
|
|
714
714
|
}
|
|
715
715
|
),
|
|
716
716
|
!se && /* @__PURE__ */ g("div", { className: "gvp-volume-slider-wrap", children: [
|
|
@@ -740,18 +740,18 @@ const Oe = ({
|
|
|
740
740
|
] })
|
|
741
741
|
] });
|
|
742
742
|
}, Ye = [0.5, 0.75, 1, 1.25, 1.5, 2], ze = ({ video: e }) => {
|
|
743
|
-
const [n, s] = k(1), [r, l] = k(!1),
|
|
744
|
-
|
|
743
|
+
const [n, s] = k(1), [r, l] = k(!1), c = H(null);
|
|
744
|
+
M(() => {
|
|
745
745
|
if (!e) return;
|
|
746
746
|
const d = () => s(e.playbackRate);
|
|
747
747
|
return d(), e.addEventListener("ratechange", d), () => e.removeEventListener("ratechange", d);
|
|
748
748
|
}, [e]);
|
|
749
|
-
const u =
|
|
750
|
-
ee(r,
|
|
751
|
-
const
|
|
749
|
+
const u = P(() => l(!1), []);
|
|
750
|
+
ee(r, c, u);
|
|
751
|
+
const i = (d) => {
|
|
752
752
|
e && (e.playbackRate = d), s(d), l(!1);
|
|
753
753
|
}, p = n === 1 ? "1×" : `${n}×`;
|
|
754
|
-
return /* @__PURE__ */ g("div", { className: "gvp-speed", ref:
|
|
754
|
+
return /* @__PURE__ */ g("div", { className: "gvp-speed", ref: c, children: [
|
|
755
755
|
/* @__PURE__ */ g(
|
|
756
756
|
"button",
|
|
757
757
|
{
|
|
@@ -775,16 +775,16 @@ const Oe = ({
|
|
|
775
775
|
role: "option",
|
|
776
776
|
"aria-selected": d === n,
|
|
777
777
|
className: I("gvp-speed-menu-item", d === n && "is-active"),
|
|
778
|
-
onClick: () =>
|
|
778
|
+
onClick: () => i(d),
|
|
779
779
|
children: d === 1 ? "Normal" : `${d}×`
|
|
780
780
|
}
|
|
781
781
|
) }, d)) })
|
|
782
782
|
] });
|
|
783
783
|
}, Ke = ({ levels: e, currentLevel: n, selectedLevel: s, onSelect: r }) => {
|
|
784
|
-
const [l,
|
|
785
|
-
if (ee(l, u,
|
|
784
|
+
const [l, c] = k(!1), u = H(null), i = P(() => c(!1), []);
|
|
785
|
+
if (ee(l, u, i), e.length < 2) return null;
|
|
786
786
|
const p = (o) => {
|
|
787
|
-
r == null || r(o),
|
|
787
|
+
r == null || r(o), c(!1);
|
|
788
788
|
}, d = [...e].sort((o, a) => a.height - o.height), C = e.find((o) => o.index === n);
|
|
789
789
|
let b;
|
|
790
790
|
if (s < 0)
|
|
@@ -802,7 +802,7 @@ const Oe = ({
|
|
|
802
802
|
"aria-haspopup": "listbox",
|
|
803
803
|
"aria-expanded": l,
|
|
804
804
|
"aria-label": `Quality: ${b}`,
|
|
805
|
-
onClick: () =>
|
|
805
|
+
onClick: () => c((o) => !o),
|
|
806
806
|
children: [
|
|
807
807
|
/* @__PURE__ */ t(We, {}),
|
|
808
808
|
/* @__PURE__ */ t("span", { className: "gvp-quality-label", children: b })
|
|
@@ -842,7 +842,7 @@ const Oe = ({
|
|
|
842
842
|
] })
|
|
843
843
|
] });
|
|
844
844
|
}, Je = ({ video: e }) => {
|
|
845
|
-
const [n, s] = k([]), [r, l] = k(-1), [
|
|
845
|
+
const [n, s] = k([]), [r, l] = k(-1), [c, u] = k(!1), i = H(null), p = P((o) => {
|
|
846
846
|
const a = [];
|
|
847
847
|
for (let f = 0; f < o.length; f++) {
|
|
848
848
|
const w = o[f];
|
|
@@ -857,7 +857,7 @@ const Oe = ({
|
|
|
857
857
|
}
|
|
858
858
|
l(m);
|
|
859
859
|
}, []);
|
|
860
|
-
|
|
860
|
+
M(() => {
|
|
861
861
|
if (!e) {
|
|
862
862
|
s([]), l(-1);
|
|
863
863
|
return;
|
|
@@ -870,8 +870,8 @@ const Oe = ({
|
|
|
870
870
|
o.removeEventListener("addtrack", a), o.removeEventListener("removetrack", a), o.removeEventListener("change", a);
|
|
871
871
|
};
|
|
872
872
|
}, [e, p]);
|
|
873
|
-
const d =
|
|
874
|
-
ee(
|
|
873
|
+
const d = P(() => u(!1), []);
|
|
874
|
+
ee(c, i, d);
|
|
875
875
|
const C = (o) => {
|
|
876
876
|
if (!e) return;
|
|
877
877
|
const a = e.textTracks;
|
|
@@ -884,21 +884,21 @@ const Oe = ({
|
|
|
884
884
|
for (let a = 0; a < o.length; a++) o[a].mode = "hidden";
|
|
885
885
|
l(-1), u(!1);
|
|
886
886
|
};
|
|
887
|
-
return n.length === 0 ? null : /* @__PURE__ */ g("div", { className: "gvp-captions", ref:
|
|
887
|
+
return n.length === 0 ? null : /* @__PURE__ */ g("div", { className: "gvp-captions", ref: i, children: [
|
|
888
888
|
/* @__PURE__ */ t(
|
|
889
889
|
"button",
|
|
890
890
|
{
|
|
891
891
|
type: "button",
|
|
892
892
|
className: I("gvp-ctrl-btn", r >= 0 && "is-active"),
|
|
893
893
|
"aria-haspopup": "listbox",
|
|
894
|
-
"aria-expanded":
|
|
894
|
+
"aria-expanded": c,
|
|
895
895
|
"aria-label": "Captions",
|
|
896
896
|
"aria-pressed": r >= 0,
|
|
897
897
|
onClick: () => u((o) => !o),
|
|
898
898
|
children: /* @__PURE__ */ t(Be, {})
|
|
899
899
|
}
|
|
900
900
|
),
|
|
901
|
-
|
|
901
|
+
c && // NOSONAR: typescript:S6819
|
|
902
902
|
/* @__PURE__ */ g("ul", { className: "gvp-captions-menu", role: "listbox", "aria-label": "Captions", children: [
|
|
903
903
|
/* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
904
904
|
"button",
|
|
@@ -925,15 +925,17 @@ const Oe = ({
|
|
|
925
925
|
] })
|
|
926
926
|
] });
|
|
927
927
|
}, Xe = ({ video: e }) => {
|
|
928
|
-
const [n, s] = k(!1);
|
|
929
|
-
if (
|
|
928
|
+
const [n, s] = k(!1), [r, l] = k(!1);
|
|
929
|
+
if (M(() => {
|
|
930
|
+
l(!0);
|
|
931
|
+
}, []), M(() => {
|
|
930
932
|
if (!e) return;
|
|
931
|
-
const
|
|
932
|
-
return e.addEventListener("enterpictureinpicture",
|
|
933
|
-
e.removeEventListener("enterpictureinpicture",
|
|
933
|
+
const u = () => s(!0), i = () => s(!1);
|
|
934
|
+
return e.addEventListener("enterpictureinpicture", u), e.addEventListener("leavepictureinpicture", i), () => {
|
|
935
|
+
e.removeEventListener("enterpictureinpicture", u), e.removeEventListener("leavepictureinpicture", i);
|
|
934
936
|
};
|
|
935
|
-
}, [e]), !document.pictureInPictureEnabled) return null;
|
|
936
|
-
const
|
|
937
|
+
}, [e]), !r || !document.pictureInPictureEnabled) return null;
|
|
938
|
+
const c = () => {
|
|
937
939
|
document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
|
|
938
940
|
}) : e == null || e.requestPictureInPicture().catch(() => {
|
|
939
941
|
});
|
|
@@ -945,13 +947,13 @@ const Oe = ({
|
|
|
945
947
|
className: I("gvp-ctrl-btn", n && "is-active"),
|
|
946
948
|
"aria-label": n ? "Exit picture-in-picture" : "Picture-in-picture",
|
|
947
949
|
"aria-pressed": n,
|
|
948
|
-
onClick:
|
|
950
|
+
onClick: c,
|
|
949
951
|
children: /* @__PURE__ */ t(De, {})
|
|
950
952
|
}
|
|
951
953
|
);
|
|
952
954
|
}, Ge = ({ container: e, video: n }) => {
|
|
953
955
|
const [s, r] = k(!1);
|
|
954
|
-
return
|
|
956
|
+
return M(() => {
|
|
955
957
|
if (G) return;
|
|
956
958
|
const p = () => r(j.element() === e);
|
|
957
959
|
return p(), j.onChange(p);
|
|
@@ -981,8 +983,8 @@ function oe(e, n, s) {
|
|
|
981
983
|
if (r) return r;
|
|
982
984
|
if (n) {
|
|
983
985
|
try {
|
|
984
|
-
const
|
|
985
|
-
if (
|
|
986
|
+
const c = new Intl.DisplayNames(void 0, { type: "language" }).of(n);
|
|
987
|
+
if (c && c !== n) return c;
|
|
986
988
|
} catch {
|
|
987
989
|
}
|
|
988
990
|
return n;
|
|
@@ -996,21 +998,21 @@ const le = we.forwardRef(
|
|
|
996
998
|
isHls: s,
|
|
997
999
|
autoPlay: r,
|
|
998
1000
|
children: l,
|
|
999
|
-
onAudioTracks:
|
|
1001
|
+
onAudioTracks: c,
|
|
1000
1002
|
audioTrackIndex: u,
|
|
1001
|
-
onQualityLevels:
|
|
1003
|
+
onQualityLevels: i,
|
|
1002
1004
|
onCurrentLevel: p,
|
|
1003
1005
|
qualityLevelIndex: d,
|
|
1004
1006
|
...C
|
|
1005
1007
|
}, b) => {
|
|
1006
|
-
const o = H(null), a = H(null), m = H(
|
|
1007
|
-
m.current =
|
|
1008
|
-
const f = H(
|
|
1009
|
-
f.current =
|
|
1008
|
+
const o = H(null), a = H(null), m = H(c);
|
|
1009
|
+
m.current = c;
|
|
1010
|
+
const f = H(i);
|
|
1011
|
+
f.current = i;
|
|
1010
1012
|
const w = H(p);
|
|
1011
1013
|
w.current = p, Le(b, () => o.current);
|
|
1012
1014
|
const U = globalThis.window !== void 0 && $.isSupported(), V = !!s || U && typeof e == "string" && e.endsWith(".m3u8");
|
|
1013
|
-
return
|
|
1015
|
+
return M(() => {
|
|
1014
1016
|
var F, Z, q;
|
|
1015
1017
|
if (!e) return;
|
|
1016
1018
|
const v = o.current;
|
|
@@ -1080,11 +1082,11 @@ const le = we.forwardRef(
|
|
|
1080
1082
|
for (v.removeEventListener("loadedmetadata", W), R == null || R(), a.current && (a.current.destroy(), a.current = null), v.pause(), v.removeAttribute("src"); v.firstChild; ) v.firstChild.remove();
|
|
1081
1083
|
v.load(), S([]), T([]), D(-1);
|
|
1082
1084
|
};
|
|
1083
|
-
}, [e, V, n, r]),
|
|
1085
|
+
}, [e, V, n, r]), M(() => {
|
|
1084
1086
|
if (d == null) return;
|
|
1085
1087
|
const v = a.current;
|
|
1086
1088
|
v && v.currentLevel !== d && (v.currentLevel = d);
|
|
1087
|
-
}, [d]),
|
|
1089
|
+
}, [d]), M(() => {
|
|
1088
1090
|
var T;
|
|
1089
1091
|
if (u == null || u < 0) return;
|
|
1090
1092
|
const v = a.current;
|
|
@@ -1133,41 +1135,41 @@ function tt(e) {
|
|
|
1133
1135
|
if (/^\d+s?$/.test(s)) return Number.parseInt(s, 10);
|
|
1134
1136
|
const r = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(s);
|
|
1135
1137
|
if (r) {
|
|
1136
|
-
const l = Number.parseInt(r[1] ?? "0", 10),
|
|
1137
|
-
return
|
|
1138
|
+
const l = Number.parseInt(r[1] ?? "0", 10), c = Number.parseInt(r[2] ?? "0", 10), u = Number.parseInt(r[3] ?? "0", 10), i = l * 3600 + c * 60 + u;
|
|
1139
|
+
return i > 0 ? i : null;
|
|
1138
1140
|
}
|
|
1139
1141
|
} catch {
|
|
1140
1142
|
}
|
|
1141
1143
|
return null;
|
|
1142
1144
|
}
|
|
1143
1145
|
function nt(e, n = {}) {
|
|
1144
|
-
const { autoPlay: s = !1, muted: r = !0, loop: l = !1, controls:
|
|
1146
|
+
const { autoPlay: s = !1, muted: r = !0, loop: l = !1, controls: c = !0, startSeconds: u } = n, i = new URLSearchParams({
|
|
1145
1147
|
rel: "0",
|
|
1146
1148
|
modestbranding: "1",
|
|
1147
1149
|
playsinline: "1",
|
|
1148
|
-
controls:
|
|
1150
|
+
controls: c ? "1" : "0"
|
|
1149
1151
|
});
|
|
1150
|
-
return s ? (
|
|
1152
|
+
return s ? (i.set("autoplay", "1"), i.set("mute", "1")) : r && i.set("mute", "1"), l && (i.set("loop", "1"), i.set("playlist", e)), u && u > 0 && i.set("start", String(u)), `https://www.youtube-nocookie.com/embed/${e}?${i.toString()}`;
|
|
1151
1153
|
}
|
|
1152
1154
|
const rt = ({
|
|
1153
1155
|
tracks: e,
|
|
1154
1156
|
activeIndex: n,
|
|
1155
1157
|
onSelect: s
|
|
1156
1158
|
}) => {
|
|
1157
|
-
const [r, l] = k(!1),
|
|
1158
|
-
|
|
1159
|
+
const [r, l] = k(!1), c = H(null);
|
|
1160
|
+
M(() => {
|
|
1159
1161
|
if (!r) return;
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
+
const i = (d) => {
|
|
1163
|
+
c.current && !c.current.contains(d.target) && l(!1);
|
|
1162
1164
|
}, p = (d) => {
|
|
1163
1165
|
d.key === "Escape" && l(!1);
|
|
1164
1166
|
};
|
|
1165
|
-
return document.addEventListener("mousedown",
|
|
1166
|
-
document.removeEventListener("mousedown",
|
|
1167
|
+
return document.addEventListener("mousedown", i), document.addEventListener("keydown", p), () => {
|
|
1168
|
+
document.removeEventListener("mousedown", i), document.removeEventListener("keydown", p);
|
|
1167
1169
|
};
|
|
1168
1170
|
}, [r]);
|
|
1169
|
-
const u = e.find((
|
|
1170
|
-
return /* @__PURE__ */ g("div", { className: "gvp-audio", ref:
|
|
1171
|
+
const u = e.find((i) => i.index === n) ?? e[0];
|
|
1172
|
+
return /* @__PURE__ */ g("div", { className: "gvp-audio", ref: c, children: [
|
|
1171
1173
|
/* @__PURE__ */ g(
|
|
1172
1174
|
"button",
|
|
1173
1175
|
{
|
|
@@ -1176,7 +1178,7 @@ const rt = ({
|
|
|
1176
1178
|
"aria-haspopup": "listbox",
|
|
1177
1179
|
"aria-expanded": r,
|
|
1178
1180
|
"aria-label": "Audio track",
|
|
1179
|
-
onClick: () => l((
|
|
1181
|
+
onClick: () => l((i) => !i),
|
|
1180
1182
|
children: [
|
|
1181
1183
|
/* @__PURE__ */ t(Me, {}),
|
|
1182
1184
|
/* @__PURE__ */ t("span", { className: "gvp-audio-label", children: u == null ? void 0 : u.label }),
|
|
@@ -1188,22 +1190,22 @@ const rt = ({
|
|
|
1188
1190
|
// (it renders the OS dropdown chrome), so this is a custom listbox with
|
|
1189
1191
|
// full keyboard + ARIA support.
|
|
1190
1192
|
// NOSONAR: typescript:S6819
|
|
1191
|
-
/* @__PURE__ */ t("ul", { className: "gvp-audio-menu", role: "listbox", "aria-label": "Audio tracks", children: e.map((
|
|
1193
|
+
/* @__PURE__ */ t("ul", { className: "gvp-audio-menu", role: "listbox", "aria-label": "Audio tracks", children: e.map((i) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
1192
1194
|
"button",
|
|
1193
1195
|
{
|
|
1194
1196
|
type: "button",
|
|
1195
1197
|
role: "option",
|
|
1196
|
-
"aria-selected":
|
|
1198
|
+
"aria-selected": i.index === n,
|
|
1197
1199
|
className: I(
|
|
1198
1200
|
"gvp-audio-menu-item",
|
|
1199
|
-
|
|
1201
|
+
i.index === n && "is-active"
|
|
1200
1202
|
),
|
|
1201
1203
|
onClick: () => {
|
|
1202
|
-
s(
|
|
1204
|
+
s(i.index), l(!1);
|
|
1203
1205
|
},
|
|
1204
|
-
children:
|
|
1206
|
+
children: i.label
|
|
1205
1207
|
}
|
|
1206
|
-
) },
|
|
1208
|
+
) }, i.index)) })
|
|
1207
1209
|
] });
|
|
1208
1210
|
}, lt = ({
|
|
1209
1211
|
src: e,
|
|
@@ -1211,9 +1213,9 @@ const rt = ({
|
|
|
1211
1213
|
showDeviceToggle: s = !0,
|
|
1212
1214
|
defaultDevice: r = "desktop",
|
|
1213
1215
|
hoverPlay: l = !1,
|
|
1214
|
-
tooltipText:
|
|
1216
|
+
tooltipText: c,
|
|
1215
1217
|
onClose: u,
|
|
1216
|
-
className:
|
|
1218
|
+
className: i = "",
|
|
1217
1219
|
muted: p = !0,
|
|
1218
1220
|
loop: d = !1,
|
|
1219
1221
|
controls: C = !0,
|
|
@@ -1223,7 +1225,7 @@ const rt = ({
|
|
|
1223
1225
|
hlsConfig: m,
|
|
1224
1226
|
children: f
|
|
1225
1227
|
}) => {
|
|
1226
|
-
const w = H(null), U = H(null), [V, v] = k(r), [S, T] = k(!1), [D, W] = k(!1), [R, F] = k([]), [Z, q] = k(-1), [h, L] = k([]), [B, N] = k(-1), [y, _] = k(-1), [ie, ce] = k(null), [ue, de] = k(null), he =
|
|
1228
|
+
const w = H(null), U = H(null), [V, v] = k(r), [S, T] = k(!1), [D, W] = k(!1), [R, F] = k([]), [Z, q] = k(-1), [h, L] = k([]), [B, N] = k(-1), [y, _] = k(-1), [ie, ce] = k(null), [ue, de] = k(null), he = P((E) => {
|
|
1227
1229
|
w.current = E, de(E);
|
|
1228
1230
|
}, []), O = C === !0 || C === "custom", J = C === "native", Q = K(() => et(e), [e]), A = Q !== null, pe = K(() => V === "mobile" ? (a == null ? void 0 : a.mobile) ?? "9/16" : (a == null ? void 0 : a.desktop) ?? "16/9", [V, a]), me = K(() => V === "mobile" ? (o == null ? void 0 : o.mobile) ?? "420px" : (o == null ? void 0 : o.desktop) ?? "960px", [V, o]), fe = K(
|
|
1229
1231
|
() => Q ? nt(Q, {
|
|
@@ -1236,11 +1238,11 @@ const rt = ({
|
|
|
1236
1238
|
startSeconds: tt(e)
|
|
1237
1239
|
}) : null,
|
|
1238
1240
|
[Q, e, b, p, d, O, J]
|
|
1239
|
-
), ge =
|
|
1241
|
+
), ge = P((E) => {
|
|
1240
1242
|
F(E), q(-1);
|
|
1241
|
-
}, []), ve =
|
|
1243
|
+
}, []), ve = P((E) => {
|
|
1242
1244
|
L(E), _(-1);
|
|
1243
|
-
}, []), Y =
|
|
1245
|
+
}, []), Y = P(async () => {
|
|
1244
1246
|
const E = w.current;
|
|
1245
1247
|
if (E) {
|
|
1246
1248
|
if (U.current)
|
|
@@ -1250,7 +1252,7 @@ const rt = ({
|
|
|
1250
1252
|
}
|
|
1251
1253
|
E.pause();
|
|
1252
1254
|
}
|
|
1253
|
-
}, []), z =
|
|
1255
|
+
}, []), z = P(async () => {
|
|
1254
1256
|
const E = w.current;
|
|
1255
1257
|
if (E)
|
|
1256
1258
|
try {
|
|
@@ -1262,11 +1264,11 @@ const rt = ({
|
|
|
1262
1264
|
} finally {
|
|
1263
1265
|
U.current = null;
|
|
1264
1266
|
}
|
|
1265
|
-
}, []), ke =
|
|
1267
|
+
}, []), ke = P(() => {
|
|
1266
1268
|
!l || A || z();
|
|
1267
|
-
}, [l, A, z]), be =
|
|
1269
|
+
}, [l, A, z]), be = P(() => {
|
|
1268
1270
|
!l || A || Y().then(() => T(!1));
|
|
1269
|
-
}, [l, A, Y]), X =
|
|
1271
|
+
}, [l, A, Y]), X = P(async () => {
|
|
1270
1272
|
const E = w.current;
|
|
1271
1273
|
E && (E.paused ? await z() : (await Y(), T(!1)));
|
|
1272
1274
|
}, [z, Y]), Ce = !A && R.length > 1;
|
|
@@ -1279,7 +1281,7 @@ const rt = ({
|
|
|
1279
1281
|
"div",
|
|
1280
1282
|
{
|
|
1281
1283
|
ref: ce,
|
|
1282
|
-
className: I("gvp-root",
|
|
1284
|
+
className: I("gvp-root", i),
|
|
1283
1285
|
style: { width: me, aspectRatio: pe },
|
|
1284
1286
|
onMouseEnter: () => {
|
|
1285
1287
|
W(!0), ke();
|
|
@@ -1392,7 +1394,7 @@ const rt = ({
|
|
|
1392
1394
|
"aria-label": "Play",
|
|
1393
1395
|
children: [
|
|
1394
1396
|
/* @__PURE__ */ t(Ne, {}),
|
|
1395
|
-
|
|
1397
|
+
c && D && /* @__PURE__ */ t("span", { className: "gvp-tooltip", role: "tooltip", children: c })
|
|
1396
1398
|
]
|
|
1397
1399
|
}
|
|
1398
1400
|
) }),
|