@banou/media-player 0.10.22 → 0.10.24
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 +4 -2
- package/dist/engine/index.js +1 -1
- package/dist/{engine-Cr_7OImR.js → engine-BdouHadr.js} +6 -6
- package/dist/index.js +287 -236
- package/dist/react/hooks/use-frame-step.d.ts +14 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +4 -0
- package/package.json +3 -3
- package/src/lib/engine/playback.ts +16 -7
- package/src/lib/engine/subtitles.ts +11 -7
- package/src/lib/react/components/control-bar.tsx +6 -1
- package/src/lib/react/hooks/use-frame-step.ts +109 -0
- package/src/lib/react/source-feature.ts +3 -0
- package/src/lib/react/video-player.tsx +2 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t, n, o as r, r as i, s as a, t as o, u as s } from "./engine-
|
|
1
|
+
import { c as e, l as t, n, o as r, r as i, s as a, t as o, u as s } from "./engine-BdouHadr.js";
|
|
2
2
|
import { Children as c, Fragment as l, isValidElement as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
3
3
|
import { css as _, keyframes as v } from "@emotion/react";
|
|
4
4
|
import { createPlayer as y, useContainerAttach as b, useMediaAttach as x } from "@videojs/react";
|
|
@@ -269,13 +269,63 @@ var U = {
|
|
|
269
269
|
b,
|
|
270
270
|
E
|
|
271
271
|
]);
|
|
272
|
-
}, ue =
|
|
272
|
+
}, ue = 1001 / 24e3, de = (e, t) => new Promise((n) => {
|
|
273
|
+
let r = setTimeout(n, t);
|
|
274
|
+
e.requestVideoFrameCallback(() => {
|
|
275
|
+
clearTimeout(r), n();
|
|
276
|
+
});
|
|
277
|
+
}), fe = (e) => {
|
|
278
|
+
let t = K(), n = K((e) => e.setSourceState);
|
|
279
|
+
f(() => {
|
|
280
|
+
let r = e;
|
|
281
|
+
if (!r || typeof r.requestVideoFrameCallback != "function") return;
|
|
282
|
+
let i, a = !1, o = [], s = () => {
|
|
283
|
+
a = !0, i = void 0;
|
|
284
|
+
}, c = () => {
|
|
285
|
+
i = void 0, o.length = 0;
|
|
286
|
+
};
|
|
287
|
+
r.addEventListener("seeking", s), r.addEventListener("emptied", c);
|
|
288
|
+
let l = 0, u = (e, t) => {
|
|
289
|
+
let n = a;
|
|
290
|
+
!r.paused && !r.seeking && (a = !1), !n && !r.paused && r.playbackRate <= 1 && i && t.presentedFrames === i.presentedFrames + 1 && t.mediaTime > i.mediaTime && (o.push(t.mediaTime - i.mediaTime), o.length > 60 && o.shift()), i = n ? void 0 : t, l = r.requestVideoFrameCallback(u);
|
|
291
|
+
};
|
|
292
|
+
l = r.requestVideoFrameCallback(u);
|
|
293
|
+
let d = () => {
|
|
294
|
+
if (o.length < 5) return ue;
|
|
295
|
+
let e = [...o].sort((e, t) => e - t), t = e[e.length >> 1], n = e.filter((e) => Math.abs(e - t) <= t / 4);
|
|
296
|
+
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
297
|
+
}, f = !1;
|
|
298
|
+
return n({ stepFrame: async (e) => {
|
|
299
|
+
if (!f) {
|
|
300
|
+
f = !0;
|
|
301
|
+
try {
|
|
302
|
+
r.paused || (r.pause(), await de(r, 100));
|
|
303
|
+
let n = d(), a = t.state.seekingTo, o = a === void 0 ? i ? i.mediaTime + (e > 0 ? 1.5 : -.5) * n : r.currentTime + e * n : a + e * n, s = Math.max(0, Math.min(o, r.duration || o)), c = new Promise((e) => {
|
|
304
|
+
let t = setTimeout(e, 1e3);
|
|
305
|
+
r.addEventListener("seeked", () => {
|
|
306
|
+
clearTimeout(t), e();
|
|
307
|
+
}, { once: !0 });
|
|
308
|
+
}), { requestSeek: l } = t.state;
|
|
309
|
+
l ? l(s) : r.currentTime = s, await c;
|
|
310
|
+
} finally {
|
|
311
|
+
f = !1;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
} }), () => {
|
|
315
|
+
r.removeEventListener("seeking", s), r.removeEventListener("emptied", c), r.cancelVideoFrameCallback(l), n({ stepFrame: void 0 });
|
|
316
|
+
};
|
|
317
|
+
}, [
|
|
318
|
+
e,
|
|
319
|
+
t,
|
|
320
|
+
n
|
|
321
|
+
]);
|
|
322
|
+
}, pe = 5e3, me = 6e4, he = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
273
323
|
let [o, s] = h([]), c = m(null), l = m(r);
|
|
274
324
|
l.current = r;
|
|
275
325
|
let u = p(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = m(u);
|
|
276
326
|
return g.current = u, f(() => {
|
|
277
327
|
if (!n || !r || !e || !t) return;
|
|
278
|
-
let a = !1, o = null, u, d =
|
|
328
|
+
let a = !1, o = null, u, d = pe, f = () => {
|
|
279
329
|
i({
|
|
280
330
|
publicPath: e,
|
|
281
331
|
workerUrl: t,
|
|
@@ -291,7 +341,7 @@ var U = {
|
|
|
291
341
|
}
|
|
292
342
|
o = e, c.current = e, e.update(g.current);
|
|
293
343
|
}, () => {
|
|
294
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
344
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, me));
|
|
295
345
|
});
|
|
296
346
|
};
|
|
297
347
|
return f(), () => {
|
|
@@ -309,7 +359,7 @@ var U = {
|
|
|
309
359
|
c.current?.prioritize(e);
|
|
310
360
|
}, [])
|
|
311
361
|
};
|
|
312
|
-
},
|
|
362
|
+
}, ge = (e, t) => {
|
|
313
363
|
let r = m(null), [i, a] = h(!1), [s] = h(() => n());
|
|
314
364
|
f(() => {
|
|
315
365
|
if (!e || !t || !s) return;
|
|
@@ -337,10 +387,10 @@ var U = {
|
|
|
337
387
|
mode: s,
|
|
338
388
|
burnedIn: i
|
|
339
389
|
};
|
|
340
|
-
},
|
|
341
|
-
let t =
|
|
390
|
+
}, _e = "(hover: hover) and (pointer: fine)", ve = () => typeof matchMedia == "function" ? matchMedia(_e) : void 0, ye = (e) => {
|
|
391
|
+
let t = ve();
|
|
342
392
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
343
|
-
},
|
|
393
|
+
}, be = () => !!ve()?.matches, xe = () => !1, Se = (e, t) => {
|
|
344
394
|
let [n, r] = h(!1), [i, a] = h(), o = m(t);
|
|
345
395
|
t && (o.current = t);
|
|
346
396
|
let s = m(!1), c = d((e) => {
|
|
@@ -363,7 +413,7 @@ var U = {
|
|
|
363
413
|
_,
|
|
364
414
|
u
|
|
365
415
|
]);
|
|
366
|
-
let v = g(
|
|
416
|
+
let v = g(ye, be, xe), [y, b] = h(!1);
|
|
367
417
|
f(() => {
|
|
368
418
|
if (!_) return;
|
|
369
419
|
let e = (e) => {
|
|
@@ -404,16 +454,16 @@ var U = {
|
|
|
404
454
|
u,
|
|
405
455
|
S
|
|
406
456
|
]);
|
|
407
|
-
},
|
|
457
|
+
}, Ce = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
408
458
|
channelCountMode: "max",
|
|
409
459
|
processorOptions: n
|
|
410
|
-
})),
|
|
460
|
+
})), we = /* @__PURE__ */ new WeakMap(), Te = (e) => new Promise((t, n) => {
|
|
411
461
|
let r = () => {
|
|
412
462
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
413
463
|
};
|
|
414
464
|
e.addEventListener("statechange", r), r();
|
|
415
|
-
}),
|
|
416
|
-
let r =
|
|
465
|
+
}), Ee = (e, t, n = {}) => {
|
|
466
|
+
let r = we.get(e);
|
|
417
467
|
if (r) return r.wake(), r;
|
|
418
468
|
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), l = e.ownerDocument, u = () => {
|
|
419
469
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -429,12 +479,12 @@ var U = {
|
|
|
429
479
|
};
|
|
430
480
|
i.addEventListener("statechange", f), f();
|
|
431
481
|
let p = (async () => {
|
|
432
|
-
let r = await
|
|
482
|
+
let r = await Ce(i, t, {
|
|
433
483
|
...n,
|
|
434
484
|
enabled: a,
|
|
435
485
|
inputGainDb: c()
|
|
436
486
|
});
|
|
437
|
-
await
|
|
487
|
+
await Te(i);
|
|
438
488
|
let s = T(i, e);
|
|
439
489
|
return r.port.postMessage({
|
|
440
490
|
enabled: a,
|
|
@@ -451,14 +501,14 @@ var U = {
|
|
|
451
501
|
a = e, o?.port.postMessage({ enabled: a });
|
|
452
502
|
},
|
|
453
503
|
release: () => {
|
|
454
|
-
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
504
|
+
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (we.delete(e), i.close().catch(() => {}));
|
|
455
505
|
},
|
|
456
506
|
wake: () => {
|
|
457
507
|
i.state !== "closed" && (s = !1, u(), f());
|
|
458
508
|
}
|
|
459
509
|
};
|
|
460
|
-
return
|
|
461
|
-
},
|
|
510
|
+
return we.set(e, m), m;
|
|
511
|
+
}, De = 20, Oe = 5, ke = 1, Ae = 50, je = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
462
512
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
463
513
|
for (let e of [...c]) e();
|
|
464
514
|
c.clear();
|
|
@@ -505,7 +555,7 @@ var U = {
|
|
|
505
555
|
}), S = () => p.postMessage({
|
|
506
556
|
type: "playhead",
|
|
507
557
|
time: n.currentTime
|
|
508
|
-
}), C = setInterval(x,
|
|
558
|
+
}), C = setInterval(x, Ae), T = [
|
|
509
559
|
"play",
|
|
510
560
|
"playing",
|
|
511
561
|
"pause",
|
|
@@ -522,7 +572,7 @@ var U = {
|
|
|
522
572
|
return t >= (h.end ?? E) - .05 ? null : t;
|
|
523
573
|
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
524
574
|
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
525
|
-
if (t !== null && t < e +
|
|
575
|
+
if (t !== null && t < e + De) return r && A <= t + 1 && t <= j + Oe ? "read" : P(t);
|
|
526
576
|
if (r) return "read";
|
|
527
577
|
let i = t ?? N(0);
|
|
528
578
|
return i === null ? "done" : P(i);
|
|
@@ -586,7 +636,7 @@ var U = {
|
|
|
586
636
|
await H(e), e.finished && await V(!0);
|
|
587
637
|
} else {
|
|
588
638
|
await V(!1), M.set(Math.round(e * 10), g);
|
|
589
|
-
let t = B.seek(Math.max(0, e -
|
|
639
|
+
let t = B.seek(Math.max(0, e - ke));
|
|
590
640
|
f(!0);
|
|
591
641
|
let n = await L(t);
|
|
592
642
|
if (a) return;
|
|
@@ -656,12 +706,12 @@ var U = {
|
|
|
656
706
|
},
|
|
657
707
|
stop: U
|
|
658
708
|
};
|
|
659
|
-
},
|
|
709
|
+
}, Me = (e, t, n, r, i) => {
|
|
660
710
|
let a = m(null), [o, s] = h(!1), [c, l] = h(null);
|
|
661
711
|
f(() => {
|
|
662
712
|
if (e && t) {
|
|
663
713
|
if (n && !a.current) {
|
|
664
|
-
let r =
|
|
714
|
+
let r = Ee(e, t, { enabled: n });
|
|
665
715
|
a.current = r, r.routed.then((e) => {
|
|
666
716
|
a.current === r && l(e);
|
|
667
717
|
}, (e) => {
|
|
@@ -685,7 +735,7 @@ var U = {
|
|
|
685
735
|
return f(() => {
|
|
686
736
|
let r = p.current;
|
|
687
737
|
if (!c || !e || !t || !n || !r) return;
|
|
688
|
-
let i =
|
|
738
|
+
let i = je({
|
|
689
739
|
node: c,
|
|
690
740
|
element: e,
|
|
691
741
|
scriptUrl: t,
|
|
@@ -707,7 +757,7 @@ var U = {
|
|
|
707
757
|
]), f(() => {
|
|
708
758
|
d.current?.update(i);
|
|
709
759
|
}, [i]), { refused: o };
|
|
710
|
-
},
|
|
760
|
+
}, Ne = () => {
|
|
711
761
|
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
712
762
|
return {
|
|
713
763
|
push: (n) => {
|
|
@@ -756,7 +806,7 @@ var U = {
|
|
|
756
806
|
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 ",
|
|
757
807
|
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 "
|
|
758
808
|
}
|
|
759
|
-
},
|
|
809
|
+
}, Pe = _`
|
|
760
810
|
display: flex;
|
|
761
811
|
justify-content: center;
|
|
762
812
|
align-items: center;
|
|
@@ -769,7 +819,7 @@ var U = {
|
|
|
769
819
|
margin: auto;
|
|
770
820
|
pointer-events: none;
|
|
771
821
|
}
|
|
772
|
-
`,
|
|
822
|
+
`, Fe = _`
|
|
773
823
|
position: absolute;
|
|
774
824
|
top: 0;
|
|
775
825
|
left: 0;
|
|
@@ -798,9 +848,9 @@ var U = {
|
|
|
798
848
|
|
|
799
849
|
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%);
|
|
800
850
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
801
|
-
`,
|
|
851
|
+
`, Ie = v`
|
|
802
852
|
to { transform: rotate(360deg); }
|
|
803
|
-
`,
|
|
853
|
+
`, Le = _`
|
|
804
854
|
position: absolute;
|
|
805
855
|
inset: 0;
|
|
806
856
|
z-index: 2;
|
|
@@ -816,9 +866,9 @@ var U = {
|
|
|
816
866
|
border-radius: 50%;
|
|
817
867
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
818
868
|
border-top-color: #fff;
|
|
819
|
-
animation: ${
|
|
869
|
+
animation: ${Ie} 0.8s linear infinite;
|
|
820
870
|
}
|
|
821
|
-
`,
|
|
871
|
+
`, Re = _`
|
|
822
872
|
position: absolute;
|
|
823
873
|
inset: auto 0 20%;
|
|
824
874
|
z-index: 3;
|
|
@@ -828,34 +878,34 @@ var U = {
|
|
|
828
878
|
${Z.bLarge.regular}
|
|
829
879
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
830
880
|
pointer-events: none;
|
|
831
|
-
`,
|
|
881
|
+
`, ze = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Be = ({ onSubtitleRef: e }) => {
|
|
832
882
|
let t = K((e) => e.title), n = K((e) => e.hideUI), r = K((e) => e.playbackError), i = K((e) => e.ready), a = K((e) => e.size), o = K((e) => e.waiting), s = K((e) => e.seekingTo);
|
|
833
883
|
return /* @__PURE__ */ O(E, { children: [
|
|
834
884
|
t ? /* @__PURE__ */ D("div", {
|
|
835
885
|
className: "title",
|
|
836
|
-
css:
|
|
886
|
+
css: Fe,
|
|
837
887
|
style: { ...n ? {
|
|
838
888
|
opacity: "0",
|
|
839
889
|
pointerEvents: "none"
|
|
840
890
|
} : {} },
|
|
841
891
|
children: t
|
|
842
892
|
}) : void 0,
|
|
843
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css:
|
|
893
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Le }) : void 0,
|
|
844
894
|
r ? /* @__PURE__ */ D("div", {
|
|
845
|
-
css:
|
|
846
|
-
children:
|
|
895
|
+
css: Re,
|
|
896
|
+
children: ze(r)
|
|
847
897
|
}) : void 0,
|
|
848
898
|
/* @__PURE__ */ D("div", {
|
|
849
899
|
className: "subtitles",
|
|
850
900
|
ref: e,
|
|
851
|
-
css:
|
|
901
|
+
css: Pe
|
|
852
902
|
})
|
|
853
903
|
] });
|
|
854
|
-
},
|
|
904
|
+
}, Ve = 1e-4, He = 1, Ue = (e) => Math.max(Ve, Math.min(He, e)) ** 2, We = (e) => Math.max(Ve, Math.min(He, e)) ** (He / 2), Ge = (e) => {
|
|
855
905
|
if (e === void 0) return "0:00";
|
|
856
906
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
857
907
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
858
|
-
},
|
|
908
|
+
}, Ke = (e, t) => `${Ge(e)} / ${Ge(t)}`, qe = (e) => _`
|
|
859
909
|
display: flex;
|
|
860
910
|
justify-content: flex-start;
|
|
861
911
|
|
|
@@ -903,17 +953,17 @@ var U = {
|
|
|
903
953
|
x: -1,
|
|
904
954
|
y: -1,
|
|
905
955
|
anchors: 0
|
|
906
|
-
},
|
|
956
|
+
}, Je = (e) => {
|
|
907
957
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
908
|
-
},
|
|
958
|
+
}, Ye = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Je, {
|
|
909
959
|
capture: !0,
|
|
910
960
|
passive: !0
|
|
911
961
|
}), () => {
|
|
912
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
962
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", Je, { capture: !0 });
|
|
913
963
|
}), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
914
964
|
let l = m(null), u = m(null);
|
|
915
965
|
return f(() => {
|
|
916
|
-
let e =
|
|
966
|
+
let e = Ye(), t = () => {
|
|
917
967
|
let e = l.current;
|
|
918
968
|
if (!e) return;
|
|
919
969
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -935,12 +985,12 @@ var U = {
|
|
|
935
985
|
children: n
|
|
936
986
|
}), !s && /* @__PURE__ */ D(ne, {
|
|
937
987
|
ref: u,
|
|
938
|
-
css:
|
|
988
|
+
css: qe(c),
|
|
939
989
|
id: e,
|
|
940
990
|
noArrow: !0,
|
|
941
991
|
children: t
|
|
942
992
|
})] });
|
|
943
|
-
},
|
|
993
|
+
}, Xe = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
944
994
|
let [i, a] = h(!1), o = m(t);
|
|
945
995
|
o.current = t;
|
|
946
996
|
let s = m(null), c = d((t, r) => {
|
|
@@ -979,26 +1029,26 @@ var U = {
|
|
|
979
1029
|
style: { touchAction: "none" }
|
|
980
1030
|
}
|
|
981
1031
|
};
|
|
982
|
-
},
|
|
1032
|
+
}, Ze = 2, Qe = .005, $e = "#000", et = "#0000", tt = (e, t) => {
|
|
983
1033
|
if (!t) return [];
|
|
984
1034
|
let n = /* @__PURE__ */ new Set();
|
|
985
1035
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
986
1036
|
let r = e / t;
|
|
987
|
-
r <=
|
|
1037
|
+
r <= Qe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
988
1038
|
}
|
|
989
1039
|
return n.size ? [
|
|
990
1040
|
0,
|
|
991
1041
|
...[...n].sort((e, t) => e - t),
|
|
992
1042
|
100
|
|
993
1043
|
] : [];
|
|
994
|
-
},
|
|
995
|
-
let n =
|
|
1044
|
+
}, nt = (e, t) => {
|
|
1045
|
+
let n = Ze / 2, r = e.length - 2, i = [];
|
|
996
1046
|
for (let a = 0; a <= r; a += 1) {
|
|
997
1047
|
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
998
|
-
i.push(`${t(a) ?
|
|
1048
|
+
i.push(`${t(a) ? $e : et} ${c} ${l}`), a !== r && i.push(`${et} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
999
1049
|
}
|
|
1000
1050
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
1001
|
-
},
|
|
1051
|
+
}, rt = /* @__PURE__ */ new Set([
|
|
1002
1052
|
"op",
|
|
1003
1053
|
"ops",
|
|
1004
1054
|
"opening",
|
|
@@ -1006,7 +1056,7 @@ var U = {
|
|
|
1006
1056
|
"ncop",
|
|
1007
1057
|
"オープニング",
|
|
1008
1058
|
"op主題歌"
|
|
1009
|
-
]),
|
|
1059
|
+
]), it = /* @__PURE__ */ new Set([
|
|
1010
1060
|
"ed",
|
|
1011
1061
|
"eds",
|
|
1012
1062
|
"ending",
|
|
@@ -1019,13 +1069,13 @@ var U = {
|
|
|
1019
1069
|
"エンドカード",
|
|
1020
1070
|
"エンドロール",
|
|
1021
1071
|
"ed主題歌"
|
|
1022
|
-
]),
|
|
1072
|
+
]), at = /* @__PURE__ */ new Set(["intro", "イントロ"]), ot = /* @__PURE__ */ new Set(["outro", "アウトロ"]), st = {
|
|
1023
1073
|
"credits start": "ending",
|
|
1024
1074
|
"credits end": null,
|
|
1025
1075
|
"preview end": null,
|
|
1026
1076
|
"end credits": "ending",
|
|
1027
1077
|
"closing credits": "ending"
|
|
1028
|
-
},
|
|
1078
|
+
}, ct = /* @__PURE__ */ new Set([
|
|
1029
1079
|
"theme",
|
|
1030
1080
|
"themes",
|
|
1031
1081
|
"song",
|
|
@@ -1044,53 +1094,53 @@ var U = {
|
|
|
1044
1094
|
"the",
|
|
1045
1095
|
"主題歌",
|
|
1046
1096
|
"ノンクレジット"
|
|
1047
|
-
]),
|
|
1097
|
+
]), lt = /* @__PURE__ */ new Set([
|
|
1048
1098
|
"post",
|
|
1049
1099
|
"pre",
|
|
1050
1100
|
"after",
|
|
1051
1101
|
"before",
|
|
1052
1102
|
"non"
|
|
1053
|
-
]),
|
|
1054
|
-
if (
|
|
1055
|
-
if (
|
|
1103
|
+
]), ut = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, dt = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), ft = (e) => e.replace(/([a-z-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w-ヿ一-鿿]+|[^\w-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !ct.has(e)), pt = (e, t) => {
|
|
1104
|
+
if (rt.has(e)) return "opening";
|
|
1105
|
+
if (it.has(e)) return "ending";
|
|
1056
1106
|
if (t) {
|
|
1057
|
-
if (
|
|
1058
|
-
if (
|
|
1107
|
+
if (at.has(e)) return "opening";
|
|
1108
|
+
if (ot.has(e)) return "ending";
|
|
1059
1109
|
}
|
|
1060
|
-
},
|
|
1061
|
-
if (
|
|
1110
|
+
}, mt = (e, t) => {
|
|
1111
|
+
if (dt(e)) return;
|
|
1062
1112
|
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
1063
|
-
if (n in
|
|
1064
|
-
let r = n.split(
|
|
1065
|
-
if (r.some((e) => e.split(/[\s_]+/u).some((e) =>
|
|
1113
|
+
if (n in st) return st[n] ?? void 0;
|
|
1114
|
+
let r = n.split(ut).map((e) => e.trim()).filter(Boolean);
|
|
1115
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => lt.has(e)))) return;
|
|
1066
1116
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
1067
1117
|
for (let e of i) {
|
|
1068
|
-
let n =
|
|
1118
|
+
let n = ft(e);
|
|
1069
1119
|
if (n.length !== 1) continue;
|
|
1070
|
-
let r =
|
|
1120
|
+
let r = pt(n[0], t);
|
|
1071
1121
|
if (r) return r;
|
|
1072
1122
|
}
|
|
1073
|
-
},
|
|
1123
|
+
}, ht = 15, gt = 87, _t = 93, vt = (e) => {
|
|
1074
1124
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
1075
1125
|
if (!n) return t;
|
|
1076
1126
|
let r = e.map((e, t) => ({
|
|
1077
1127
|
index: t,
|
|
1078
1128
|
start: e.start,
|
|
1079
1129
|
length: e.end - e.start
|
|
1080
|
-
})).filter(({ length: e }) => e >=
|
|
1130
|
+
})).filter(({ length: e }) => e >= gt && e <= _t), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
1081
1131
|
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
1082
|
-
},
|
|
1083
|
-
let t = e.map(({ title: e }) =>
|
|
1132
|
+
}, yt = (e) => {
|
|
1133
|
+
let t = e.map(({ title: e }) => mt(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
|
|
1084
1134
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
1085
1135
|
let i = e.map((e, n) => {
|
|
1086
|
-
if (e.end - e.start <
|
|
1136
|
+
if (e.end - e.start < ht) return;
|
|
1087
1137
|
let r = t[n];
|
|
1088
1138
|
if (r) return r;
|
|
1089
|
-
let i =
|
|
1139
|
+
let i = mt(e.title, !0);
|
|
1090
1140
|
return i && !t.includes(i) ? i : void 0;
|
|
1091
1141
|
});
|
|
1092
|
-
return e.every(({ title: e }) =>
|
|
1093
|
-
},
|
|
1142
|
+
return e.every(({ title: e }) => dt(e)) ? vt(e) : i;
|
|
1143
|
+
}, bt = _`
|
|
1094
1144
|
position: relative;
|
|
1095
1145
|
height: calc(.4 * var(--mp-unit));
|
|
1096
1146
|
|
|
@@ -1309,7 +1359,7 @@ var U = {
|
|
|
1309
1359
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1310
1360
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1311
1361
|
}
|
|
1312
|
-
`,
|
|
1362
|
+
`, xt = 4, St = () => {
|
|
1313
1363
|
let e = K(), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.duration), i = K((e) => e.size), a = K((e) => e.downloadedRanges), o = K((e) => e.buffered), s = K((e) => e.indexes), c = K((e) => e.thumbnails), l = K((e) => e.thumbnailAt), u = K((e) => e.requestThumbnail), d = K((e) => e.chapters), g = K((e) => e.seekingTo), _ = K((e) => e.setSourceState), v = K((e) => e.hideUI), y = m(null), [b, x] = h(void 0), [S, C] = h(void 0), w = (e) => {
|
|
1314
1364
|
C(e), u(e);
|
|
1315
1365
|
}, T = !!S;
|
|
@@ -1318,13 +1368,13 @@ var U = {
|
|
|
1318
1368
|
}, [_, T]), f(() => {
|
|
1319
1369
|
v && w(void 0);
|
|
1320
1370
|
}, [v]);
|
|
1321
|
-
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } =
|
|
1371
|
+
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = Xe({
|
|
1322
1372
|
ref: y,
|
|
1323
1373
|
onChange: (e) => {
|
|
1324
1374
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1325
1375
|
else if (!M.current) {
|
|
1326
1376
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1327
|
-
Math.abs(e - j.current) * t >
|
|
1377
|
+
Math.abs(e - j.current) * t > xt && (M.current = !0);
|
|
1328
1378
|
}
|
|
1329
1379
|
x(e), E.current !== "mouse" && w(e * r);
|
|
1330
1380
|
}
|
|
@@ -1387,7 +1437,7 @@ var U = {
|
|
|
1387
1437
|
N,
|
|
1388
1438
|
b,
|
|
1389
1439
|
g
|
|
1390
|
-
]), U = p(() =>
|
|
1440
|
+
]), U = p(() => tt(d, r), [d, r]), W = U.length > 0, G = p(() => {
|
|
1391
1441
|
if (!W || S === void 0 || !r) return -1;
|
|
1392
1442
|
let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
|
|
1393
1443
|
return t >= 0 ? t : U.length - 2;
|
|
@@ -1396,11 +1446,11 @@ var U = {
|
|
|
1396
1446
|
U,
|
|
1397
1447
|
S,
|
|
1398
1448
|
r
|
|
1399
|
-
]), re = p(() => W ?
|
|
1449
|
+
]), re = p(() => W ? nt(U, (e) => e !== G) : void 0, [
|
|
1400
1450
|
W,
|
|
1401
1451
|
U,
|
|
1402
1452
|
G
|
|
1403
|
-
]), ie = p(() => G >= 0 ?
|
|
1453
|
+
]), ie = p(() => G >= 0 ? nt(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
|
|
1404
1454
|
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1405
1455
|
}, [d, S]), J = p(() => {
|
|
1406
1456
|
if (S) {
|
|
@@ -1430,7 +1480,7 @@ var U = {
|
|
|
1430
1480
|
]
|
|
1431
1481
|
});
|
|
1432
1482
|
return /* @__PURE__ */ O("div", {
|
|
1433
|
-
css:
|
|
1483
|
+
css: bt,
|
|
1434
1484
|
ref: y,
|
|
1435
1485
|
className: [
|
|
1436
1486
|
"progress-bar",
|
|
@@ -1451,7 +1501,7 @@ var U = {
|
|
|
1451
1501
|
},
|
|
1452
1502
|
children: [/* @__PURE__ */ D("span", {
|
|
1453
1503
|
className: "cursor-time-value",
|
|
1454
|
-
children:
|
|
1504
|
+
children: Ge(S)
|
|
1455
1505
|
}), q ? /* @__PURE__ */ D("span", {
|
|
1456
1506
|
className: "chapter-title",
|
|
1457
1507
|
children: q.title
|
|
@@ -1475,7 +1525,7 @@ var U = {
|
|
|
1475
1525
|
})
|
|
1476
1526
|
]
|
|
1477
1527
|
});
|
|
1478
|
-
},
|
|
1528
|
+
}, Ct = "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", wt = {
|
|
1479
1529
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1480
1530
|
width: 24,
|
|
1481
1531
|
height: 24,
|
|
@@ -1485,8 +1535,8 @@ var U = {
|
|
|
1485
1535
|
strokeWidth: 2,
|
|
1486
1536
|
strokeLinecap: "round",
|
|
1487
1537
|
strokeLinejoin: "round"
|
|
1488
|
-
},
|
|
1489
|
-
...
|
|
1538
|
+
}, Tt = (e) => /* @__PURE__ */ O("svg", {
|
|
1539
|
+
...wt,
|
|
1490
1540
|
...e,
|
|
1491
1541
|
children: [
|
|
1492
1542
|
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1500,8 +1550,8 @@ var U = {
|
|
|
1500
1550
|
}),
|
|
1501
1551
|
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1502
1552
|
]
|
|
1503
|
-
}),
|
|
1504
|
-
...
|
|
1553
|
+
}), Et = (e) => /* @__PURE__ */ O("svg", {
|
|
1554
|
+
...wt,
|
|
1505
1555
|
...e,
|
|
1506
1556
|
children: [
|
|
1507
1557
|
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1515,7 +1565,7 @@ var U = {
|
|
|
1515
1565
|
}),
|
|
1516
1566
|
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1517
1567
|
]
|
|
1518
|
-
}),
|
|
1568
|
+
}), Dt = _`
|
|
1519
1569
|
.popover {
|
|
1520
1570
|
position: absolute;
|
|
1521
1571
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1642,7 +1692,7 @@ var U = {
|
|
|
1642
1692
|
${Z.bSmall.regular}
|
|
1643
1693
|
}
|
|
1644
1694
|
}
|
|
1645
|
-
`,
|
|
1695
|
+
`, Ot = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1646
1696
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1647
1697
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1648
1698
|
return /* @__PURE__ */ O("div", {
|
|
@@ -1669,7 +1719,7 @@ var U = {
|
|
|
1669
1719
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1670
1720
|
]
|
|
1671
1721
|
});
|
|
1672
|
-
},
|
|
1722
|
+
}, kt = ({ onReset: e } = {}) => {
|
|
1673
1723
|
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1674
1724
|
c.current = e;
|
|
1675
1725
|
let l = () => {
|
|
@@ -1710,7 +1760,7 @@ var U = {
|
|
|
1710
1760
|
});
|
|
1711
1761
|
}
|
|
1712
1762
|
};
|
|
1713
|
-
},
|
|
1763
|
+
}, At = _`
|
|
1714
1764
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1715
1765
|
which is the width of the player box, so it can be clamped to it. */
|
|
1716
1766
|
position: static;
|
|
@@ -1726,7 +1776,7 @@ position: static;
|
|
|
1726
1776
|
}
|
|
1727
1777
|
}
|
|
1728
1778
|
|
|
1729
|
-
${
|
|
1779
|
+
${Dt}
|
|
1730
1780
|
|
|
1731
1781
|
.popover.error-list {
|
|
1732
1782
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1798,23 +1848,23 @@ ${wt}
|
|
|
1798
1848
|
}
|
|
1799
1849
|
}
|
|
1800
1850
|
}
|
|
1801
|
-
`,
|
|
1802
|
-
let n =
|
|
1851
|
+
`, jt = (e) => new Date(e).toLocaleTimeString(), Mt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Ge(Math.max(0, e)), Nt = (e) => e.reduce((e, t) => e + t.count, 0), Pt = (e) => e.map((e, t) => {
|
|
1852
|
+
let n = Mt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1803
1853
|
return [
|
|
1804
1854
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1805
1855
|
e.message,
|
|
1806
1856
|
e.detail
|
|
1807
1857
|
].filter(Boolean).join("\n");
|
|
1808
|
-
}).join("\n\n"),
|
|
1809
|
-
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } =
|
|
1858
|
+
}).join("\n\n"), Ft = () => {
|
|
1859
|
+
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = kt(), [i, a] = h(!1);
|
|
1810
1860
|
if (e.length === 0) return null;
|
|
1811
1861
|
let o = () => {
|
|
1812
|
-
navigator.clipboard?.writeText(
|
|
1862
|
+
navigator.clipboard?.writeText(Pt(e)).then(() => {
|
|
1813
1863
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1814
1864
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1815
|
-
}, s = `Playback errors (${
|
|
1865
|
+
}, s = `Playback errors (${Nt(e)})`;
|
|
1816
1866
|
return /* @__PURE__ */ O("div", {
|
|
1817
|
-
css:
|
|
1867
|
+
css: At,
|
|
1818
1868
|
ref: r,
|
|
1819
1869
|
children: [/* @__PURE__ */ D($, {
|
|
1820
1870
|
id: "errors",
|
|
@@ -1845,9 +1895,9 @@ ${wt}
|
|
|
1845
1895
|
/* @__PURE__ */ O("span", {
|
|
1846
1896
|
className: "when",
|
|
1847
1897
|
children: [
|
|
1848
|
-
|
|
1849
|
-
e.count > 1 ? ` to ${
|
|
1850
|
-
|
|
1898
|
+
jt(e.at),
|
|
1899
|
+
e.count > 1 ? ` to ${jt(e.lastAt)}` : "",
|
|
1900
|
+
Mt(e.atMediaTime) ? ` at ${Mt(e.atMediaTime)}` : "",
|
|
1851
1901
|
e.recovered ? " recovered" : "",
|
|
1852
1902
|
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1853
1903
|
className: "count",
|
|
@@ -1867,7 +1917,7 @@ ${wt}
|
|
|
1867
1917
|
}, `${e.at}-${t}`))]
|
|
1868
1918
|
})]
|
|
1869
1919
|
});
|
|
1870
|
-
},
|
|
1920
|
+
}, It = _`
|
|
1871
1921
|
display: flex;
|
|
1872
1922
|
align-items: center;
|
|
1873
1923
|
justify-content: center;
|
|
@@ -1920,8 +1970,8 @@ width: 100%;
|
|
|
1920
1970
|
}
|
|
1921
1971
|
}
|
|
1922
1972
|
}
|
|
1923
|
-
`,
|
|
1924
|
-
let e = K(), t = K((e) => e.playbackRate), n = m(null), r = m(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } =
|
|
1973
|
+
`, Lt = () => {
|
|
1974
|
+
let e = K(), t = K((e) => e.playbackRate), n = m(null), r = m(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = Xe({
|
|
1925
1975
|
ref: r,
|
|
1926
1976
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1927
1977
|
}), d = (t) => {
|
|
@@ -1937,7 +1987,7 @@ width: 100%;
|
|
|
1937
1987
|
}, [t]);
|
|
1938
1988
|
let p = c(s);
|
|
1939
1989
|
return /* @__PURE__ */ O("div", {
|
|
1940
|
-
css:
|
|
1990
|
+
css: It,
|
|
1941
1991
|
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1942
1992
|
className: "playback-slider",
|
|
1943
1993
|
ref: n,
|
|
@@ -1955,7 +2005,7 @@ width: 100%;
|
|
|
1955
2005
|
})
|
|
1956
2006
|
})]
|
|
1957
2007
|
});
|
|
1958
|
-
},
|
|
2008
|
+
}, Rt = _`
|
|
1959
2009
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1960
2010
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1961
2011
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1973,7 +2023,7 @@ position: static;
|
|
|
1973
2023
|
}
|
|
1974
2024
|
}
|
|
1975
2025
|
|
|
1976
|
-
${
|
|
2026
|
+
${Dt}
|
|
1977
2027
|
|
|
1978
2028
|
.switch {
|
|
1979
2029
|
position: relative;
|
|
@@ -2049,8 +2099,8 @@ ${wt}
|
|
|
2049
2099
|
}
|
|
2050
2100
|
}
|
|
2051
2101
|
|
|
2052
|
-
`,
|
|
2053
|
-
let e = K(), t = K((e) => e.playbackRate), n = K((e) => e.audioTracks), r = K((e) => e.selectedAudioTrack), i = K((e) => e.selectAudioTrack), a = K((e) => e.quality), o = K((e) => e.volumeNormalizer), [s, c] = h(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } =
|
|
2102
|
+
`, zt = () => {
|
|
2103
|
+
let e = K(), t = K((e) => e.playbackRate), n = K((e) => e.audioTracks), r = K((e) => e.selectedAudioTrack), i = K((e) => e.selectAudioTrack), a = K((e) => e.quality), o = K((e) => e.volumeNormalizer), [s, c] = h(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } = kt({ onReset: () => c(0) }), g = (t) => {
|
|
2054
2104
|
e.setPlaybackRate(t), c(0);
|
|
2055
2105
|
}, _ = (e) => {
|
|
2056
2106
|
e !== void 0 && m(e, () => i(e));
|
|
@@ -2060,7 +2110,7 @@ ${wt}
|
|
|
2060
2110
|
c(e);
|
|
2061
2111
|
};
|
|
2062
2112
|
return /* @__PURE__ */ O("div", {
|
|
2063
|
-
css:
|
|
2113
|
+
css: Rt,
|
|
2064
2114
|
ref: d,
|
|
2065
2115
|
children: [
|
|
2066
2116
|
/* @__PURE__ */ D($, {
|
|
@@ -2122,7 +2172,7 @@ ${wt}
|
|
|
2122
2172
|
}),
|
|
2123
2173
|
/* @__PURE__ */ D("div", {
|
|
2124
2174
|
className: "slider no-hover",
|
|
2125
|
-
children: /* @__PURE__ */ D(
|
|
2175
|
+
children: /* @__PURE__ */ D(Lt, {})
|
|
2126
2176
|
}),
|
|
2127
2177
|
/* @__PURE__ */ O("div", {
|
|
2128
2178
|
className: "options no-hover",
|
|
@@ -2147,7 +2197,7 @@ ${wt}
|
|
|
2147
2197
|
})
|
|
2148
2198
|
]
|
|
2149
2199
|
}),
|
|
2150
|
-
l && s === 2 && /* @__PURE__ */ D(
|
|
2200
|
+
l && s === 2 && /* @__PURE__ */ D(Ot, {
|
|
2151
2201
|
title: "Audio",
|
|
2152
2202
|
tracks: n,
|
|
2153
2203
|
selected: r,
|
|
@@ -2156,7 +2206,7 @@ ${wt}
|
|
|
2156
2206
|
pending: f,
|
|
2157
2207
|
failed: p
|
|
2158
2208
|
}),
|
|
2159
|
-
l && s === 3 && a && /* @__PURE__ */ D(
|
|
2209
|
+
l && s === 3 && a && /* @__PURE__ */ D(Ot, {
|
|
2160
2210
|
title: "Quality",
|
|
2161
2211
|
tracks: a.options,
|
|
2162
2212
|
selected: a.selectedId ?? void 0,
|
|
@@ -2168,7 +2218,7 @@ ${wt}
|
|
|
2168
2218
|
})
|
|
2169
2219
|
]
|
|
2170
2220
|
});
|
|
2171
|
-
},
|
|
2221
|
+
}, Bt = _`
|
|
2172
2222
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2173
2223
|
which is the width of the player box, so it can be clamped to it. */
|
|
2174
2224
|
position: static;
|
|
@@ -2184,13 +2234,13 @@ position: static;
|
|
|
2184
2234
|
}
|
|
2185
2235
|
}
|
|
2186
2236
|
|
|
2187
|
-
${
|
|
2188
|
-
`,
|
|
2189
|
-
let e = K((e) => e.subtitleTracks), t = K((e) => e.selectedSubtitleTrack), n = K((e) => e.selectSubtitleTrack), r = K((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } =
|
|
2237
|
+
${Dt}
|
|
2238
|
+
`, Vt = () => {
|
|
2239
|
+
let e = K((e) => e.subtitleTracks), t = K((e) => e.selectedSubtitleTrack), n = K((e) => e.selectSubtitleTrack), r = K((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = kt();
|
|
2190
2240
|
if (e.length === 0) return null;
|
|
2191
2241
|
let u = t !== void 0;
|
|
2192
2242
|
return /* @__PURE__ */ O("div", {
|
|
2193
|
-
css:
|
|
2243
|
+
css: Bt,
|
|
2194
2244
|
ref: o,
|
|
2195
2245
|
children: [/* @__PURE__ */ D($, {
|
|
2196
2246
|
id: "subtitles",
|
|
@@ -2205,7 +2255,7 @@ ${wt}
|
|
|
2205
2255
|
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
2206
2256
|
}),
|
|
2207
2257
|
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2208
|
-
}), i && /* @__PURE__ */ D(
|
|
2258
|
+
}), i && /* @__PURE__ */ D(Ot, {
|
|
2209
2259
|
title: "Subtitles",
|
|
2210
2260
|
tracks: e,
|
|
2211
2261
|
selected: t,
|
|
@@ -2215,13 +2265,13 @@ ${wt}
|
|
|
2215
2265
|
failed: c
|
|
2216
2266
|
})]
|
|
2217
2267
|
});
|
|
2218
|
-
},
|
|
2268
|
+
}, Ht = {
|
|
2219
2269
|
primary: "#EAEBEE",
|
|
2220
2270
|
secondary: "#D0D0D9",
|
|
2221
2271
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2222
2272
|
borderPrimary: "#384F70",
|
|
2223
2273
|
backgroundTooltip: "#222222"
|
|
2224
|
-
},
|
|
2274
|
+
}, Ut = _`
|
|
2225
2275
|
display: flex;
|
|
2226
2276
|
align-items: center;
|
|
2227
2277
|
|
|
@@ -2264,8 +2314,8 @@ ${wt}
|
|
|
2264
2314
|
width: 10px;
|
|
2265
2315
|
height: 10px;
|
|
2266
2316
|
}
|
|
2267
|
-
`,
|
|
2268
|
-
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } =
|
|
2317
|
+
`, Wt = ({ value: e, onChange: t }) => {
|
|
2318
|
+
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } = Xe({
|
|
2269
2319
|
ref: a,
|
|
2270
2320
|
onChange: t
|
|
2271
2321
|
}), s = (n) => {
|
|
@@ -2279,12 +2329,12 @@ ${wt}
|
|
|
2279
2329
|
e && e.removeEventListener("wheel", s);
|
|
2280
2330
|
};
|
|
2281
2331
|
}, [e]);
|
|
2282
|
-
let c = e * 100, l = p(() => Math.round(r ? 0 :
|
|
2332
|
+
let c = e * 100, l = p(() => Math.round(r ? 0 : We(n) * 100), [n, r]);
|
|
2283
2333
|
return /* @__PURE__ */ D($, {
|
|
2284
2334
|
id: "volume-slider",
|
|
2285
2335
|
text: /* @__PURE__ */ D("div", {
|
|
2286
2336
|
ref: i,
|
|
2287
|
-
css:
|
|
2337
|
+
css: Ut,
|
|
2288
2338
|
...o,
|
|
2289
2339
|
children: /* @__PURE__ */ D("div", {
|
|
2290
2340
|
ref: a,
|
|
@@ -2303,7 +2353,7 @@ ${wt}
|
|
|
2303
2353
|
children: [l, "%"]
|
|
2304
2354
|
})
|
|
2305
2355
|
});
|
|
2306
|
-
},
|
|
2356
|
+
}, Gt = _`
|
|
2307
2357
|
position: relative;
|
|
2308
2358
|
display: flex;
|
|
2309
2359
|
align-items: center;
|
|
@@ -2366,10 +2416,10 @@ ${wt}
|
|
|
2366
2416
|
}
|
|
2367
2417
|
}
|
|
2368
2418
|
|
|
2369
|
-
`,
|
|
2370
|
-
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() =>
|
|
2419
|
+
`, Kt = ({ ref: e }) => {
|
|
2420
|
+
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() => We(n), [n]);
|
|
2371
2421
|
return /* @__PURE__ */ O("div", {
|
|
2372
|
-
css:
|
|
2422
|
+
css: Gt,
|
|
2373
2423
|
children: [/* @__PURE__ */ D($, {
|
|
2374
2424
|
id: "sound",
|
|
2375
2425
|
text: /* @__PURE__ */ D("button", {
|
|
@@ -2389,16 +2439,16 @@ ${wt}
|
|
|
2389
2439
|
className: "volume-slider-container",
|
|
2390
2440
|
children: /* @__PURE__ */ D("div", {
|
|
2391
2441
|
className: "volume-slider-background",
|
|
2392
|
-
children: /* @__PURE__ */ D(
|
|
2442
|
+
children: /* @__PURE__ */ D(Wt, {
|
|
2393
2443
|
value: r ? 0 : i,
|
|
2394
2444
|
onChange: (e) => {
|
|
2395
|
-
t.setVolume(
|
|
2445
|
+
t.setVolume(Ue(e));
|
|
2396
2446
|
}
|
|
2397
2447
|
})
|
|
2398
2448
|
})
|
|
2399
2449
|
})]
|
|
2400
2450
|
});
|
|
2401
|
-
},
|
|
2451
|
+
}, qt = .05, Jt = 5, Yt = 50, Xt = 1e3, Zt = _`
|
|
2402
2452
|
position: absolute;
|
|
2403
2453
|
bottom: 0;
|
|
2404
2454
|
width: 100%;
|
|
@@ -2490,7 +2540,7 @@ ${wt}
|
|
|
2490
2540
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2491
2541
|
of its own and so is never :hover */
|
|
2492
2542
|
:hover, &.armed {
|
|
2493
|
-
background-color: ${
|
|
2543
|
+
background-color: ${Ht.hover};
|
|
2494
2544
|
}
|
|
2495
2545
|
|
|
2496
2546
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2528,36 +2578,36 @@ ${wt}
|
|
|
2528
2578
|
}
|
|
2529
2579
|
}
|
|
2530
2580
|
}
|
|
2531
|
-
`,
|
|
2532
|
-
let n = K(), r = K((e) => e.paused), i = K((e) => e.currentTime), a = K((e) => e.duration), o = K((e) => e.seekingTo), s = K((e) => e.fullscreen), c = K((e) => e.hideUI), l = K((e) => e.togglePictureInPicture), u = K((e) => e.pictureInPictureMode), p = K((e) => e.burnedInSubtitles), g = K((e) => e.passThroughPictureInPicture), _ = K((e) => e.subtitleTracks), v = K((e) => e.requestSeek),
|
|
2533
|
-
let r =
|
|
2534
|
-
n.setVolume(
|
|
2535
|
-
}, [n]),
|
|
2581
|
+
`, Qt = ({ shortcuts: e = "window", root: t }) => {
|
|
2582
|
+
let n = K(), r = K((e) => e.paused), i = K((e) => e.currentTime), a = K((e) => e.duration), o = K((e) => e.seekingTo), s = K((e) => e.fullscreen), c = K((e) => e.hideUI), l = K((e) => e.togglePictureInPicture), u = K((e) => e.pictureInPictureMode), p = K((e) => e.burnedInSubtitles), g = K((e) => e.passThroughPictureInPicture), _ = K((e) => e.subtitleTracks), v = K((e) => e.requestSeek), y = K((e) => e.stepFrame), [b, x] = h(null), S = m(null), C = m(void 0), w = u === "burn-in", T = _.length > 0, E = a > 0 && i === a, k = d(({ direction: e, stepSize: t }) => {
|
|
2583
|
+
let r = We(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2584
|
+
n.setVolume(Ue(a)), o && !n.muted && n.toggleMuted();
|
|
2585
|
+
}, [n]), A = m(!1);
|
|
2536
2586
|
f(() => {
|
|
2537
2587
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
2538
|
-
|
|
2588
|
+
A.current = !!t.current?.contains(i(e) ?? null);
|
|
2539
2589
|
}, o = (a) => {
|
|
2540
2590
|
let o = i(a);
|
|
2541
|
-
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "")) return;
|
|
2542
|
-
let s = t.current?.contains(o ?? null) || o === document.body &&
|
|
2591
|
+
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "") || (a.ctrlKey || a.metaKey || a.altKey) && !a.getModifierState("AltGraph")) return;
|
|
2592
|
+
let s = t.current?.contains(o ?? null) || o === document.body && A.current;
|
|
2543
2593
|
if (e === "player" && !n.fullscreen && !s) return;
|
|
2544
2594
|
let c = !0;
|
|
2545
2595
|
if (a.key === "f") n.toggleFullscreen();
|
|
2546
2596
|
else if (a.key === "k") n.togglePaused();
|
|
2547
2597
|
else if (a.key === " ") n.togglePaused();
|
|
2548
2598
|
else if (a.key === "m") n.toggleMuted();
|
|
2549
|
-
else if (a.key === "ArrowUp")
|
|
2599
|
+
else if (a.key === "ArrowUp") k({
|
|
2550
2600
|
direction: "up",
|
|
2551
|
-
stepSize:
|
|
2601
|
+
stepSize: qt
|
|
2552
2602
|
});
|
|
2553
|
-
else if (a.key === "ArrowDown")
|
|
2603
|
+
else if (a.key === "ArrowDown") k({
|
|
2554
2604
|
direction: "down",
|
|
2555
|
-
stepSize:
|
|
2605
|
+
stepSize: qt
|
|
2556
2606
|
});
|
|
2557
2607
|
else if (a.key === "ArrowRight") {
|
|
2558
2608
|
if (!n.duration) return;
|
|
2559
|
-
r(Math.min(n.currentTime +
|
|
2560
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2609
|
+
r(Math.min(n.currentTime + Jt, n.duration));
|
|
2610
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Jt, 0)) : (a.key === "<" || a.key === ">") && y ? y(a.key === ">" ? 1 : -1) : c = !1;
|
|
2561
2611
|
c && a.preventDefault();
|
|
2562
2612
|
};
|
|
2563
2613
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2565,24 +2615,25 @@ ${wt}
|
|
|
2565
2615
|
};
|
|
2566
2616
|
}, [
|
|
2567
2617
|
n,
|
|
2568
|
-
|
|
2618
|
+
k,
|
|
2569
2619
|
v,
|
|
2620
|
+
y,
|
|
2570
2621
|
e,
|
|
2571
2622
|
t
|
|
2572
2623
|
]);
|
|
2573
|
-
let
|
|
2574
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2624
|
+
let j = d((e) => {
|
|
2625
|
+
e.preventDefault(), e.deltaY < 0 ? k({
|
|
2575
2626
|
direction: "up",
|
|
2576
|
-
stepSize:
|
|
2577
|
-
}) :
|
|
2627
|
+
stepSize: qt
|
|
2628
|
+
}) : k({
|
|
2578
2629
|
direction: "down",
|
|
2579
|
-
stepSize:
|
|
2630
|
+
stepSize: qt
|
|
2580
2631
|
});
|
|
2581
|
-
}, [
|
|
2632
|
+
}, [k]);
|
|
2582
2633
|
f(() => {
|
|
2583
|
-
if (
|
|
2584
|
-
}, [
|
|
2585
|
-
let
|
|
2634
|
+
if (b) return b.addEventListener("wheel", j, { passive: !1 }), () => b.removeEventListener("wheel", j);
|
|
2635
|
+
}, [b, j]);
|
|
2636
|
+
let M = (e) => {
|
|
2586
2637
|
if (!g || g.active || g.armed || e.pointerType === "touch") return;
|
|
2587
2638
|
let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
|
|
2588
2639
|
g.arm({
|
|
@@ -2591,29 +2642,29 @@ ${wt}
|
|
|
2591
2642
|
width: r,
|
|
2592
2643
|
height: i
|
|
2593
2644
|
});
|
|
2594
|
-
},
|
|
2645
|
+
}, N = !!g?.armed;
|
|
2595
2646
|
return f(() => {
|
|
2596
|
-
if (!
|
|
2597
|
-
clearInterval(
|
|
2647
|
+
if (!N) return;
|
|
2648
|
+
clearInterval(C.current);
|
|
2598
2649
|
let e = Infinity, t = setInterval(() => {
|
|
2599
2650
|
if (Date.now() > e) {
|
|
2600
2651
|
clearInterval(t);
|
|
2601
2652
|
return;
|
|
2602
2653
|
}
|
|
2603
|
-
let n =
|
|
2654
|
+
let n = S.current, r = document.activeElement;
|
|
2604
2655
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2605
|
-
},
|
|
2606
|
-
return
|
|
2607
|
-
e = Date.now() +
|
|
2656
|
+
}, Yt);
|
|
2657
|
+
return C.current = t, () => {
|
|
2658
|
+
e = Date.now() + Xt;
|
|
2608
2659
|
};
|
|
2609
|
-
}, [
|
|
2660
|
+
}, [N]), f(() => () => clearInterval(C.current), []), /* @__PURE__ */ O("div", {
|
|
2610
2661
|
className: "control-bar",
|
|
2611
|
-
css:
|
|
2662
|
+
css: Zt,
|
|
2612
2663
|
style: { ...c ? {
|
|
2613
2664
|
opacity: "0",
|
|
2614
2665
|
pointerEvents: "none"
|
|
2615
|
-
} :
|
|
2616
|
-
children: [/* @__PURE__ */ D(
|
|
2666
|
+
} : N ? { pointerEvents: "none" } : {} },
|
|
2667
|
+
children: [/* @__PURE__ */ D(St, {}), /* @__PURE__ */ O("div", {
|
|
2617
2668
|
className: "actions",
|
|
2618
2669
|
children: [/* @__PURE__ */ O("div", {
|
|
2619
2670
|
className: "left",
|
|
@@ -2625,37 +2676,37 @@ ${wt}
|
|
|
2625
2676
|
className: "play",
|
|
2626
2677
|
type: "button",
|
|
2627
2678
|
onClick: () => n.togglePaused(),
|
|
2628
|
-
"aria-label":
|
|
2629
|
-
children: D(
|
|
2679
|
+
"aria-label": E ? "Replay" : r ? "Play" : "Pause",
|
|
2680
|
+
children: D(E ? z : r ? R : L, {})
|
|
2630
2681
|
}),
|
|
2631
|
-
toolTipText: /* @__PURE__ */ D("span", { children:
|
|
2682
|
+
toolTipText: /* @__PURE__ */ D("span", { children: E ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2632
2683
|
}),
|
|
2633
|
-
/* @__PURE__ */ D(
|
|
2684
|
+
/* @__PURE__ */ D(Kt, { ref: x }),
|
|
2634
2685
|
/* @__PURE__ */ D("div", {
|
|
2635
2686
|
className: "time",
|
|
2636
|
-
children:
|
|
2687
|
+
children: Ke(o ?? i, a)
|
|
2637
2688
|
})
|
|
2638
2689
|
]
|
|
2639
2690
|
}), /* @__PURE__ */ O("div", {
|
|
2640
2691
|
className: "right",
|
|
2641
2692
|
children: [
|
|
2642
|
-
/* @__PURE__ */ D(
|
|
2643
|
-
/* @__PURE__ */ D(
|
|
2644
|
-
/* @__PURE__ */ D(
|
|
2693
|
+
/* @__PURE__ */ D(Ft, {}),
|
|
2694
|
+
/* @__PURE__ */ D(Vt, {}),
|
|
2695
|
+
/* @__PURE__ */ D(zt, {}),
|
|
2645
2696
|
g ? /* @__PURE__ */ D($, {
|
|
2646
2697
|
id: "picture-in-picture",
|
|
2647
2698
|
tooltipPlace: "top-end",
|
|
2648
2699
|
text: /* @__PURE__ */ D("button", {
|
|
2649
|
-
ref:
|
|
2700
|
+
ref: S,
|
|
2650
2701
|
className: g.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2651
2702
|
type: "button",
|
|
2652
|
-
onPointerEnter:
|
|
2653
|
-
onPointerMove:
|
|
2703
|
+
onPointerEnter: M,
|
|
2704
|
+
onPointerMove: M,
|
|
2654
2705
|
onClick: g.active ? g.exit : void 0,
|
|
2655
2706
|
"aria-label": "Picture in picture",
|
|
2656
2707
|
"aria-pressed": g.active,
|
|
2657
2708
|
children: /* @__PURE__ */ D("img", {
|
|
2658
|
-
src:
|
|
2709
|
+
src: Ct,
|
|
2659
2710
|
alt: ""
|
|
2660
2711
|
})
|
|
2661
2712
|
}),
|
|
@@ -2667,15 +2718,15 @@ ${wt}
|
|
|
2667
2718
|
className: "picture-in-picture",
|
|
2668
2719
|
type: "button",
|
|
2669
2720
|
onClick: l,
|
|
2670
|
-
disabled:
|
|
2671
|
-
"aria-label":
|
|
2672
|
-
"aria-pressed":
|
|
2673
|
-
children:
|
|
2674
|
-
src:
|
|
2721
|
+
disabled: w && !T,
|
|
2722
|
+
"aria-label": w ? "Put the subtitles in the video" : "Picture in picture",
|
|
2723
|
+
"aria-pressed": w ? p : void 0,
|
|
2724
|
+
children: w ? D(p ? Tt : Et, {}) : /* @__PURE__ */ D("img", {
|
|
2725
|
+
src: Ct,
|
|
2675
2726
|
alt: ""
|
|
2676
2727
|
})
|
|
2677
2728
|
}),
|
|
2678
|
-
toolTipText: /* @__PURE__ */ D("span", { children:
|
|
2729
|
+
toolTipText: /* @__PURE__ */ D("span", { children: w ? T ? p ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture" })
|
|
2679
2730
|
}) : null,
|
|
2680
2731
|
/* @__PURE__ */ D($, {
|
|
2681
2732
|
id: "full-screen",
|
|
@@ -2694,7 +2745,7 @@ ${wt}
|
|
|
2694
2745
|
})]
|
|
2695
2746
|
})]
|
|
2696
2747
|
});
|
|
2697
|
-
},
|
|
2748
|
+
}, $t = 9e3, en = _`
|
|
2698
2749
|
position: absolute;
|
|
2699
2750
|
inset: 0;
|
|
2700
2751
|
z-index: 2;
|
|
@@ -2737,7 +2788,7 @@ ${wt}
|
|
|
2737
2788
|
line-height: 1;
|
|
2738
2789
|
color: #fff;
|
|
2739
2790
|
}
|
|
2740
|
-
`,
|
|
2791
|
+
`, tn = () => {
|
|
2741
2792
|
let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2742
2793
|
return f(() => {
|
|
2743
2794
|
if (t !== "burn-in" || !e) {
|
|
@@ -2745,10 +2796,10 @@ ${wt}
|
|
|
2745
2796
|
return;
|
|
2746
2797
|
}
|
|
2747
2798
|
r(!0);
|
|
2748
|
-
let n = setTimeout(() => r(!1),
|
|
2799
|
+
let n = setTimeout(() => r(!1), $t);
|
|
2749
2800
|
return () => clearTimeout(n);
|
|
2750
2801
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2751
|
-
css:
|
|
2802
|
+
css: en,
|
|
2752
2803
|
className: n ? "show" : "",
|
|
2753
2804
|
role: "status",
|
|
2754
2805
|
children: /* @__PURE__ */ O("div", {
|
|
@@ -2763,10 +2814,10 @@ ${wt}
|
|
|
2763
2814
|
})]
|
|
2764
2815
|
})
|
|
2765
2816
|
});
|
|
2766
|
-
},
|
|
2817
|
+
}, nn = 1, rn = 6e3, an = 1, on = {
|
|
2767
2818
|
opening: "Skip Opening",
|
|
2768
2819
|
ending: "Skip Ending"
|
|
2769
|
-
},
|
|
2820
|
+
}, sn = _`
|
|
2770
2821
|
position: absolute;
|
|
2771
2822
|
inset: 0;
|
|
2772
2823
|
z-index: 2;
|
|
@@ -2817,10 +2868,10 @@ ${wt}
|
|
|
2817
2868
|
bottom: calc(9 * var(--mp-unit));
|
|
2818
2869
|
}
|
|
2819
2870
|
}
|
|
2820
|
-
`,
|
|
2821
|
-
let e = K((e) => e.chapters), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.seekPreview), i = K(), a = p(() =>
|
|
2871
|
+
`, cn = () => {
|
|
2872
|
+
let e = K((e) => e.chapters), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.seekPreview), i = K(), a = p(() => yt(e), [e]), o = p(() => {
|
|
2822
2873
|
if (typeof t != "number") return;
|
|
2823
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2874
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - nn <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2824
2875
|
return r ? {
|
|
2825
2876
|
kind: r,
|
|
2826
2877
|
end: e[n].end
|
|
@@ -2832,7 +2883,7 @@ ${wt}
|
|
|
2832
2883
|
]), s = m(0), [c, l] = h(0);
|
|
2833
2884
|
f(() => {
|
|
2834
2885
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2835
|
-
s.current = e, e < n -
|
|
2886
|
+
s.current = e, e < n - an && l((e) => e + 1);
|
|
2836
2887
|
}, [t]);
|
|
2837
2888
|
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2838
2889
|
return f(() => {
|
|
@@ -2841,12 +2892,12 @@ ${wt}
|
|
|
2841
2892
|
return;
|
|
2842
2893
|
}
|
|
2843
2894
|
d(!0);
|
|
2844
|
-
let e = setTimeout(() => d(!1),
|
|
2895
|
+
let e = setTimeout(() => d(!1), rn);
|
|
2845
2896
|
return () => clearTimeout(e);
|
|
2846
2897
|
}, [g, c]), f(() => {
|
|
2847
2898
|
o || d(!1);
|
|
2848
2899
|
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2849
|
-
css:
|
|
2900
|
+
css: sn,
|
|
2850
2901
|
className: u && !r ? "show" : "",
|
|
2851
2902
|
children: /* @__PURE__ */ D("button", {
|
|
2852
2903
|
type: "button",
|
|
@@ -2854,10 +2905,10 @@ ${wt}
|
|
|
2854
2905
|
onClick: () => {
|
|
2855
2906
|
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2856
2907
|
},
|
|
2857
|
-
children:
|
|
2908
|
+
children: on[o.kind]
|
|
2858
2909
|
})
|
|
2859
2910
|
}) : null;
|
|
2860
|
-
},
|
|
2911
|
+
}, ln = 3e3, un = _`
|
|
2861
2912
|
position: absolute;
|
|
2862
2913
|
inset: 0;
|
|
2863
2914
|
z-index: 2;
|
|
@@ -2868,10 +2919,10 @@ ${wt}
|
|
|
2868
2919
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2869
2920
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2870
2921
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2871
|
-
`,
|
|
2922
|
+
`, dn = (e, t) => {
|
|
2872
2923
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2873
2924
|
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')`;
|
|
2874
|
-
},
|
|
2925
|
+
}, fn = _`
|
|
2875
2926
|
position: relative;
|
|
2876
2927
|
background-color: black;
|
|
2877
2928
|
display: flex;
|
|
@@ -2928,13 +2979,13 @@ ${wt}
|
|
|
2928
2979
|
&.hide {
|
|
2929
2980
|
cursor: none;
|
|
2930
2981
|
}
|
|
2931
|
-
`,
|
|
2982
|
+
`, pn = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2932
2983
|
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2933
|
-
return u(e) && e.type === l ?
|
|
2984
|
+
return u(e) && e.type === l ? pn(e.props.children, `${r}/`) : [{
|
|
2934
2985
|
key: r,
|
|
2935
2986
|
item: e
|
|
2936
2987
|
}];
|
|
2937
|
-
}),
|
|
2988
|
+
}), mn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2938
2989
|
let s = K(), c = K((e) => e.hideUI), l = K((e) => e.setHideUI), u = K((e) => e.hasMedia), d = K((e) => e.passThroughPictureInPicture), p = m(void 0), h = m("mouse"), g = m({
|
|
2939
2990
|
x: -1,
|
|
2940
2991
|
y: -1
|
|
@@ -2955,12 +3006,12 @@ ${wt}
|
|
|
2955
3006
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
2956
3007
|
}, S = () => {
|
|
2957
3008
|
if (x()) {
|
|
2958
|
-
p.current = setTimeout(S,
|
|
3009
|
+
p.current = setTimeout(S, ln);
|
|
2959
3010
|
return;
|
|
2960
3011
|
}
|
|
2961
3012
|
y();
|
|
2962
3013
|
}, C = () => {
|
|
2963
|
-
l(!1), clearTimeout(p.current), p.current = setTimeout(S,
|
|
3014
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, ln);
|
|
2964
3015
|
}, w = (e) => {
|
|
2965
3016
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
2966
3017
|
x: e.clientX,
|
|
@@ -2972,7 +3023,7 @@ ${wt}
|
|
|
2972
3023
|
_.current = !1;
|
|
2973
3024
|
}, k = m(!0);
|
|
2974
3025
|
return /* @__PURE__ */ O("div", {
|
|
2975
|
-
css:
|
|
3026
|
+
css: fn,
|
|
2976
3027
|
ref: b,
|
|
2977
3028
|
onPointerMove: w,
|
|
2978
3029
|
onPointerDown: T,
|
|
@@ -2987,9 +3038,9 @@ ${wt}
|
|
|
2987
3038
|
className: c ? "hide" : "",
|
|
2988
3039
|
tabIndex: a === "player" ? -1 : void 0,
|
|
2989
3040
|
children: [
|
|
2990
|
-
/* @__PURE__ */ D(
|
|
2991
|
-
|
|
2992
|
-
css:
|
|
3041
|
+
/* @__PURE__ */ D(Be, { onSubtitleRef: n }),
|
|
3042
|
+
pn(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
3043
|
+
css: un,
|
|
2993
3044
|
style: { ...c ? {
|
|
2994
3045
|
opacity: "0",
|
|
2995
3046
|
visibility: "hidden",
|
|
@@ -2997,15 +3048,15 @@ ${wt}
|
|
|
2997
3048
|
} : {} },
|
|
2998
3049
|
children: t
|
|
2999
3050
|
}, e)),
|
|
3000
|
-
i === !1 ? null : /* @__PURE__ */ D(
|
|
3051
|
+
i === !1 ? null : /* @__PURE__ */ D(Qt, {
|
|
3001
3052
|
shortcuts: a,
|
|
3002
3053
|
root: v
|
|
3003
3054
|
}),
|
|
3004
|
-
/* @__PURE__ */ D(
|
|
3005
|
-
/* @__PURE__ */ D(
|
|
3055
|
+
/* @__PURE__ */ D(tn, {}),
|
|
3056
|
+
/* @__PURE__ */ D(cn, {}),
|
|
3006
3057
|
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
3007
3058
|
className: "pass-through",
|
|
3008
|
-
style: { clipPath:
|
|
3059
|
+
style: { clipPath: dn(d.armed, v.current.getBoundingClientRect()) },
|
|
3009
3060
|
onPointerOver: d.disarm
|
|
3010
3061
|
}) : null,
|
|
3011
3062
|
/* @__PURE__ */ O("div", {
|
|
@@ -3028,9 +3079,9 @@ ${wt}
|
|
|
3028
3079
|
})
|
|
3029
3080
|
]
|
|
3030
3081
|
});
|
|
3031
|
-
},
|
|
3082
|
+
}, hn = ({ options: e, children: t }) => {
|
|
3032
3083
|
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: d, thumbnailsEnabled: g, readsDownload: _ } = r ?? {}, v = x(), y = b(), [S, C] = h(null), [w, T] = h(null), E = n?.media ?? S;
|
|
3033
|
-
f(() => (v?.(E), () => v?.(null)), [E, v]);
|
|
3084
|
+
f(() => (v?.(E), () => v?.(null)), [E, v]), fe(E);
|
|
3034
3085
|
let { expose: O } = e, k = O === !0 ? {} : O || void 0, A = m(k);
|
|
3035
3086
|
A.current = k;
|
|
3036
3087
|
let j = k ? k.id : void 0, M = k ? k.origin : void 0, N = k ? k.channel : void 0;
|
|
@@ -3049,7 +3100,7 @@ ${wt}
|
|
|
3049
3100
|
M,
|
|
3050
3101
|
N
|
|
3051
3102
|
]);
|
|
3052
|
-
let P = p(() =>
|
|
3103
|
+
let P = p(() => Ne(), [o]);
|
|
3053
3104
|
le(S, w, r, _ ? P.push : void 0);
|
|
3054
3105
|
let F = r?.normalizeVolume ?? !0, [I, L] = h(F);
|
|
3055
3106
|
f(() => {
|
|
@@ -3059,7 +3110,7 @@ ${wt}
|
|
|
3059
3110
|
R.current = r?.onNormalizeVolumeChange;
|
|
3060
3111
|
let z = r?.normalizerWorkletUrl, B = m(d ?? u);
|
|
3061
3112
|
B.current = d ?? u;
|
|
3062
|
-
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } =
|
|
3113
|
+
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } = Me(S, z, I, p(() => H && o && c && l && typeof V == "number" && V >= 0 ? _ ? {
|
|
3063
3114
|
tap: P,
|
|
3064
3115
|
audioStreamIndex: V
|
|
3065
3116
|
} : {
|
|
@@ -3086,13 +3137,13 @@ ${wt}
|
|
|
3086
3137
|
z,
|
|
3087
3138
|
I,
|
|
3088
3139
|
ee
|
|
3089
|
-
]), { thumbnails: ne, requestThumbnail: U } =
|
|
3140
|
+
]), { thumbnails: ne, requestThumbnail: U } = he({
|
|
3090
3141
|
publicPath: c,
|
|
3091
3142
|
workerUrl: l,
|
|
3092
3143
|
length: g === !1 ? void 0 : o,
|
|
3093
3144
|
read: d ?? u,
|
|
3094
3145
|
downloadedRanges: s
|
|
3095
|
-
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } =
|
|
3146
|
+
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } = ge(S, w), q = Se(n?.media ?? null, n?.pictureInPicture), J = K((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
|
|
3096
3147
|
f(() => {
|
|
3097
3148
|
J({
|
|
3098
3149
|
title: i,
|
|
@@ -3158,7 +3209,7 @@ ${wt}
|
|
|
3158
3209
|
J({ quality: se });
|
|
3159
3210
|
}, [J, se]), f(() => {
|
|
3160
3211
|
a && J({ chapters: a });
|
|
3161
|
-
}, [J, a]), /* @__PURE__ */ D(
|
|
3212
|
+
}, [J, a]), /* @__PURE__ */ D(mn, {
|
|
3162
3213
|
ref: y,
|
|
3163
3214
|
onVideoRef: n ? void 0 : C,
|
|
3164
3215
|
onSubtitleRef: T,
|
|
@@ -3167,7 +3218,7 @@ ${wt}
|
|
|
3167
3218
|
shortcuts: e.shortcuts,
|
|
3168
3219
|
children: t
|
|
3169
3220
|
});
|
|
3170
|
-
},
|
|
3221
|
+
}, gn = _`
|
|
3171
3222
|
/**
|
|
3172
3223
|
* The chrome's whole scale, in one place.
|
|
3173
3224
|
*
|
|
@@ -3237,17 +3288,17 @@ ${wt}
|
|
|
3237
3288
|
height: 100%;
|
|
3238
3289
|
width: 100%;
|
|
3239
3290
|
overflow: hidden;
|
|
3240
|
-
`,
|
|
3241
|
-
css:
|
|
3242
|
-
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(
|
|
3291
|
+
`, _n = (e) => /* @__PURE__ */ D("div", {
|
|
3292
|
+
css: gn,
|
|
3293
|
+
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(hn, {
|
|
3243
3294
|
options: e,
|
|
3244
3295
|
children: e.children
|
|
3245
3296
|
}) })
|
|
3246
|
-
}),
|
|
3297
|
+
}), vn = (e) => !!e && typeof e == "object" && "at" in e, yn = (e) => !!e && typeof e == "object" && "selection" in e, bn = ({ blob: e, name: t }) => ({
|
|
3247
3298
|
length: e.size,
|
|
3248
3299
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3249
3300
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3250
|
-
}),
|
|
3301
|
+
}), xn = async (e, t) => {
|
|
3251
3302
|
let n = await fetch(e, {
|
|
3252
3303
|
headers: { Range: "bytes=0-1" },
|
|
3253
3304
|
credentials: t
|
|
@@ -3257,8 +3308,8 @@ ${wt}
|
|
|
3257
3308
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3258
3309
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3259
3310
|
return i;
|
|
3260
|
-
},
|
|
3261
|
-
let i = t ?? await
|
|
3311
|
+
}, Sn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3312
|
+
let i = t ?? await xn(e, r);
|
|
3262
3313
|
return {
|
|
3263
3314
|
length: i,
|
|
3264
3315
|
name: n,
|
|
@@ -3274,9 +3325,9 @@ ${wt}
|
|
|
3274
3325
|
},
|
|
3275
3326
|
readsDownload: !0
|
|
3276
3327
|
};
|
|
3277
|
-
},
|
|
3278
|
-
if ("blob" in e) return
|
|
3279
|
-
if ("url" in e) return
|
|
3328
|
+
}, Cn = async (e) => {
|
|
3329
|
+
if ("blob" in e) return bn(e);
|
|
3330
|
+
if ("url" in e) return Sn(e);
|
|
3280
3331
|
if ("read" in e) return {
|
|
3281
3332
|
length: e.length,
|
|
3282
3333
|
name: e.name,
|
|
@@ -3285,4 +3336,4 @@ ${wt}
|
|
|
3285
3336
|
throw Error(`Unknown source type: ${e}`);
|
|
3286
3337
|
};
|
|
3287
3338
|
//#endregion
|
|
3288
|
-
export {
|
|
3339
|
+
export { _n as MediaPlayer, _n as default, G as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, Cn as inputToRemuxerInput, yn as isDelegatedTracks, vn as isExternalThumbnails, W as sourceFeature, a as startPlayback, ge as usePictureInPicture, K as usePlayer, he as useSeekThumbnails };
|