@glitchlab/react-video-player 1.3.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/README.md +8 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +591 -446
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
2
|
+
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
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
|
-
function
|
|
5
|
+
function ae(e) {
|
|
6
6
|
var n, s, r = "";
|
|
7
7
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
8
8
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
9
9
|
var l = e.length;
|
|
10
|
-
for (n = 0; n < l; n++) e[n] && (s =
|
|
10
|
+
for (n = 0; n < l; n++) e[n] && (s = ae(e[n])) && (r && (r += " "), r += s);
|
|
11
11
|
} else for (s in e) e[s] && (r && (r += " "), r += s);
|
|
12
12
|
return r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
for (var e, n, s = 0, r = "", l = arguments.length; s < l; s++) (e = arguments[s]) && (n =
|
|
14
|
+
function I() {
|
|
15
|
+
for (var e, n, s = 0, r = "", l = arguments.length; s < l; s++) (e = arguments[s]) && (n = ae(e)) && (r && (r += " "), r += n);
|
|
16
16
|
return r;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e }) => /* @__PURE__ */ g(
|
|
19
19
|
"svg",
|
|
20
20
|
{
|
|
21
|
-
className:
|
|
21
|
+
className: x(e),
|
|
22
22
|
width: "20",
|
|
23
23
|
height: "20",
|
|
24
24
|
viewBox: "0 0 24 24",
|
|
@@ -57,10 +57,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
57
57
|
/* @__PURE__ */ t("path", { d: "M7 22H17", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
|
-
),
|
|
60
|
+
), Ee = ({ className: e }) => /* @__PURE__ */ g(
|
|
61
61
|
"svg",
|
|
62
62
|
{
|
|
63
|
-
className:
|
|
63
|
+
className: x(e),
|
|
64
64
|
width: "20",
|
|
65
65
|
height: "20",
|
|
66
66
|
viewBox: "0 0 24 24",
|
|
@@ -98,10 +98,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
98
98
|
)
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
|
-
),
|
|
101
|
+
), xe = ({ className: e }) => /* @__PURE__ */ t(
|
|
102
102
|
"svg",
|
|
103
103
|
{
|
|
104
|
-
className:
|
|
104
|
+
className: x(e),
|
|
105
105
|
width: "14",
|
|
106
106
|
height: "14",
|
|
107
107
|
viewBox: "0 0 14 14",
|
|
@@ -116,10 +116,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
116
116
|
}
|
|
117
117
|
)
|
|
118
118
|
}
|
|
119
|
-
),
|
|
119
|
+
), Ne = ({ className: e }) => /* @__PURE__ */ t(
|
|
120
120
|
"svg",
|
|
121
121
|
{
|
|
122
|
-
className:
|
|
122
|
+
className: x(e),
|
|
123
123
|
width: "22",
|
|
124
124
|
height: "22",
|
|
125
125
|
viewBox: "0 0 16 16",
|
|
@@ -134,10 +134,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
134
134
|
}
|
|
135
135
|
)
|
|
136
136
|
}
|
|
137
|
-
),
|
|
137
|
+
), Me = ({ className: e }) => /* @__PURE__ */ g(
|
|
138
138
|
"svg",
|
|
139
139
|
{
|
|
140
|
-
className:
|
|
140
|
+
className: x(e),
|
|
141
141
|
width: "16",
|
|
142
142
|
height: "16",
|
|
143
143
|
viewBox: "0 0 24 24",
|
|
@@ -165,10 +165,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
165
165
|
)
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
|
-
),
|
|
168
|
+
), Pe = ({ className: e }) => /* @__PURE__ */ t(
|
|
169
169
|
"svg",
|
|
170
170
|
{
|
|
171
|
-
className:
|
|
171
|
+
className: x(e),
|
|
172
172
|
width: "16",
|
|
173
173
|
height: "16",
|
|
174
174
|
viewBox: "0 0 24 24",
|
|
@@ -183,10 +183,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
183
183
|
}
|
|
184
184
|
)
|
|
185
185
|
}
|
|
186
|
-
),
|
|
186
|
+
), Te = ({ className: e }) => /* @__PURE__ */ g(
|
|
187
187
|
"svg",
|
|
188
188
|
{
|
|
189
|
-
className:
|
|
189
|
+
className: x(e),
|
|
190
190
|
width: "16",
|
|
191
191
|
height: "16",
|
|
192
192
|
viewBox: "0 0 24 24",
|
|
@@ -198,10 +198,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
198
198
|
/* @__PURE__ */ t("rect", { x: "14", y: "5", width: "4", height: "14", rx: "1", fill: "currentColor" })
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
|
-
),
|
|
201
|
+
), Ie = ({ className: e }) => /* @__PURE__ */ g(
|
|
202
202
|
"svg",
|
|
203
203
|
{
|
|
204
|
-
className:
|
|
204
|
+
className: x(e),
|
|
205
205
|
width: "18",
|
|
206
206
|
height: "18",
|
|
207
207
|
viewBox: "0 0 24 24",
|
|
@@ -229,10 +229,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
229
229
|
)
|
|
230
230
|
]
|
|
231
231
|
}
|
|
232
|
-
),
|
|
232
|
+
), Se = ({ className: e }) => /* @__PURE__ */ g(
|
|
233
233
|
"svg",
|
|
234
234
|
{
|
|
235
|
-
className:
|
|
235
|
+
className: x(e),
|
|
236
236
|
width: "18",
|
|
237
237
|
height: "18",
|
|
238
238
|
viewBox: "0 0 24 24",
|
|
@@ -260,10 +260,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
260
260
|
)
|
|
261
261
|
]
|
|
262
262
|
}
|
|
263
|
-
),
|
|
263
|
+
), He = ({ className: e }) => /* @__PURE__ */ g(
|
|
264
264
|
"svg",
|
|
265
265
|
{
|
|
266
|
-
className:
|
|
266
|
+
className: x(e),
|
|
267
267
|
width: "18",
|
|
268
268
|
height: "18",
|
|
269
269
|
viewBox: "0 0 24 24",
|
|
@@ -291,10 +291,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
291
291
|
)
|
|
292
292
|
]
|
|
293
293
|
}
|
|
294
|
-
),
|
|
294
|
+
), Ve = ({ className: e }) => /* @__PURE__ */ t(
|
|
295
295
|
"svg",
|
|
296
296
|
{
|
|
297
|
-
className:
|
|
297
|
+
className: x(e),
|
|
298
298
|
width: "18",
|
|
299
299
|
height: "18",
|
|
300
300
|
viewBox: "0 0 24 24",
|
|
@@ -312,10 +312,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
312
312
|
}
|
|
313
313
|
)
|
|
314
314
|
}
|
|
315
|
-
),
|
|
315
|
+
), Ae = ({ className: e }) => /* @__PURE__ */ t(
|
|
316
316
|
"svg",
|
|
317
317
|
{
|
|
318
|
-
className:
|
|
318
|
+
className: x(e),
|
|
319
319
|
width: "18",
|
|
320
320
|
height: "18",
|
|
321
321
|
viewBox: "0 0 24 24",
|
|
@@ -333,10 +333,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
333
333
|
}
|
|
334
334
|
)
|
|
335
335
|
}
|
|
336
|
-
),
|
|
336
|
+
), De = ({ className: e }) => /* @__PURE__ */ g(
|
|
337
337
|
"svg",
|
|
338
338
|
{
|
|
339
|
-
className:
|
|
339
|
+
className: x(e),
|
|
340
340
|
width: "18",
|
|
341
341
|
height: "18",
|
|
342
342
|
viewBox: "0 0 24 24",
|
|
@@ -348,10 +348,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
348
348
|
/* @__PURE__ */ t("rect", { x: "12", y: "12", width: "8", height: "5", rx: "1", fill: "currentColor" })
|
|
349
349
|
]
|
|
350
350
|
}
|
|
351
|
-
),
|
|
351
|
+
), Be = ({ className: e }) => /* @__PURE__ */ g(
|
|
352
352
|
"svg",
|
|
353
353
|
{
|
|
354
|
-
className:
|
|
354
|
+
className: x(e),
|
|
355
355
|
width: "18",
|
|
356
356
|
height: "18",
|
|
357
357
|
viewBox: "0 0 24 24",
|
|
@@ -363,10 +363,10 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
363
363
|
/* @__PURE__ */ t("path", { d: "M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
364
364
|
]
|
|
365
365
|
}
|
|
366
|
-
),
|
|
366
|
+
), $e = ({ className: e }) => /* @__PURE__ */ g(
|
|
367
367
|
"svg",
|
|
368
368
|
{
|
|
369
|
-
className:
|
|
369
|
+
className: x(e),
|
|
370
370
|
width: "16",
|
|
371
371
|
height: "16",
|
|
372
372
|
viewBox: "0 0 24 24",
|
|
@@ -394,10 +394,40 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
394
394
|
)
|
|
395
395
|
]
|
|
396
396
|
}
|
|
397
|
-
),
|
|
397
|
+
), We = ({ className: e }) => /* @__PURE__ */ g(
|
|
398
398
|
"svg",
|
|
399
399
|
{
|
|
400
|
-
className:
|
|
400
|
+
className: x(e),
|
|
401
|
+
width: "16",
|
|
402
|
+
height: "16",
|
|
403
|
+
viewBox: "0 0 24 24",
|
|
404
|
+
fill: "none",
|
|
405
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
406
|
+
"aria-hidden": "true",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ t(
|
|
409
|
+
"path",
|
|
410
|
+
{
|
|
411
|
+
d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
|
|
412
|
+
stroke: "currentColor",
|
|
413
|
+
strokeWidth: "1.5"
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
/* @__PURE__ */ t(
|
|
417
|
+
"path",
|
|
418
|
+
{
|
|
419
|
+
d: "M3 12C3 12.6 3.08 13.18 3.23 13.73L4.6 14.5C4.86 14.65 5.02 14.94 5 15.24C4.98 15.58 4.96 15.92 5.07 16.24C5.18 16.56 5.39 16.83 5.62 17.08C5.83 17.3 6.13 17.4 6.42 17.36L7.99 17.13C8.28 17.09 8.57 17.21 8.74 17.45C9.07 17.93 9.49 18.34 9.97 18.66C10.21 18.83 10.34 19.11 10.31 19.4L10.13 20.97C10.1 21.26 10.21 21.55 10.43 21.74C10.91 22.16 11.45 22 12 22C12.55 22 13.09 22.16 13.57 21.74C13.79 21.55 13.9 21.26 13.87 20.97L13.69 19.4C13.66 19.11 13.79 18.83 14.03 18.66",
|
|
420
|
+
stroke: "currentColor",
|
|
421
|
+
strokeWidth: "1.5",
|
|
422
|
+
strokeLinecap: "round"
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
), Re = ({ className: e }) => /* @__PURE__ */ t(
|
|
428
|
+
"svg",
|
|
429
|
+
{
|
|
430
|
+
className: x(e),
|
|
401
431
|
width: "12",
|
|
402
432
|
height: "12",
|
|
403
433
|
viewBox: "0 0 24 24",
|
|
@@ -416,20 +446,26 @@ const K = "gvp-icon", L = (e) => e ? `${K} ${e}` : K, fe = ({ className: e }) =>
|
|
|
416
446
|
)
|
|
417
447
|
}
|
|
418
448
|
);
|
|
419
|
-
function
|
|
449
|
+
function re(e) {
|
|
420
450
|
if (!Number.isFinite(e) || e < 0) return "--:--";
|
|
421
|
-
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");
|
|
422
452
|
if (s > 0) {
|
|
423
|
-
const
|
|
424
|
-
return `${s}:${
|
|
453
|
+
const u = r.toString().padStart(2, "0");
|
|
454
|
+
return `${s}:${u}:${c}`;
|
|
425
455
|
}
|
|
426
|
-
return `${r}:${
|
|
456
|
+
return `${r}:${c}`;
|
|
427
457
|
}
|
|
428
|
-
const
|
|
458
|
+
const _e = {
|
|
459
|
+
index: -1
|
|
460
|
+
};
|
|
461
|
+
function je(e, n) {
|
|
462
|
+
return e > 0 ? `${e}p` : `Level ${n + 1}`;
|
|
463
|
+
}
|
|
464
|
+
const se = (() => {
|
|
429
465
|
if (typeof navigator > "u") return !1;
|
|
430
466
|
const e = navigator.userAgent;
|
|
431
467
|
return /iPad|iPhone|iPod/.test(e) || e.includes("Mac") && navigator.maxTouchPoints > 1;
|
|
432
|
-
})(),
|
|
468
|
+
})(), G = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), Ue = 3e3, j = {
|
|
433
469
|
isSupported() {
|
|
434
470
|
return typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
|
|
435
471
|
},
|
|
@@ -449,89 +485,116 @@ const X = (() => {
|
|
|
449
485
|
document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e);
|
|
450
486
|
};
|
|
451
487
|
}
|
|
452
|
-
},
|
|
488
|
+
}, Ze = ({
|
|
453
489
|
video: e,
|
|
454
490
|
isPlaying: n,
|
|
455
491
|
container: s,
|
|
456
|
-
onTogglePlay: r
|
|
492
|
+
onTogglePlay: r,
|
|
493
|
+
qualityLevels: l = [],
|
|
494
|
+
currentLevel: c = -1,
|
|
495
|
+
selectedLevel: u = -1,
|
|
496
|
+
onSelectLevel: i
|
|
457
497
|
}) => {
|
|
458
|
-
const [
|
|
459
|
-
|
|
460
|
-
}, []),
|
|
461
|
-
|
|
462
|
-
}, [
|
|
463
|
-
|
|
464
|
-
}, [
|
|
465
|
-
return
|
|
498
|
+
const [p, d] = k(!0), C = H(null), b = P(() => {
|
|
499
|
+
C.current !== null && (clearTimeout(C.current), C.current = null);
|
|
500
|
+
}, []), o = P(() => {
|
|
501
|
+
b(), n && (C.current = setTimeout(() => d(!1), Ue));
|
|
502
|
+
}, [b, n]), a = P(() => {
|
|
503
|
+
d(!0), o();
|
|
504
|
+
}, [o]);
|
|
505
|
+
return M(() => {
|
|
466
506
|
if (!n) {
|
|
467
|
-
|
|
507
|
+
b(), d(!0);
|
|
468
508
|
return;
|
|
469
509
|
}
|
|
470
|
-
return
|
|
471
|
-
}, [n,
|
|
510
|
+
return o(), b;
|
|
511
|
+
}, [n, o, b]), M(() => {
|
|
472
512
|
if (!s) return;
|
|
473
|
-
const
|
|
474
|
-
return s.addEventListener("mousemove",
|
|
475
|
-
s.removeEventListener("mousemove",
|
|
513
|
+
const m = () => a();
|
|
514
|
+
return s.addEventListener("mousemove", m), s.addEventListener("touchstart", m), s.addEventListener("focusin", m), () => {
|
|
515
|
+
s.removeEventListener("mousemove", m), s.removeEventListener("touchstart", m), s.removeEventListener("focusin", m);
|
|
476
516
|
};
|
|
477
|
-
}, [s,
|
|
517
|
+
}, [s, a]), M(() => {
|
|
478
518
|
if (!s || !e) return;
|
|
479
|
-
const
|
|
480
|
-
if (!(!s.contains(document.activeElement) ||
|
|
481
|
-
switch (
|
|
519
|
+
const m = (f) => {
|
|
520
|
+
if (!(!s.contains(document.activeElement) || f.target.tagName === "INPUT" && f.key !== " "))
|
|
521
|
+
switch (f.key) {
|
|
482
522
|
case " ":
|
|
483
523
|
case "k":
|
|
484
|
-
|
|
524
|
+
f.preventDefault(), r(), a();
|
|
485
525
|
break;
|
|
486
526
|
case "ArrowLeft":
|
|
487
|
-
|
|
527
|
+
f.preventDefault(), e.currentTime = Math.max(0, e.currentTime - 5), a();
|
|
488
528
|
break;
|
|
489
529
|
case "ArrowRight":
|
|
490
|
-
|
|
530
|
+
f.preventDefault(), e.currentTime = Math.min(e.duration || 0, e.currentTime + 5), a();
|
|
491
531
|
break;
|
|
492
532
|
case "ArrowUp":
|
|
493
|
-
|
|
533
|
+
f.preventDefault(), e.volume = Math.min(1, e.volume + 0.1), e.muted && (e.muted = !1), a();
|
|
494
534
|
break;
|
|
495
535
|
case "ArrowDown":
|
|
496
|
-
|
|
536
|
+
f.preventDefault(), e.volume = Math.max(0, e.volume - 0.1), a();
|
|
497
537
|
break;
|
|
498
538
|
case "m":
|
|
499
|
-
e.muted = !e.muted,
|
|
539
|
+
e.muted = !e.muted, a();
|
|
500
540
|
break;
|
|
501
541
|
case "f":
|
|
502
|
-
|
|
503
|
-
}) :
|
|
504
|
-
}),
|
|
542
|
+
j.element() === s ? j.exit().catch(() => {
|
|
543
|
+
}) : j.request(s).catch(() => {
|
|
544
|
+
}), a();
|
|
505
545
|
break;
|
|
506
546
|
case "p":
|
|
507
547
|
document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
|
|
508
548
|
}) : document.pictureInPictureEnabled && e.requestPictureInPicture().catch(() => {
|
|
509
|
-
}),
|
|
549
|
+
}), a();
|
|
510
550
|
break;
|
|
511
551
|
}
|
|
512
552
|
};
|
|
513
|
-
return document.addEventListener("keydown",
|
|
514
|
-
}, [s, e, r,
|
|
553
|
+
return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
|
|
554
|
+
}, [s, e, r, a]), /* @__PURE__ */ t(
|
|
515
555
|
"div",
|
|
516
556
|
{
|
|
517
557
|
role: "toolbar",
|
|
518
558
|
"aria-label": "Video controls",
|
|
519
|
-
className:
|
|
520
|
-
onMouseEnter:
|
|
521
|
-
onMouseLeave:
|
|
522
|
-
children: /* @__PURE__ */
|
|
523
|
-
/* @__PURE__ */ t(
|
|
524
|
-
/* @__PURE__ */ t(
|
|
525
|
-
/* @__PURE__ */ t(
|
|
526
|
-
/* @__PURE__ */ t(
|
|
527
|
-
/* @__PURE__ */ t(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
559
|
+
className: I("gvp-controls", !p && "is-hidden"),
|
|
560
|
+
onMouseEnter: b,
|
|
561
|
+
onMouseLeave: o,
|
|
562
|
+
children: /* @__PURE__ */ g("div", { className: "gvp-controls-row", children: [
|
|
563
|
+
/* @__PURE__ */ t(Oe, { isPlaying: n, onToggle: r }),
|
|
564
|
+
/* @__PURE__ */ t(qe, { video: e }),
|
|
565
|
+
/* @__PURE__ */ t(Fe, { video: e }),
|
|
566
|
+
/* @__PURE__ */ t(ze, { video: e }),
|
|
567
|
+
/* @__PURE__ */ t(
|
|
568
|
+
Ke,
|
|
569
|
+
{
|
|
570
|
+
levels: l,
|
|
571
|
+
currentLevel: c,
|
|
572
|
+
selectedLevel: u,
|
|
573
|
+
onSelect: i
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
/* @__PURE__ */ t(Je, { video: e }),
|
|
577
|
+
/* @__PURE__ */ t(Qe, { video: e }),
|
|
578
|
+
/* @__PURE__ */ t(Xe, { video: e }),
|
|
579
|
+
/* @__PURE__ */ t(Ge, { container: s, video: e })
|
|
531
580
|
] })
|
|
532
581
|
}
|
|
533
582
|
);
|
|
534
|
-
}
|
|
583
|
+
};
|
|
584
|
+
function ee(e, n, s) {
|
|
585
|
+
M(() => {
|
|
586
|
+
if (!e) return;
|
|
587
|
+
const r = (c) => {
|
|
588
|
+
n.current && !n.current.contains(c.target) && s();
|
|
589
|
+
}, l = (c) => {
|
|
590
|
+
c.key === "Escape" && s();
|
|
591
|
+
};
|
|
592
|
+
return document.addEventListener("mousedown", r), document.addEventListener("keydown", l), () => {
|
|
593
|
+
document.removeEventListener("mousedown", r), document.removeEventListener("keydown", l);
|
|
594
|
+
};
|
|
595
|
+
}, [e, n, s]);
|
|
596
|
+
}
|
|
597
|
+
const Oe = ({
|
|
535
598
|
isPlaying: e,
|
|
536
599
|
onToggle: n
|
|
537
600
|
}) => /* @__PURE__ */ t(
|
|
@@ -542,49 +605,49 @@ const X = (() => {
|
|
|
542
605
|
"aria-label": e ? "Pause" : "Play",
|
|
543
606
|
"aria-pressed": e,
|
|
544
607
|
onClick: n,
|
|
545
|
-
children: e ? /* @__PURE__ */ t(
|
|
608
|
+
children: e ? /* @__PURE__ */ t(Te, {}) : /* @__PURE__ */ t(Pe, {})
|
|
546
609
|
}
|
|
547
|
-
),
|
|
548
|
-
const [n, s] = k(0), [r, l] = k(0), [
|
|
549
|
-
|
|
610
|
+
), qe = ({ video: e }) => {
|
|
611
|
+
const [n, s] = k(0), [r, l] = k(0), [c, u] = k(0);
|
|
612
|
+
M(() => {
|
|
550
613
|
if (!e) return;
|
|
551
|
-
const
|
|
552
|
-
const
|
|
553
|
-
if (!
|
|
554
|
-
|
|
614
|
+
const b = () => s(e.currentTime), o = () => l(Number.isFinite(e.duration) ? e.duration : 0), a = () => {
|
|
615
|
+
const m = e.buffered;
|
|
616
|
+
if (!m || m.length === 0) {
|
|
617
|
+
u(0);
|
|
555
618
|
return;
|
|
556
619
|
}
|
|
557
|
-
let
|
|
558
|
-
for (let
|
|
559
|
-
if (
|
|
560
|
-
|
|
620
|
+
let f = m.end(m.length - 1);
|
|
621
|
+
for (let w = 0; w < m.length; w++)
|
|
622
|
+
if (m.start(w) <= e.currentTime && e.currentTime <= m.end(w)) {
|
|
623
|
+
f = m.end(w);
|
|
561
624
|
break;
|
|
562
625
|
}
|
|
563
|
-
|
|
626
|
+
u(f);
|
|
564
627
|
};
|
|
565
|
-
return
|
|
566
|
-
e.removeEventListener("timeupdate",
|
|
628
|
+
return b(), o(), a(), e.addEventListener("timeupdate", b), e.addEventListener("durationchange", o), e.addEventListener("loadedmetadata", o), e.addEventListener("progress", a), e.addEventListener("timeupdate", a), () => {
|
|
629
|
+
e.removeEventListener("timeupdate", b), e.removeEventListener("durationchange", o), e.removeEventListener("loadedmetadata", o), e.removeEventListener("progress", a), e.removeEventListener("timeupdate", a);
|
|
567
630
|
};
|
|
568
631
|
}, [e]);
|
|
569
|
-
const
|
|
570
|
-
if (!e || !
|
|
571
|
-
const
|
|
572
|
-
e.currentTime =
|
|
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
|
+
const o = Number(b.target.value) / 100 * r;
|
|
635
|
+
e.currentTime = o, s(o);
|
|
573
636
|
};
|
|
574
|
-
return /* @__PURE__ */
|
|
575
|
-
/* @__PURE__ */
|
|
637
|
+
return /* @__PURE__ */ g("div", { className: "gvp-seek", children: [
|
|
638
|
+
/* @__PURE__ */ g("div", { className: "gvp-seek-track", children: [
|
|
576
639
|
/* @__PURE__ */ t(
|
|
577
640
|
"div",
|
|
578
641
|
{
|
|
579
642
|
className: "gvp-seek-buffered",
|
|
580
|
-
style: { width: `${
|
|
643
|
+
style: { width: `${d}%` }
|
|
581
644
|
}
|
|
582
645
|
),
|
|
583
646
|
/* @__PURE__ */ t(
|
|
584
647
|
"div",
|
|
585
648
|
{
|
|
586
649
|
className: "gvp-seek-progress",
|
|
587
|
-
style: { width: `${
|
|
650
|
+
style: { width: `${p}%` }
|
|
588
651
|
}
|
|
589
652
|
)
|
|
590
653
|
] }),
|
|
@@ -596,9 +659,9 @@ const X = (() => {
|
|
|
596
659
|
min: 0,
|
|
597
660
|
max: 100,
|
|
598
661
|
step: 0.1,
|
|
599
|
-
value:
|
|
600
|
-
onChange:
|
|
601
|
-
disabled: !
|
|
662
|
+
value: p,
|
|
663
|
+
onChange: C,
|
|
664
|
+
disabled: !i,
|
|
602
665
|
"aria-label": "Seek",
|
|
603
666
|
"aria-valuemin": 0,
|
|
604
667
|
"aria-valuemax": Math.floor(r),
|
|
@@ -606,39 +669,39 @@ const X = (() => {
|
|
|
606
669
|
}
|
|
607
670
|
)
|
|
608
671
|
] });
|
|
609
|
-
},
|
|
672
|
+
}, Fe = ({ video: e }) => {
|
|
610
673
|
const [n, s] = k(0), [r, l] = k(0);
|
|
611
|
-
return
|
|
674
|
+
return M(() => {
|
|
612
675
|
if (!e) return;
|
|
613
|
-
const
|
|
614
|
-
return
|
|
615
|
-
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);
|
|
616
679
|
};
|
|
617
|
-
}, [e]), /* @__PURE__ */
|
|
618
|
-
|
|
680
|
+
}, [e]), /* @__PURE__ */ g("span", { className: "gvp-time", "aria-live": "off", children: [
|
|
681
|
+
re(n),
|
|
619
682
|
" / ",
|
|
620
|
-
|
|
683
|
+
re(r)
|
|
621
684
|
] });
|
|
622
|
-
},
|
|
685
|
+
}, Qe = ({ video: e }) => {
|
|
623
686
|
const [n, s] = k(1), [r, l] = k(!1);
|
|
624
|
-
|
|
687
|
+
M(() => {
|
|
625
688
|
if (!e) return;
|
|
626
|
-
const
|
|
689
|
+
const d = () => {
|
|
627
690
|
s(e.volume), l(e.muted);
|
|
628
691
|
};
|
|
629
|
-
return
|
|
692
|
+
return d(), e.addEventListener("volumechange", d), () => e.removeEventListener("volumechange", d);
|
|
630
693
|
}, [e]);
|
|
631
|
-
const
|
|
694
|
+
const c = () => {
|
|
632
695
|
e && (e.muted = !e.muted);
|
|
633
|
-
},
|
|
696
|
+
}, u = (d) => {
|
|
634
697
|
if (!e) return;
|
|
635
|
-
const
|
|
636
|
-
e.volume =
|
|
698
|
+
const C = Number(d.target.value) / 100;
|
|
699
|
+
e.volume = C, C > 0 && e.muted && (e.muted = !1);
|
|
637
700
|
};
|
|
638
|
-
let
|
|
639
|
-
r || n === 0 ?
|
|
640
|
-
const
|
|
641
|
-
return /* @__PURE__ */
|
|
701
|
+
let i = Ie;
|
|
702
|
+
r || n === 0 ? i = He : n < 0.5 && (i = Se);
|
|
703
|
+
const p = r ? 0 : Math.round(n * 100);
|
|
704
|
+
return /* @__PURE__ */ g("div", { className: I("gvp-volume", !se && "is-expandable"), children: [
|
|
642
705
|
/* @__PURE__ */ t(
|
|
643
706
|
"button",
|
|
644
707
|
{
|
|
@@ -646,16 +709,16 @@ const X = (() => {
|
|
|
646
709
|
className: "gvp-ctrl-btn",
|
|
647
710
|
"aria-label": r ? "Unmute" : "Mute",
|
|
648
711
|
"aria-pressed": r,
|
|
649
|
-
onClick:
|
|
650
|
-
children: /* @__PURE__ */ t(
|
|
712
|
+
onClick: c,
|
|
713
|
+
children: /* @__PURE__ */ t(i, {})
|
|
651
714
|
}
|
|
652
715
|
),
|
|
653
|
-
!
|
|
716
|
+
!se && /* @__PURE__ */ g("div", { className: "gvp-volume-slider-wrap", children: [
|
|
654
717
|
/* @__PURE__ */ t("div", { className: "gvp-volume-track", children: /* @__PURE__ */ t(
|
|
655
718
|
"div",
|
|
656
719
|
{
|
|
657
720
|
className: "gvp-volume-fill",
|
|
658
|
-
style: { width: `${
|
|
721
|
+
style: { width: `${p}%` }
|
|
659
722
|
}
|
|
660
723
|
) }),
|
|
661
724
|
/* @__PURE__ */ t(
|
|
@@ -666,140 +729,185 @@ const X = (() => {
|
|
|
666
729
|
min: 0,
|
|
667
730
|
max: 100,
|
|
668
731
|
step: 1,
|
|
669
|
-
value:
|
|
670
|
-
onChange:
|
|
732
|
+
value: p,
|
|
733
|
+
onChange: u,
|
|
671
734
|
"aria-label": "Volume",
|
|
672
735
|
"aria-valuemin": 0,
|
|
673
736
|
"aria-valuemax": 100,
|
|
674
|
-
"aria-valuenow":
|
|
737
|
+
"aria-valuenow": p
|
|
675
738
|
}
|
|
676
739
|
)
|
|
677
740
|
] })
|
|
678
741
|
] });
|
|
679
|
-
},
|
|
680
|
-
const [n, s] = k(1), [r, l] = k(!1),
|
|
681
|
-
|
|
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), c = H(null);
|
|
744
|
+
M(() => {
|
|
682
745
|
if (!e) return;
|
|
683
|
-
const
|
|
684
|
-
return
|
|
685
|
-
}, [e])
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
document.removeEventListener("mousedown", i), document.removeEventListener("keydown", m);
|
|
694
|
-
};
|
|
695
|
-
}, [r]);
|
|
696
|
-
const c = (i) => {
|
|
697
|
-
e && (e.playbackRate = i), s(i), l(!1);
|
|
698
|
-
}, a = n === 1 ? "1×" : `${n}×`;
|
|
699
|
-
return /* @__PURE__ */ v("div", { className: "gvp-speed", ref: u, children: [
|
|
700
|
-
/* @__PURE__ */ v(
|
|
746
|
+
const d = () => s(e.playbackRate);
|
|
747
|
+
return d(), e.addEventListener("ratechange", d), () => e.removeEventListener("ratechange", d);
|
|
748
|
+
}, [e]);
|
|
749
|
+
const u = P(() => l(!1), []);
|
|
750
|
+
ee(r, c, u);
|
|
751
|
+
const i = (d) => {
|
|
752
|
+
e && (e.playbackRate = d), s(d), l(!1);
|
|
753
|
+
}, p = n === 1 ? "1×" : `${n}×`;
|
|
754
|
+
return /* @__PURE__ */ g("div", { className: "gvp-speed", ref: c, children: [
|
|
755
|
+
/* @__PURE__ */ g(
|
|
701
756
|
"button",
|
|
702
757
|
{
|
|
703
758
|
type: "button",
|
|
704
759
|
className: "gvp-ctrl-btn gvp-speed-btn",
|
|
705
760
|
"aria-haspopup": "listbox",
|
|
706
761
|
"aria-expanded": r,
|
|
707
|
-
"aria-label": `Playback speed: ${
|
|
708
|
-
onClick: () => l((
|
|
762
|
+
"aria-label": `Playback speed: ${p}`,
|
|
763
|
+
onClick: () => l((d) => !d),
|
|
709
764
|
children: [
|
|
710
|
-
/* @__PURE__ */ t(
|
|
711
|
-
/* @__PURE__ */ t("span", { className: "gvp-speed-label", children:
|
|
765
|
+
/* @__PURE__ */ t($e, {}),
|
|
766
|
+
/* @__PURE__ */ t("span", { className: "gvp-speed-label", children: p })
|
|
712
767
|
]
|
|
713
768
|
}
|
|
714
769
|
),
|
|
715
770
|
r && // NOSONAR: typescript:S6819
|
|
716
|
-
/* @__PURE__ */ t("ul", { className: "gvp-speed-menu", role: "listbox", "aria-label": "Playback speed", children:
|
|
771
|
+
/* @__PURE__ */ t("ul", { className: "gvp-speed-menu", role: "listbox", "aria-label": "Playback speed", children: Ye.map((d) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
717
772
|
"button",
|
|
718
773
|
{
|
|
719
774
|
type: "button",
|
|
720
775
|
role: "option",
|
|
721
|
-
"aria-selected":
|
|
722
|
-
className:
|
|
723
|
-
onClick: () =>
|
|
724
|
-
children:
|
|
776
|
+
"aria-selected": d === n,
|
|
777
|
+
className: I("gvp-speed-menu-item", d === n && "is-active"),
|
|
778
|
+
onClick: () => i(d),
|
|
779
|
+
children: d === 1 ? "Normal" : `${d}×`
|
|
725
780
|
}
|
|
726
|
-
) },
|
|
781
|
+
) }, d)) })
|
|
782
|
+
] });
|
|
783
|
+
}, Ke = ({ levels: e, currentLevel: n, selectedLevel: s, onSelect: r }) => {
|
|
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
|
+
const p = (o) => {
|
|
787
|
+
r == null || r(o), c(!1);
|
|
788
|
+
}, d = [...e].sort((o, a) => a.height - o.height), C = e.find((o) => o.index === n);
|
|
789
|
+
let b;
|
|
790
|
+
if (s < 0)
|
|
791
|
+
b = C ? `Auto (${C.label})` : "Auto";
|
|
792
|
+
else {
|
|
793
|
+
const o = e.find((a) => a.index === s);
|
|
794
|
+
b = (o == null ? void 0 : o.label) ?? "Auto";
|
|
795
|
+
}
|
|
796
|
+
return /* @__PURE__ */ g("div", { className: "gvp-quality", ref: u, children: [
|
|
797
|
+
/* @__PURE__ */ g(
|
|
798
|
+
"button",
|
|
799
|
+
{
|
|
800
|
+
type: "button",
|
|
801
|
+
className: "gvp-ctrl-btn gvp-quality-btn",
|
|
802
|
+
"aria-haspopup": "listbox",
|
|
803
|
+
"aria-expanded": l,
|
|
804
|
+
"aria-label": `Quality: ${b}`,
|
|
805
|
+
onClick: () => c((o) => !o),
|
|
806
|
+
children: [
|
|
807
|
+
/* @__PURE__ */ t(We, {}),
|
|
808
|
+
/* @__PURE__ */ t("span", { className: "gvp-quality-label", children: b })
|
|
809
|
+
]
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
l && // NOSONAR: typescript:S6819
|
|
813
|
+
/* @__PURE__ */ g("ul", { className: "gvp-quality-menu", role: "listbox", "aria-label": "Quality", children: [
|
|
814
|
+
/* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
815
|
+
"button",
|
|
816
|
+
{
|
|
817
|
+
type: "button",
|
|
818
|
+
role: "option",
|
|
819
|
+
"aria-selected": s < 0,
|
|
820
|
+
className: I(
|
|
821
|
+
"gvp-quality-menu-item",
|
|
822
|
+
s < 0 && "is-active"
|
|
823
|
+
),
|
|
824
|
+
onClick: () => p(_e.index),
|
|
825
|
+
children: C ? `Auto (${C.label})` : "Auto"
|
|
826
|
+
}
|
|
827
|
+
) }),
|
|
828
|
+
d.map((o) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
829
|
+
"button",
|
|
830
|
+
{
|
|
831
|
+
type: "button",
|
|
832
|
+
role: "option",
|
|
833
|
+
"aria-selected": o.index === s,
|
|
834
|
+
className: I(
|
|
835
|
+
"gvp-quality-menu-item",
|
|
836
|
+
o.index === s && "is-active"
|
|
837
|
+
),
|
|
838
|
+
onClick: () => p(o.index),
|
|
839
|
+
children: o.label
|
|
840
|
+
}
|
|
841
|
+
) }, o.index))
|
|
842
|
+
] })
|
|
727
843
|
] });
|
|
728
|
-
},
|
|
729
|
-
const [n, s] = k([]), [r, l] = k(-1), [
|
|
730
|
-
const
|
|
731
|
-
for (let
|
|
732
|
-
const w = o[
|
|
733
|
-
(w.kind === "subtitles" || w.kind === "captions") &&
|
|
844
|
+
}, Je = ({ video: e }) => {
|
|
845
|
+
const [n, s] = k([]), [r, l] = k(-1), [c, u] = k(!1), i = H(null), p = P((o) => {
|
|
846
|
+
const a = [];
|
|
847
|
+
for (let f = 0; f < o.length; f++) {
|
|
848
|
+
const w = o[f];
|
|
849
|
+
(w.kind === "subtitles" || w.kind === "captions") && a.push({ index: f, label: w.label || w.language || `Track ${f + 1}`, language: w.language });
|
|
734
850
|
}
|
|
735
|
-
s(
|
|
736
|
-
let
|
|
737
|
-
for (let
|
|
738
|
-
if (o[
|
|
739
|
-
|
|
851
|
+
s(a);
|
|
852
|
+
let m = -1;
|
|
853
|
+
for (let f = 0; f < o.length; f++)
|
|
854
|
+
if (o[f].mode === "showing") {
|
|
855
|
+
m = f;
|
|
740
856
|
break;
|
|
741
857
|
}
|
|
742
|
-
l(
|
|
858
|
+
l(m);
|
|
743
859
|
}, []);
|
|
744
|
-
|
|
860
|
+
M(() => {
|
|
745
861
|
if (!e) {
|
|
746
862
|
s([]), l(-1);
|
|
747
863
|
return;
|
|
748
864
|
}
|
|
749
865
|
const o = e.textTracks;
|
|
750
|
-
|
|
751
|
-
const
|
|
866
|
+
p(o);
|
|
867
|
+
const a = () => p(o);
|
|
752
868
|
if (typeof o.addEventListener == "function")
|
|
753
|
-
return o.addEventListener("addtrack",
|
|
754
|
-
o.removeEventListener("addtrack",
|
|
869
|
+
return o.addEventListener("addtrack", a), o.addEventListener("removetrack", a), o.addEventListener("change", a), () => {
|
|
870
|
+
o.removeEventListener("addtrack", a), o.removeEventListener("removetrack", a), o.removeEventListener("change", a);
|
|
755
871
|
};
|
|
756
|
-
}, [e,
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
}, h = (g) => {
|
|
761
|
-
g.key === "Escape" && c(!1);
|
|
762
|
-
};
|
|
763
|
-
return document.addEventListener("mousedown", o), document.addEventListener("keydown", h), () => {
|
|
764
|
-
document.removeEventListener("mousedown", o), document.removeEventListener("keydown", h);
|
|
765
|
-
};
|
|
766
|
-
}, [u]);
|
|
767
|
-
const m = (o) => {
|
|
872
|
+
}, [e, p]);
|
|
873
|
+
const d = P(() => u(!1), []);
|
|
874
|
+
ee(c, i, d);
|
|
875
|
+
const C = (o) => {
|
|
768
876
|
if (!e) return;
|
|
769
|
-
const
|
|
770
|
-
for (let
|
|
771
|
-
|
|
772
|
-
l(o),
|
|
773
|
-
},
|
|
877
|
+
const a = e.textTracks;
|
|
878
|
+
for (let m = 0; m < a.length; m++)
|
|
879
|
+
a[m].mode = m === o ? "showing" : "hidden";
|
|
880
|
+
l(o), u(!1);
|
|
881
|
+
}, b = () => {
|
|
774
882
|
if (!e) return;
|
|
775
883
|
const o = e.textTracks;
|
|
776
|
-
for (let
|
|
777
|
-
l(-1),
|
|
884
|
+
for (let a = 0; a < o.length; a++) o[a].mode = "hidden";
|
|
885
|
+
l(-1), u(!1);
|
|
778
886
|
};
|
|
779
|
-
return n.length === 0 ? null : /* @__PURE__ */
|
|
887
|
+
return n.length === 0 ? null : /* @__PURE__ */ g("div", { className: "gvp-captions", ref: i, children: [
|
|
780
888
|
/* @__PURE__ */ t(
|
|
781
889
|
"button",
|
|
782
890
|
{
|
|
783
891
|
type: "button",
|
|
784
|
-
className:
|
|
892
|
+
className: I("gvp-ctrl-btn", r >= 0 && "is-active"),
|
|
785
893
|
"aria-haspopup": "listbox",
|
|
786
|
-
"aria-expanded":
|
|
894
|
+
"aria-expanded": c,
|
|
787
895
|
"aria-label": "Captions",
|
|
788
896
|
"aria-pressed": r >= 0,
|
|
789
|
-
onClick: () =>
|
|
790
|
-
children: /* @__PURE__ */ t(
|
|
897
|
+
onClick: () => u((o) => !o),
|
|
898
|
+
children: /* @__PURE__ */ t(Be, {})
|
|
791
899
|
}
|
|
792
900
|
),
|
|
793
|
-
|
|
794
|
-
/* @__PURE__ */
|
|
901
|
+
c && // NOSONAR: typescript:S6819
|
|
902
|
+
/* @__PURE__ */ g("ul", { className: "gvp-captions-menu", role: "listbox", "aria-label": "Captions", children: [
|
|
795
903
|
/* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
796
904
|
"button",
|
|
797
905
|
{
|
|
798
906
|
type: "button",
|
|
799
907
|
role: "option",
|
|
800
908
|
"aria-selected": r === -1,
|
|
801
|
-
className:
|
|
802
|
-
onClick:
|
|
909
|
+
className: I("gvp-captions-menu-item", r === -1 && "is-active"),
|
|
910
|
+
onClick: b,
|
|
803
911
|
children: "Off"
|
|
804
912
|
}
|
|
805
913
|
) }),
|
|
@@ -809,23 +917,25 @@ const X = (() => {
|
|
|
809
917
|
type: "button",
|
|
810
918
|
role: "option",
|
|
811
919
|
"aria-selected": o.index === r,
|
|
812
|
-
className:
|
|
813
|
-
onClick: () =>
|
|
920
|
+
className: I("gvp-captions-menu-item", o.index === r && "is-active"),
|
|
921
|
+
onClick: () => C(o.index),
|
|
814
922
|
children: o.label
|
|
815
923
|
}
|
|
816
924
|
) }, o.index))
|
|
817
925
|
] })
|
|
818
926
|
] });
|
|
819
|
-
},
|
|
820
|
-
const [n, s] = k(!1);
|
|
821
|
-
if (
|
|
927
|
+
}, Xe = ({ video: e }) => {
|
|
928
|
+
const [n, s] = k(!1), [r, l] = k(!1);
|
|
929
|
+
if (M(() => {
|
|
930
|
+
l(!0);
|
|
931
|
+
}, []), M(() => {
|
|
822
932
|
if (!e) return;
|
|
823
|
-
const
|
|
824
|
-
return e.addEventListener("enterpictureinpicture",
|
|
825
|
-
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);
|
|
826
936
|
};
|
|
827
|
-
}, [e]), !document.pictureInPictureEnabled) return null;
|
|
828
|
-
const
|
|
937
|
+
}, [e]), !r || !document.pictureInPictureEnabled) return null;
|
|
938
|
+
const c = () => {
|
|
829
939
|
document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
|
|
830
940
|
}) : e == null || e.requestPictureInPicture().catch(() => {
|
|
831
941
|
});
|
|
@@ -834,20 +944,20 @@ const X = (() => {
|
|
|
834
944
|
"button",
|
|
835
945
|
{
|
|
836
946
|
type: "button",
|
|
837
|
-
className:
|
|
947
|
+
className: I("gvp-ctrl-btn", n && "is-active"),
|
|
838
948
|
"aria-label": n ? "Exit picture-in-picture" : "Picture-in-picture",
|
|
839
949
|
"aria-pressed": n,
|
|
840
|
-
onClick:
|
|
841
|
-
children: /* @__PURE__ */ t(
|
|
950
|
+
onClick: c,
|
|
951
|
+
children: /* @__PURE__ */ t(De, {})
|
|
842
952
|
}
|
|
843
953
|
);
|
|
844
|
-
},
|
|
954
|
+
}, Ge = ({ container: e, video: n }) => {
|
|
845
955
|
const [s, r] = k(!1);
|
|
846
|
-
return
|
|
847
|
-
if (
|
|
848
|
-
const
|
|
849
|
-
return
|
|
850
|
-
}, [e]),
|
|
956
|
+
return M(() => {
|
|
957
|
+
if (G) return;
|
|
958
|
+
const p = () => r(j.element() === e);
|
|
959
|
+
return p(), j.onChange(p);
|
|
960
|
+
}, [e]), j.isSupported() || G && n !== null && typeof n.webkitEnterFullscreen == "function" ? /* @__PURE__ */ t(
|
|
851
961
|
"button",
|
|
852
962
|
{
|
|
853
963
|
type: "button",
|
|
@@ -855,120 +965,146 @@ const X = (() => {
|
|
|
855
965
|
"aria-label": s ? "Exit fullscreen" : "Enter fullscreen",
|
|
856
966
|
"aria-pressed": s,
|
|
857
967
|
onClick: () => {
|
|
858
|
-
var
|
|
859
|
-
if (
|
|
860
|
-
(
|
|
968
|
+
var p;
|
|
969
|
+
if (G) {
|
|
970
|
+
(p = n == null ? void 0 : n.webkitEnterFullscreen) == null || p.call(n);
|
|
861
971
|
return;
|
|
862
972
|
}
|
|
863
|
-
s ?
|
|
864
|
-
}) : e &&
|
|
973
|
+
s ? j.exit().catch(() => {
|
|
974
|
+
}) : e && j.request(e).catch(() => {
|
|
865
975
|
});
|
|
866
976
|
},
|
|
867
|
-
children: /* @__PURE__ */ t(s ?
|
|
977
|
+
children: /* @__PURE__ */ t(s ? Ae : Ve, {})
|
|
868
978
|
}
|
|
869
979
|
) : null;
|
|
870
980
|
};
|
|
871
|
-
function
|
|
981
|
+
function oe(e, n, s) {
|
|
872
982
|
const r = e == null ? void 0 : e.trim();
|
|
873
983
|
if (r) return r;
|
|
874
984
|
if (n) {
|
|
875
985
|
try {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
986
|
+
const c = new Intl.DisplayNames(void 0, { type: "language" }).of(n);
|
|
987
|
+
if (c && c !== n) return c;
|
|
878
988
|
} catch {
|
|
879
989
|
}
|
|
880
990
|
return n;
|
|
881
991
|
}
|
|
882
992
|
return `Audio ${s + 1}`;
|
|
883
993
|
}
|
|
884
|
-
const
|
|
994
|
+
const le = we.forwardRef(
|
|
885
995
|
({
|
|
886
996
|
src: e,
|
|
887
997
|
hlsConfig: n,
|
|
888
998
|
isHls: s,
|
|
889
999
|
autoPlay: r,
|
|
890
1000
|
children: l,
|
|
891
|
-
onAudioTracks:
|
|
892
|
-
audioTrackIndex:
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
1001
|
+
onAudioTracks: c,
|
|
1002
|
+
audioTrackIndex: u,
|
|
1003
|
+
onQualityLevels: i,
|
|
1004
|
+
onCurrentLevel: p,
|
|
1005
|
+
qualityLevelIndex: d,
|
|
1006
|
+
...C
|
|
1007
|
+
}, b) => {
|
|
1008
|
+
const o = H(null), a = H(null), m = H(c);
|
|
1009
|
+
m.current = c;
|
|
1010
|
+
const f = H(i);
|
|
1011
|
+
f.current = i;
|
|
1012
|
+
const w = H(p);
|
|
1013
|
+
w.current = p, Le(b, () => o.current);
|
|
1014
|
+
const U = globalThis.window !== void 0 && $.isSupported(), V = !!s || U && typeof e == "string" && e.endsWith(".m3u8");
|
|
1015
|
+
return M(() => {
|
|
1016
|
+
var F, Z, q;
|
|
900
1017
|
if (!e) return;
|
|
901
|
-
const
|
|
902
|
-
if (!
|
|
903
|
-
const
|
|
904
|
-
var
|
|
905
|
-
(
|
|
906
|
-
},
|
|
907
|
-
|
|
1018
|
+
const v = o.current;
|
|
1019
|
+
if (!v) return;
|
|
1020
|
+
const S = (h) => {
|
|
1021
|
+
var L;
|
|
1022
|
+
(L = m.current) == null || L.call(m, h);
|
|
1023
|
+
}, T = (h) => {
|
|
1024
|
+
var L;
|
|
1025
|
+
(L = f.current) == null || L.call(f, h);
|
|
1026
|
+
}, D = (h) => {
|
|
1027
|
+
var L;
|
|
1028
|
+
(L = w.current) == null || L.call(w, h);
|
|
1029
|
+
}, W = () => {
|
|
1030
|
+
r && v.play().catch(() => {
|
|
908
1031
|
});
|
|
909
1032
|
};
|
|
910
|
-
for (
|
|
911
|
-
|
|
912
|
-
let
|
|
913
|
-
if (
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
const
|
|
917
|
-
const
|
|
918
|
-
index:
|
|
919
|
-
label:
|
|
920
|
-
lang:
|
|
1033
|
+
for (a.current && (a.current.destroy(), a.current = null), v.pause(), v.removeAttribute("src"); v.firstChild; ) v.firstChild.remove();
|
|
1034
|
+
S([]), T([]), D(-1);
|
|
1035
|
+
let R;
|
|
1036
|
+
if (V) {
|
|
1037
|
+
const h = new $(n);
|
|
1038
|
+
a.current = h;
|
|
1039
|
+
const L = () => {
|
|
1040
|
+
const N = h.audioTracks.map((y, _) => ({
|
|
1041
|
+
index: _,
|
|
1042
|
+
label: oe(y.name, y.lang, _),
|
|
1043
|
+
lang: y.lang || void 0
|
|
921
1044
|
}));
|
|
922
|
-
|
|
1045
|
+
S(N);
|
|
1046
|
+
}, B = () => {
|
|
1047
|
+
const N = h.levels.map((y, _) => ({
|
|
1048
|
+
index: _,
|
|
1049
|
+
height: y.height || 0,
|
|
1050
|
+
label: je(y.height || 0, _)
|
|
1051
|
+
}));
|
|
1052
|
+
T(N);
|
|
923
1053
|
};
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}),
|
|
1054
|
+
h.on($.Events.MANIFEST_PARSED, W), h.on($.Events.MANIFEST_PARSED, B), h.on($.Events.LEVELS_UPDATED, B), h.on($.Events.LEVEL_SWITCHED, (N, y) => {
|
|
1055
|
+
D(y.level);
|
|
1056
|
+
}), h.on($.Events.AUDIO_TRACKS_UPDATED, L), h.on($.Events.AUDIO_TRACK_SWITCHED, L), h.on($.Events.ERROR, (N, y) => {
|
|
1057
|
+
y.fatal && (h.destroy(), a.current = null);
|
|
1058
|
+
}), h.attachMedia(v), h.loadSource(e);
|
|
927
1059
|
} else {
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
932
|
-
const
|
|
933
|
-
for (let
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
index:
|
|
937
|
-
label:
|
|
938
|
-
lang:
|
|
1060
|
+
v.src = e, v.load(), v.addEventListener("loadedmetadata", W, { once: !0 });
|
|
1061
|
+
const h = v.audioTracks;
|
|
1062
|
+
if (h) {
|
|
1063
|
+
const L = () => {
|
|
1064
|
+
const B = [];
|
|
1065
|
+
for (let N = 0; N < h.length; N++) {
|
|
1066
|
+
const y = h[N];
|
|
1067
|
+
B.push({
|
|
1068
|
+
index: N,
|
|
1069
|
+
label: oe(y.label, y.language, N),
|
|
1070
|
+
lang: y.language || void 0
|
|
939
1071
|
});
|
|
940
1072
|
}
|
|
941
|
-
|
|
1073
|
+
S(B);
|
|
942
1074
|
};
|
|
943
|
-
(
|
|
944
|
-
var
|
|
945
|
-
(
|
|
1075
|
+
(F = h.addEventListener) == null || F.call(h, "addtrack", L), (Z = h.addEventListener) == null || Z.call(h, "removetrack", L), (q = h.addEventListener) == null || q.call(h, "change", L), h.length > 0 && L(), R = () => {
|
|
1076
|
+
var B, N, y;
|
|
1077
|
+
(B = h.removeEventListener) == null || B.call(h, "addtrack", L), (N = h.removeEventListener) == null || N.call(h, "removetrack", L), (y = h.removeEventListener) == null || y.call(h, "change", L);
|
|
946
1078
|
};
|
|
947
1079
|
}
|
|
948
1080
|
}
|
|
949
1081
|
return () => {
|
|
950
|
-
for (
|
|
951
|
-
|
|
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();
|
|
1083
|
+
v.load(), S([]), T([]), D(-1);
|
|
952
1084
|
};
|
|
953
|
-
}, [e,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1085
|
+
}, [e, V, n, r]), M(() => {
|
|
1086
|
+
if (d == null) return;
|
|
1087
|
+
const v = a.current;
|
|
1088
|
+
v && v.currentLevel !== d && (v.currentLevel = d);
|
|
1089
|
+
}, [d]), M(() => {
|
|
1090
|
+
var T;
|
|
1091
|
+
if (u == null || u < 0) return;
|
|
1092
|
+
const v = a.current;
|
|
1093
|
+
if (v) {
|
|
1094
|
+
v.audioTrack !== u && (v.audioTrack = u);
|
|
959
1095
|
return;
|
|
960
1096
|
}
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
963
|
-
for (let
|
|
964
|
-
|
|
965
|
-
}, [
|
|
1097
|
+
const S = (T = o.current) == null ? void 0 : T.audioTracks;
|
|
1098
|
+
if (S)
|
|
1099
|
+
for (let D = 0; D < S.length; D++)
|
|
1100
|
+
S[D].enabled = D === u;
|
|
1101
|
+
}, [u]), // Captions are the consumer's responsibility — pass <track> elements as children.
|
|
966
1102
|
// NOSONAR: typescript:S4084
|
|
967
|
-
/* @__PURE__ */ t("video", { ref:
|
|
1103
|
+
/* @__PURE__ */ t("video", { ref: o, ...C, children: l });
|
|
968
1104
|
}
|
|
969
1105
|
);
|
|
970
|
-
|
|
971
|
-
function
|
|
1106
|
+
le.displayName = "HLSPlayer";
|
|
1107
|
+
function et(e) {
|
|
972
1108
|
if (!e) return null;
|
|
973
1109
|
if (/^[A-Za-z0-9_-]{11}$/.test(e)) return e;
|
|
974
1110
|
let n;
|
|
@@ -992,49 +1128,49 @@ function Ue(e) {
|
|
|
992
1128
|
}
|
|
993
1129
|
return null;
|
|
994
1130
|
}
|
|
995
|
-
function
|
|
1131
|
+
function tt(e) {
|
|
996
1132
|
try {
|
|
997
1133
|
const n = new URL(e), s = n.searchParams.get("t") ?? n.searchParams.get("start");
|
|
998
1134
|
if (!s) return null;
|
|
999
1135
|
if (/^\d+s?$/.test(s)) return Number.parseInt(s, 10);
|
|
1000
1136
|
const r = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(s);
|
|
1001
1137
|
if (r) {
|
|
1002
|
-
const l = Number.parseInt(r[1] ?? "0", 10),
|
|
1003
|
-
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;
|
|
1004
1140
|
}
|
|
1005
1141
|
} catch {
|
|
1006
1142
|
}
|
|
1007
1143
|
return null;
|
|
1008
1144
|
}
|
|
1009
|
-
function
|
|
1010
|
-
const { autoPlay: s = !1, muted: r = !0, loop: l = !1, controls:
|
|
1145
|
+
function nt(e, n = {}) {
|
|
1146
|
+
const { autoPlay: s = !1, muted: r = !0, loop: l = !1, controls: c = !0, startSeconds: u } = n, i = new URLSearchParams({
|
|
1011
1147
|
rel: "0",
|
|
1012
1148
|
modestbranding: "1",
|
|
1013
1149
|
playsinline: "1",
|
|
1014
|
-
controls:
|
|
1150
|
+
controls: c ? "1" : "0"
|
|
1015
1151
|
});
|
|
1016
|
-
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()}`;
|
|
1017
1153
|
}
|
|
1018
|
-
const
|
|
1154
|
+
const rt = ({
|
|
1019
1155
|
tracks: e,
|
|
1020
1156
|
activeIndex: n,
|
|
1021
1157
|
onSelect: s
|
|
1022
1158
|
}) => {
|
|
1023
|
-
const [r, l] = k(!1),
|
|
1024
|
-
|
|
1159
|
+
const [r, l] = k(!1), c = H(null);
|
|
1160
|
+
M(() => {
|
|
1025
1161
|
if (!r) return;
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1028
|
-
},
|
|
1029
|
-
|
|
1162
|
+
const i = (d) => {
|
|
1163
|
+
c.current && !c.current.contains(d.target) && l(!1);
|
|
1164
|
+
}, p = (d) => {
|
|
1165
|
+
d.key === "Escape" && l(!1);
|
|
1030
1166
|
};
|
|
1031
|
-
return document.addEventListener("mousedown",
|
|
1032
|
-
document.removeEventListener("mousedown",
|
|
1167
|
+
return document.addEventListener("mousedown", i), document.addEventListener("keydown", p), () => {
|
|
1168
|
+
document.removeEventListener("mousedown", i), document.removeEventListener("keydown", p);
|
|
1033
1169
|
};
|
|
1034
1170
|
}, [r]);
|
|
1035
|
-
const
|
|
1036
|
-
return /* @__PURE__ */
|
|
1037
|
-
/* @__PURE__ */
|
|
1171
|
+
const u = e.find((i) => i.index === n) ?? e[0];
|
|
1172
|
+
return /* @__PURE__ */ g("div", { className: "gvp-audio", ref: c, children: [
|
|
1173
|
+
/* @__PURE__ */ g(
|
|
1038
1174
|
"button",
|
|
1039
1175
|
{
|
|
1040
1176
|
type: "button",
|
|
@@ -1042,11 +1178,11 @@ const Fe = ({
|
|
|
1042
1178
|
"aria-haspopup": "listbox",
|
|
1043
1179
|
"aria-expanded": r,
|
|
1044
1180
|
"aria-label": "Audio track",
|
|
1045
|
-
onClick: () => l((
|
|
1181
|
+
onClick: () => l((i) => !i),
|
|
1046
1182
|
children: [
|
|
1047
|
-
/* @__PURE__ */ t(
|
|
1048
|
-
/* @__PURE__ */ t("span", { className: "gvp-audio-label", children:
|
|
1049
|
-
/* @__PURE__ */ t(
|
|
1183
|
+
/* @__PURE__ */ t(Me, {}),
|
|
1184
|
+
/* @__PURE__ */ t("span", { className: "gvp-audio-label", children: u == null ? void 0 : u.label }),
|
|
1185
|
+
/* @__PURE__ */ t(Re, {})
|
|
1050
1186
|
]
|
|
1051
1187
|
}
|
|
1052
1188
|
),
|
|
@@ -1054,149 +1190,154 @@ const Fe = ({
|
|
|
1054
1190
|
// (it renders the OS dropdown chrome), so this is a custom listbox with
|
|
1055
1191
|
// full keyboard + ARIA support.
|
|
1056
1192
|
// NOSONAR: typescript:S6819
|
|
1057
|
-
/* @__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(
|
|
1058
1194
|
"button",
|
|
1059
1195
|
{
|
|
1060
1196
|
type: "button",
|
|
1061
1197
|
role: "option",
|
|
1062
|
-
"aria-selected":
|
|
1063
|
-
className:
|
|
1198
|
+
"aria-selected": i.index === n,
|
|
1199
|
+
className: I(
|
|
1064
1200
|
"gvp-audio-menu-item",
|
|
1065
|
-
|
|
1201
|
+
i.index === n && "is-active"
|
|
1066
1202
|
),
|
|
1067
1203
|
onClick: () => {
|
|
1068
|
-
s(
|
|
1204
|
+
s(i.index), l(!1);
|
|
1069
1205
|
},
|
|
1070
|
-
children:
|
|
1206
|
+
children: i.label
|
|
1071
1207
|
}
|
|
1072
|
-
) },
|
|
1208
|
+
) }, i.index)) })
|
|
1073
1209
|
] });
|
|
1074
|
-
},
|
|
1210
|
+
}, lt = ({
|
|
1075
1211
|
src: e,
|
|
1076
1212
|
poster: n,
|
|
1077
1213
|
showDeviceToggle: s = !0,
|
|
1078
1214
|
defaultDevice: r = "desktop",
|
|
1079
1215
|
hoverPlay: l = !1,
|
|
1080
|
-
tooltipText:
|
|
1081
|
-
onClose:
|
|
1082
|
-
className:
|
|
1083
|
-
muted:
|
|
1084
|
-
loop:
|
|
1085
|
-
controls:
|
|
1086
|
-
autoPlay:
|
|
1087
|
-
frameMaxWidth:
|
|
1088
|
-
aspectRatio:
|
|
1089
|
-
hlsConfig:
|
|
1090
|
-
children:
|
|
1216
|
+
tooltipText: c,
|
|
1217
|
+
onClose: u,
|
|
1218
|
+
className: i = "",
|
|
1219
|
+
muted: p = !0,
|
|
1220
|
+
loop: d = !1,
|
|
1221
|
+
controls: C = !0,
|
|
1222
|
+
autoPlay: b = !1,
|
|
1223
|
+
frameMaxWidth: o,
|
|
1224
|
+
aspectRatio: a,
|
|
1225
|
+
hlsConfig: m,
|
|
1226
|
+
children: f
|
|
1091
1227
|
}) => {
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
}, []),
|
|
1095
|
-
() =>
|
|
1096
|
-
autoPlay:
|
|
1097
|
-
muted:
|
|
1098
|
-
loop:
|
|
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) => {
|
|
1229
|
+
w.current = E, de(E);
|
|
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(
|
|
1231
|
+
() => Q ? nt(Q, {
|
|
1232
|
+
autoPlay: b,
|
|
1233
|
+
muted: p,
|
|
1234
|
+
loop: d,
|
|
1099
1235
|
// Custom controls can't drive an iframe, so YouTube falls
|
|
1100
1236
|
// back to its own controls in that mode.
|
|
1101
|
-
controls:
|
|
1102
|
-
startSeconds:
|
|
1237
|
+
controls: O ? !0 : J,
|
|
1238
|
+
startSeconds: tt(e)
|
|
1103
1239
|
}) : null,
|
|
1104
|
-
[
|
|
1105
|
-
),
|
|
1106
|
-
|
|
1107
|
-
}, []),
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1240
|
+
[Q, e, b, p, d, O, J]
|
|
1241
|
+
), ge = P((E) => {
|
|
1242
|
+
F(E), q(-1);
|
|
1243
|
+
}, []), ve = P((E) => {
|
|
1244
|
+
L(E), _(-1);
|
|
1245
|
+
}, []), Y = P(async () => {
|
|
1246
|
+
const E = w.current;
|
|
1247
|
+
if (E) {
|
|
1248
|
+
if (U.current)
|
|
1111
1249
|
try {
|
|
1112
|
-
await
|
|
1250
|
+
await U.current;
|
|
1113
1251
|
} catch {
|
|
1114
1252
|
}
|
|
1115
|
-
|
|
1253
|
+
E.pause();
|
|
1116
1254
|
}
|
|
1117
|
-
}, []),
|
|
1118
|
-
const
|
|
1119
|
-
if (
|
|
1255
|
+
}, []), z = P(async () => {
|
|
1256
|
+
const E = w.current;
|
|
1257
|
+
if (E)
|
|
1120
1258
|
try {
|
|
1121
|
-
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1259
|
+
E.readyState < 2 && E.load();
|
|
1260
|
+
const te = E.play();
|
|
1261
|
+
U.current = te, await te, T(!0);
|
|
1124
1262
|
} catch {
|
|
1125
|
-
|
|
1263
|
+
T(!1);
|
|
1126
1264
|
} finally {
|
|
1127
|
-
|
|
1265
|
+
U.current = null;
|
|
1128
1266
|
}
|
|
1129
|
-
}, []),
|
|
1130
|
-
!l ||
|
|
1131
|
-
}, [l,
|
|
1132
|
-
!l ||
|
|
1133
|
-
}, [l,
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
}, [
|
|
1267
|
+
}, []), ke = P(() => {
|
|
1268
|
+
!l || A || z();
|
|
1269
|
+
}, [l, A, z]), be = P(() => {
|
|
1270
|
+
!l || A || Y().then(() => T(!1));
|
|
1271
|
+
}, [l, A, Y]), X = P(async () => {
|
|
1272
|
+
const E = w.current;
|
|
1273
|
+
E && (E.paused ? await z() : (await Y(), T(!1)));
|
|
1274
|
+
}, [z, Y]), Ce = !A && R.length > 1;
|
|
1137
1275
|
return (
|
|
1138
1276
|
// The mouse handlers are a progressive enhancement (hoverPlay + tooltip).
|
|
1139
1277
|
// Keyboard/click users reach the same actions via the inner <button> elements,
|
|
1140
1278
|
// so the outer container is intentionally non-interactive at the role level.
|
|
1141
1279
|
// NOSONAR: typescript:S6848
|
|
1142
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ g(
|
|
1143
1281
|
"div",
|
|
1144
1282
|
{
|
|
1145
|
-
ref:
|
|
1146
|
-
className:
|
|
1147
|
-
style: { width:
|
|
1283
|
+
ref: ce,
|
|
1284
|
+
className: I("gvp-root", i),
|
|
1285
|
+
style: { width: me, aspectRatio: pe },
|
|
1148
1286
|
onMouseEnter: () => {
|
|
1149
|
-
|
|
1287
|
+
W(!0), ke();
|
|
1150
1288
|
},
|
|
1151
1289
|
onMouseLeave: () => {
|
|
1152
|
-
|
|
1290
|
+
W(!1), be();
|
|
1153
1291
|
},
|
|
1154
1292
|
children: [
|
|
1155
|
-
|
|
1293
|
+
A ? /* @__PURE__ */ t(
|
|
1156
1294
|
"iframe",
|
|
1157
1295
|
{
|
|
1158
1296
|
className: "gvp-video gvp-youtube",
|
|
1159
|
-
src:
|
|
1297
|
+
src: fe ?? void 0,
|
|
1160
1298
|
title: "YouTube video player",
|
|
1161
1299
|
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
|
|
1162
1300
|
allowFullScreen: !0,
|
|
1163
1301
|
referrerPolicy: "strict-origin-when-cross-origin"
|
|
1164
1302
|
}
|
|
1165
1303
|
) : /* @__PURE__ */ t(
|
|
1166
|
-
|
|
1304
|
+
le,
|
|
1167
1305
|
{
|
|
1168
|
-
ref:
|
|
1306
|
+
ref: he,
|
|
1169
1307
|
src: e,
|
|
1170
1308
|
poster: n,
|
|
1171
|
-
muted:
|
|
1172
|
-
loop:
|
|
1309
|
+
muted: p,
|
|
1310
|
+
loop: d,
|
|
1173
1311
|
playsInline: !0,
|
|
1174
1312
|
preload: "metadata",
|
|
1175
|
-
controls:
|
|
1176
|
-
autoPlay:
|
|
1177
|
-
hlsConfig:
|
|
1313
|
+
controls: J,
|
|
1314
|
+
autoPlay: b,
|
|
1315
|
+
hlsConfig: m,
|
|
1178
1316
|
className: "gvp-video",
|
|
1179
|
-
onPlay: () =>
|
|
1180
|
-
onPause: () =>
|
|
1181
|
-
onAudioTracks:
|
|
1182
|
-
audioTrackIndex:
|
|
1183
|
-
|
|
1317
|
+
onPlay: () => T(!0),
|
|
1318
|
+
onPause: () => T(!1),
|
|
1319
|
+
onAudioTracks: ge,
|
|
1320
|
+
audioTrackIndex: Z,
|
|
1321
|
+
onQualityLevels: ve,
|
|
1322
|
+
onCurrentLevel: N,
|
|
1323
|
+
qualityLevelIndex: y,
|
|
1324
|
+
children: f
|
|
1184
1325
|
}
|
|
1185
1326
|
),
|
|
1186
|
-
!
|
|
1187
|
-
s && /* @__PURE__ */ t("div", { className: "gvp-toggle", children: /* @__PURE__ */
|
|
1327
|
+
!A && /* @__PURE__ */ t("div", { className: "gvp-vignette" }),
|
|
1328
|
+
s && /* @__PURE__ */ t("div", { className: "gvp-toggle", children: /* @__PURE__ */ g("div", { className: "gvp-toggle-pill", children: [
|
|
1188
1329
|
/* @__PURE__ */ t(
|
|
1189
1330
|
"button",
|
|
1190
1331
|
{
|
|
1191
1332
|
type: "button",
|
|
1192
|
-
onClick: () =>
|
|
1193
|
-
className:
|
|
1333
|
+
onClick: () => v("desktop"),
|
|
1334
|
+
className: I(
|
|
1194
1335
|
"gvp-toggle-btn",
|
|
1195
|
-
|
|
1336
|
+
V === "desktop" && "is-active"
|
|
1196
1337
|
),
|
|
1197
1338
|
"aria-label": "Desktop view",
|
|
1198
|
-
"aria-pressed":
|
|
1199
|
-
children: /* @__PURE__ */ t(
|
|
1339
|
+
"aria-pressed": V === "desktop",
|
|
1340
|
+
children: /* @__PURE__ */ t(ye, {})
|
|
1200
1341
|
}
|
|
1201
1342
|
),
|
|
1202
1343
|
/* @__PURE__ */ t("div", { className: "gvp-toggle-divider" }),
|
|
@@ -1204,78 +1345,82 @@ const Fe = ({
|
|
|
1204
1345
|
"button",
|
|
1205
1346
|
{
|
|
1206
1347
|
type: "button",
|
|
1207
|
-
onClick: () =>
|
|
1208
|
-
className:
|
|
1348
|
+
onClick: () => v("mobile"),
|
|
1349
|
+
className: I(
|
|
1209
1350
|
"gvp-toggle-btn",
|
|
1210
|
-
|
|
1351
|
+
V === "mobile" && "is-active"
|
|
1211
1352
|
),
|
|
1212
1353
|
"aria-label": "Mobile view",
|
|
1213
|
-
"aria-pressed":
|
|
1214
|
-
children: /* @__PURE__ */ t(
|
|
1354
|
+
"aria-pressed": V === "mobile",
|
|
1355
|
+
children: /* @__PURE__ */ t(Ee, {})
|
|
1215
1356
|
}
|
|
1216
1357
|
)
|
|
1217
1358
|
] }) }),
|
|
1218
|
-
|
|
1359
|
+
u && /* @__PURE__ */ t(
|
|
1219
1360
|
"button",
|
|
1220
1361
|
{
|
|
1221
1362
|
type: "button",
|
|
1222
|
-
onClick:
|
|
1363
|
+
onClick: u,
|
|
1223
1364
|
className: "gvp-close",
|
|
1224
1365
|
"aria-label": "Close",
|
|
1225
|
-
children: /* @__PURE__ */ t(
|
|
1366
|
+
children: /* @__PURE__ */ t(xe, {})
|
|
1226
1367
|
}
|
|
1227
1368
|
),
|
|
1228
|
-
|
|
1229
|
-
|
|
1369
|
+
Ce && /* @__PURE__ */ t(
|
|
1370
|
+
rt,
|
|
1230
1371
|
{
|
|
1231
|
-
tracks:
|
|
1232
|
-
activeIndex:
|
|
1233
|
-
onSelect:
|
|
1372
|
+
tracks: R,
|
|
1373
|
+
activeIndex: Z >= 0 ? Z : R[0].index,
|
|
1374
|
+
onSelect: q
|
|
1234
1375
|
}
|
|
1235
1376
|
),
|
|
1236
|
-
!
|
|
1377
|
+
!A && O && /* @__PURE__ */ t(
|
|
1237
1378
|
"button",
|
|
1238
1379
|
{
|
|
1239
1380
|
type: "button",
|
|
1240
1381
|
className: "gvp-click-layer",
|
|
1241
|
-
onClick: () => void
|
|
1242
|
-
"aria-label":
|
|
1382
|
+
onClick: () => void X(),
|
|
1383
|
+
"aria-label": S ? "Pause" : "Play"
|
|
1243
1384
|
}
|
|
1244
1385
|
),
|
|
1245
|
-
!
|
|
1386
|
+
!A && !O && !S && /* @__PURE__ */ t("div", { className: "gvp-play-wrap", children: /* @__PURE__ */ g(
|
|
1246
1387
|
"button",
|
|
1247
1388
|
{
|
|
1248
1389
|
type: "button",
|
|
1249
|
-
onClick: () => void
|
|
1250
|
-
onMouseEnter: () =>
|
|
1251
|
-
onMouseLeave: () =>
|
|
1390
|
+
onClick: () => void X(),
|
|
1391
|
+
onMouseEnter: () => W(!0),
|
|
1392
|
+
onMouseLeave: () => W(!1),
|
|
1252
1393
|
className: "gvp-play",
|
|
1253
1394
|
"aria-label": "Play",
|
|
1254
1395
|
children: [
|
|
1255
|
-
/* @__PURE__ */ t(
|
|
1256
|
-
|
|
1396
|
+
/* @__PURE__ */ t(Ne, {}),
|
|
1397
|
+
c && D && /* @__PURE__ */ t("span", { className: "gvp-tooltip", role: "tooltip", children: c })
|
|
1257
1398
|
]
|
|
1258
1399
|
}
|
|
1259
1400
|
) }),
|
|
1260
|
-
!
|
|
1261
|
-
|
|
1401
|
+
!A && O && /* @__PURE__ */ t(
|
|
1402
|
+
Ze,
|
|
1262
1403
|
{
|
|
1263
|
-
video:
|
|
1264
|
-
isPlaying:
|
|
1265
|
-
container:
|
|
1266
|
-
onTogglePlay: () => void
|
|
1404
|
+
video: ue,
|
|
1405
|
+
isPlaying: S,
|
|
1406
|
+
container: ie,
|
|
1407
|
+
onTogglePlay: () => void X(),
|
|
1408
|
+
qualityLevels: h,
|
|
1409
|
+
currentLevel: B,
|
|
1410
|
+
selectedLevel: y,
|
|
1411
|
+
onSelectLevel: _
|
|
1267
1412
|
}
|
|
1268
1413
|
),
|
|
1269
|
-
!
|
|
1414
|
+
!A && !O && /* @__PURE__ */ t("div", { className: "gvp-bottom-fade" })
|
|
1270
1415
|
]
|
|
1271
1416
|
}
|
|
1272
1417
|
)
|
|
1273
1418
|
);
|
|
1274
1419
|
};
|
|
1275
1420
|
export {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1421
|
+
lt as ReactVideoPlayer,
|
|
1422
|
+
et as parseYouTubeId,
|
|
1423
|
+
tt as parseYouTubeStart,
|
|
1424
|
+
nt as youTubeEmbedUrl
|
|
1280
1425
|
};
|
|
1281
1426
|
//# sourceMappingURL=index.mjs.map
|