@banou/media-player 0.10.24 → 0.10.25
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 +2 -1
- package/dist/index.js +258 -239
- package/dist/react/hooks/use-frame-step.d.ts +3 -1
- package/dist/react/source-feature.d.ts +8 -2
- package/dist/react/video-player.d.ts +9 -0
- package/dist/volume-normalizer-worklet.js +9 -5
- package/package.json +1 -1
- package/src/lib/audio/volume-normalizer-worklet.js +9 -5
- package/src/lib/react/hooks/use-frame-step.ts +65 -35
- package/src/lib/react/source-feature.ts +4 -1
- package/src/lib/react/video-player.tsx +10 -1
package/dist/index.js
CHANGED
|
@@ -275,57 +275,76 @@ var U = {
|
|
|
275
275
|
clearTimeout(r), n();
|
|
276
276
|
});
|
|
277
277
|
}), fe = (e) => {
|
|
278
|
-
let t =
|
|
278
|
+
let t = !1, n, r = async (i) => {
|
|
279
|
+
if (t) {
|
|
280
|
+
n = i;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
t = !0;
|
|
284
|
+
try {
|
|
285
|
+
await e(i);
|
|
286
|
+
} finally {
|
|
287
|
+
t = !1;
|
|
288
|
+
let e = n;
|
|
289
|
+
n = void 0, e && r(e);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
return r;
|
|
293
|
+
}, pe = (e, t) => {
|
|
294
|
+
let n = K(), r = K((e) => e.setSourceState), i = m(t);
|
|
295
|
+
i.current = t;
|
|
296
|
+
let a = !!t;
|
|
279
297
|
f(() => {
|
|
280
|
-
let
|
|
281
|
-
if (!
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
298
|
+
let t = e;
|
|
299
|
+
if (!t) return;
|
|
300
|
+
if (typeof t.requestVideoFrameCallback != "function") return a ? (r({ stepFrame: fe(async (e) => {
|
|
301
|
+
try {
|
|
302
|
+
await i.current?.(e);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
console.warn("the host could not step a frame", e);
|
|
305
|
+
}
|
|
306
|
+
}) }), () => r({ stepFrame: void 0 })) : void 0;
|
|
307
|
+
let o, s = !1, c = [], l = () => {
|
|
308
|
+
s = !0, o = void 0;
|
|
309
|
+
}, u = () => {
|
|
310
|
+
o = void 0, c.length = 0;
|
|
286
311
|
};
|
|
287
|
-
|
|
288
|
-
let
|
|
289
|
-
let
|
|
290
|
-
!
|
|
312
|
+
t.addEventListener("seeking", l), t.addEventListener("emptied", u);
|
|
313
|
+
let d = 0, f = (e, n) => {
|
|
314
|
+
let r = s;
|
|
315
|
+
!t.paused && !t.seeking && (s = !1), !r && !t.paused && t.playbackRate <= 1 && o && n.presentedFrames === o.presentedFrames + 1 && n.mediaTime > o.mediaTime && (c.push(n.mediaTime - o.mediaTime), c.length > 60 && c.shift()), o = r ? void 0 : n, d = t.requestVideoFrameCallback(f);
|
|
291
316
|
};
|
|
292
|
-
|
|
293
|
-
let
|
|
294
|
-
if (
|
|
295
|
-
let e = [...
|
|
317
|
+
d = t.requestVideoFrameCallback(f);
|
|
318
|
+
let p = () => {
|
|
319
|
+
if (c.length < 5) return ue;
|
|
320
|
+
let e = [...c].sort((e, t) => e - t), t = e[e.length >> 1], n = e.filter((e) => Math.abs(e - t) <= t / 4);
|
|
296
321
|
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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 });
|
|
322
|
+
}, m = fe(async (e) => {
|
|
323
|
+
t.paused || (t.pause(), await de(t, 100));
|
|
324
|
+
let r = p(), i = n.state.seekingTo, a = i === void 0 ? o ? o.mediaTime + (e > 0 ? 1.5 : -.5) * r : t.currentTime + e * r : i + e * r, s = Math.max(0, Math.min(a, t.duration || a)), c = new Promise((e) => {
|
|
325
|
+
let n = setTimeout(e, 1e3);
|
|
326
|
+
t.addEventListener("seeked", () => {
|
|
327
|
+
clearTimeout(n), e();
|
|
328
|
+
}, { once: !0 });
|
|
329
|
+
}), { requestSeek: l } = n.state;
|
|
330
|
+
l ? l(s) : t.currentTime = s, await c;
|
|
331
|
+
});
|
|
332
|
+
return r({ stepFrame: m }), () => {
|
|
333
|
+
t.removeEventListener("seeking", l), t.removeEventListener("emptied", u), t.cancelVideoFrameCallback(d), r({ stepFrame: void 0 });
|
|
316
334
|
};
|
|
317
335
|
}, [
|
|
318
336
|
e,
|
|
319
|
-
|
|
320
|
-
n
|
|
337
|
+
a,
|
|
338
|
+
n,
|
|
339
|
+
r
|
|
321
340
|
]);
|
|
322
|
-
},
|
|
341
|
+
}, me = 5e3, he = 6e4, ge = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
323
342
|
let [o, s] = h([]), c = m(null), l = m(r);
|
|
324
343
|
l.current = r;
|
|
325
344
|
let u = p(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = m(u);
|
|
326
345
|
return g.current = u, f(() => {
|
|
327
346
|
if (!n || !r || !e || !t) return;
|
|
328
|
-
let a = !1, o = null, u, d =
|
|
347
|
+
let a = !1, o = null, u, d = me, f = () => {
|
|
329
348
|
i({
|
|
330
349
|
publicPath: e,
|
|
331
350
|
workerUrl: t,
|
|
@@ -341,7 +360,7 @@ var U = {
|
|
|
341
360
|
}
|
|
342
361
|
o = e, c.current = e, e.update(g.current);
|
|
343
362
|
}, () => {
|
|
344
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
363
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, he));
|
|
345
364
|
});
|
|
346
365
|
};
|
|
347
366
|
return f(), () => {
|
|
@@ -359,7 +378,7 @@ var U = {
|
|
|
359
378
|
c.current?.prioritize(e);
|
|
360
379
|
}, [])
|
|
361
380
|
};
|
|
362
|
-
},
|
|
381
|
+
}, _e = (e, t) => {
|
|
363
382
|
let r = m(null), [i, a] = h(!1), [s] = h(() => n());
|
|
364
383
|
f(() => {
|
|
365
384
|
if (!e || !t || !s) return;
|
|
@@ -387,10 +406,10 @@ var U = {
|
|
|
387
406
|
mode: s,
|
|
388
407
|
burnedIn: i
|
|
389
408
|
};
|
|
390
|
-
},
|
|
391
|
-
let t =
|
|
409
|
+
}, ve = "(hover: hover) and (pointer: fine)", ye = () => typeof matchMedia == "function" ? matchMedia(ve) : void 0, be = (e) => {
|
|
410
|
+
let t = ye();
|
|
392
411
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
393
|
-
},
|
|
412
|
+
}, xe = () => !!ye()?.matches, Se = () => !1, Ce = (e, t) => {
|
|
394
413
|
let [n, r] = h(!1), [i, a] = h(), o = m(t);
|
|
395
414
|
t && (o.current = t);
|
|
396
415
|
let s = m(!1), c = d((e) => {
|
|
@@ -413,7 +432,7 @@ var U = {
|
|
|
413
432
|
_,
|
|
414
433
|
u
|
|
415
434
|
]);
|
|
416
|
-
let v = g(
|
|
435
|
+
let v = g(be, xe, Se), [y, b] = h(!1);
|
|
417
436
|
f(() => {
|
|
418
437
|
if (!_) return;
|
|
419
438
|
let e = (e) => {
|
|
@@ -454,16 +473,16 @@ var U = {
|
|
|
454
473
|
u,
|
|
455
474
|
S
|
|
456
475
|
]);
|
|
457
|
-
},
|
|
476
|
+
}, we = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
458
477
|
channelCountMode: "max",
|
|
459
478
|
processorOptions: n
|
|
460
|
-
})),
|
|
479
|
+
})), Te = /* @__PURE__ */ new WeakMap(), Ee = (e) => new Promise((t, n) => {
|
|
461
480
|
let r = () => {
|
|
462
481
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
463
482
|
};
|
|
464
483
|
e.addEventListener("statechange", r), r();
|
|
465
|
-
}),
|
|
466
|
-
let r =
|
|
484
|
+
}), De = (e, t, n = {}) => {
|
|
485
|
+
let r = Te.get(e);
|
|
467
486
|
if (r) return r.wake(), r;
|
|
468
487
|
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 = () => {
|
|
469
488
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -479,12 +498,12 @@ var U = {
|
|
|
479
498
|
};
|
|
480
499
|
i.addEventListener("statechange", f), f();
|
|
481
500
|
let p = (async () => {
|
|
482
|
-
let r = await
|
|
501
|
+
let r = await we(i, t, {
|
|
483
502
|
...n,
|
|
484
503
|
enabled: a,
|
|
485
504
|
inputGainDb: c()
|
|
486
505
|
});
|
|
487
|
-
await
|
|
506
|
+
await Ee(i);
|
|
488
507
|
let s = T(i, e);
|
|
489
508
|
return r.port.postMessage({
|
|
490
509
|
enabled: a,
|
|
@@ -501,14 +520,14 @@ var U = {
|
|
|
501
520
|
a = e, o?.port.postMessage({ enabled: a });
|
|
502
521
|
},
|
|
503
522
|
release: () => {
|
|
504
|
-
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
523
|
+
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (Te.delete(e), i.close().catch(() => {}));
|
|
505
524
|
},
|
|
506
525
|
wake: () => {
|
|
507
526
|
i.state !== "closed" && (s = !1, u(), f());
|
|
508
527
|
}
|
|
509
528
|
};
|
|
510
|
-
return
|
|
511
|
-
},
|
|
529
|
+
return Te.set(e, m), m;
|
|
530
|
+
}, Oe = 20, ke = 5, Ae = 1, je = 50, Me = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
512
531
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
513
532
|
for (let e of [...c]) e();
|
|
514
533
|
c.clear();
|
|
@@ -555,7 +574,7 @@ var U = {
|
|
|
555
574
|
}), S = () => p.postMessage({
|
|
556
575
|
type: "playhead",
|
|
557
576
|
time: n.currentTime
|
|
558
|
-
}), C = setInterval(x,
|
|
577
|
+
}), C = setInterval(x, je), T = [
|
|
559
578
|
"play",
|
|
560
579
|
"playing",
|
|
561
580
|
"pause",
|
|
@@ -572,7 +591,7 @@ var U = {
|
|
|
572
591
|
return t >= (h.end ?? E) - .05 ? null : t;
|
|
573
592
|
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
574
593
|
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
575
|
-
if (t !== null && t < e +
|
|
594
|
+
if (t !== null && t < e + Oe) return r && A <= t + 1 && t <= j + ke ? "read" : P(t);
|
|
576
595
|
if (r) return "read";
|
|
577
596
|
let i = t ?? N(0);
|
|
578
597
|
return i === null ? "done" : P(i);
|
|
@@ -636,7 +655,7 @@ var U = {
|
|
|
636
655
|
await H(e), e.finished && await V(!0);
|
|
637
656
|
} else {
|
|
638
657
|
await V(!1), M.set(Math.round(e * 10), g);
|
|
639
|
-
let t = B.seek(Math.max(0, e -
|
|
658
|
+
let t = B.seek(Math.max(0, e - Ae));
|
|
640
659
|
f(!0);
|
|
641
660
|
let n = await L(t);
|
|
642
661
|
if (a) return;
|
|
@@ -706,12 +725,12 @@ var U = {
|
|
|
706
725
|
},
|
|
707
726
|
stop: U
|
|
708
727
|
};
|
|
709
|
-
},
|
|
728
|
+
}, Ne = (e, t, n, r, i) => {
|
|
710
729
|
let a = m(null), [o, s] = h(!1), [c, l] = h(null);
|
|
711
730
|
f(() => {
|
|
712
731
|
if (e && t) {
|
|
713
732
|
if (n && !a.current) {
|
|
714
|
-
let r =
|
|
733
|
+
let r = De(e, t, { enabled: n });
|
|
715
734
|
a.current = r, r.routed.then((e) => {
|
|
716
735
|
a.current === r && l(e);
|
|
717
736
|
}, (e) => {
|
|
@@ -735,7 +754,7 @@ var U = {
|
|
|
735
754
|
return f(() => {
|
|
736
755
|
let r = p.current;
|
|
737
756
|
if (!c || !e || !t || !n || !r) return;
|
|
738
|
-
let i =
|
|
757
|
+
let i = Me({
|
|
739
758
|
node: c,
|
|
740
759
|
element: e,
|
|
741
760
|
scriptUrl: t,
|
|
@@ -757,7 +776,7 @@ var U = {
|
|
|
757
776
|
]), f(() => {
|
|
758
777
|
d.current?.update(i);
|
|
759
778
|
}, [i]), { refused: o };
|
|
760
|
-
},
|
|
779
|
+
}, Pe = () => {
|
|
761
780
|
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
762
781
|
return {
|
|
763
782
|
push: (n) => {
|
|
@@ -806,7 +825,7 @@ var U = {
|
|
|
806
825
|
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 ",
|
|
807
826
|
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 "
|
|
808
827
|
}
|
|
809
|
-
},
|
|
828
|
+
}, Fe = _`
|
|
810
829
|
display: flex;
|
|
811
830
|
justify-content: center;
|
|
812
831
|
align-items: center;
|
|
@@ -819,7 +838,7 @@ var U = {
|
|
|
819
838
|
margin: auto;
|
|
820
839
|
pointer-events: none;
|
|
821
840
|
}
|
|
822
|
-
`,
|
|
841
|
+
`, Ie = _`
|
|
823
842
|
position: absolute;
|
|
824
843
|
top: 0;
|
|
825
844
|
left: 0;
|
|
@@ -848,9 +867,9 @@ var U = {
|
|
|
848
867
|
|
|
849
868
|
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%);
|
|
850
869
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
851
|
-
`,
|
|
870
|
+
`, Le = v`
|
|
852
871
|
to { transform: rotate(360deg); }
|
|
853
|
-
`,
|
|
872
|
+
`, Re = _`
|
|
854
873
|
position: absolute;
|
|
855
874
|
inset: 0;
|
|
856
875
|
z-index: 2;
|
|
@@ -866,9 +885,9 @@ var U = {
|
|
|
866
885
|
border-radius: 50%;
|
|
867
886
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
868
887
|
border-top-color: #fff;
|
|
869
|
-
animation: ${
|
|
888
|
+
animation: ${Le} 0.8s linear infinite;
|
|
870
889
|
}
|
|
871
|
-
`,
|
|
890
|
+
`, ze = _`
|
|
872
891
|
position: absolute;
|
|
873
892
|
inset: auto 0 20%;
|
|
874
893
|
z-index: 3;
|
|
@@ -878,34 +897,34 @@ var U = {
|
|
|
878
897
|
${Z.bLarge.regular}
|
|
879
898
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
880
899
|
pointer-events: none;
|
|
881
|
-
`,
|
|
900
|
+
`, Be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ve = ({ onSubtitleRef: e }) => {
|
|
882
901
|
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);
|
|
883
902
|
return /* @__PURE__ */ O(E, { children: [
|
|
884
903
|
t ? /* @__PURE__ */ D("div", {
|
|
885
904
|
className: "title",
|
|
886
|
-
css:
|
|
905
|
+
css: Ie,
|
|
887
906
|
style: { ...n ? {
|
|
888
907
|
opacity: "0",
|
|
889
908
|
pointerEvents: "none"
|
|
890
909
|
} : {} },
|
|
891
910
|
children: t
|
|
892
911
|
}) : void 0,
|
|
893
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css:
|
|
912
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Re }) : void 0,
|
|
894
913
|
r ? /* @__PURE__ */ D("div", {
|
|
895
|
-
css:
|
|
896
|
-
children:
|
|
914
|
+
css: ze,
|
|
915
|
+
children: Be(r)
|
|
897
916
|
}) : void 0,
|
|
898
917
|
/* @__PURE__ */ D("div", {
|
|
899
918
|
className: "subtitles",
|
|
900
919
|
ref: e,
|
|
901
|
-
css:
|
|
920
|
+
css: Fe
|
|
902
921
|
})
|
|
903
922
|
] });
|
|
904
|
-
},
|
|
923
|
+
}, He = 1e-4, Ue = 1, We = (e) => Math.max(He, Math.min(Ue, e)) ** 2, Ge = (e) => Math.max(He, Math.min(Ue, e)) ** (Ue / 2), Ke = (e) => {
|
|
905
924
|
if (e === void 0) return "0:00";
|
|
906
925
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
907
926
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
908
|
-
},
|
|
927
|
+
}, qe = (e, t) => `${Ke(e)} / ${Ke(t)}`, Je = (e) => _`
|
|
909
928
|
display: flex;
|
|
910
929
|
justify-content: flex-start;
|
|
911
930
|
|
|
@@ -953,17 +972,17 @@ var U = {
|
|
|
953
972
|
x: -1,
|
|
954
973
|
y: -1,
|
|
955
974
|
anchors: 0
|
|
956
|
-
},
|
|
975
|
+
}, Ye = (e) => {
|
|
957
976
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
958
|
-
},
|
|
977
|
+
}, Xe = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Ye, {
|
|
959
978
|
capture: !0,
|
|
960
979
|
passive: !0
|
|
961
980
|
}), () => {
|
|
962
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
981
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", Ye, { capture: !0 });
|
|
963
982
|
}), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
964
983
|
let l = m(null), u = m(null);
|
|
965
984
|
return f(() => {
|
|
966
|
-
let e =
|
|
985
|
+
let e = Xe(), t = () => {
|
|
967
986
|
let e = l.current;
|
|
968
987
|
if (!e) return;
|
|
969
988
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -985,12 +1004,12 @@ var U = {
|
|
|
985
1004
|
children: n
|
|
986
1005
|
}), !s && /* @__PURE__ */ D(ne, {
|
|
987
1006
|
ref: u,
|
|
988
|
-
css:
|
|
1007
|
+
css: Je(c),
|
|
989
1008
|
id: e,
|
|
990
1009
|
noArrow: !0,
|
|
991
1010
|
children: t
|
|
992
1011
|
})] });
|
|
993
|
-
},
|
|
1012
|
+
}, Ze = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
994
1013
|
let [i, a] = h(!1), o = m(t);
|
|
995
1014
|
o.current = t;
|
|
996
1015
|
let s = m(null), c = d((t, r) => {
|
|
@@ -1029,26 +1048,26 @@ var U = {
|
|
|
1029
1048
|
style: { touchAction: "none" }
|
|
1030
1049
|
}
|
|
1031
1050
|
};
|
|
1032
|
-
},
|
|
1051
|
+
}, Qe = 2, $e = .005, et = "#000", tt = "#0000", nt = (e, t) => {
|
|
1033
1052
|
if (!t) return [];
|
|
1034
1053
|
let n = /* @__PURE__ */ new Set();
|
|
1035
1054
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
1036
1055
|
let r = e / t;
|
|
1037
|
-
r <=
|
|
1056
|
+
r <= $e || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
1038
1057
|
}
|
|
1039
1058
|
return n.size ? [
|
|
1040
1059
|
0,
|
|
1041
1060
|
...[...n].sort((e, t) => e - t),
|
|
1042
1061
|
100
|
|
1043
1062
|
] : [];
|
|
1044
|
-
},
|
|
1045
|
-
let n =
|
|
1063
|
+
}, rt = (e, t) => {
|
|
1064
|
+
let n = Qe / 2, r = e.length - 2, i = [];
|
|
1046
1065
|
for (let a = 0; a <= r; a += 1) {
|
|
1047
1066
|
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
1048
|
-
i.push(`${t(a) ?
|
|
1067
|
+
i.push(`${t(a) ? et : tt} ${c} ${l}`), a !== r && i.push(`${tt} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
1049
1068
|
}
|
|
1050
1069
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
1051
|
-
},
|
|
1070
|
+
}, it = /* @__PURE__ */ new Set([
|
|
1052
1071
|
"op",
|
|
1053
1072
|
"ops",
|
|
1054
1073
|
"opening",
|
|
@@ -1056,7 +1075,7 @@ var U = {
|
|
|
1056
1075
|
"ncop",
|
|
1057
1076
|
"オープニング",
|
|
1058
1077
|
"op主題歌"
|
|
1059
|
-
]),
|
|
1078
|
+
]), at = /* @__PURE__ */ new Set([
|
|
1060
1079
|
"ed",
|
|
1061
1080
|
"eds",
|
|
1062
1081
|
"ending",
|
|
@@ -1069,13 +1088,13 @@ var U = {
|
|
|
1069
1088
|
"エンドカード",
|
|
1070
1089
|
"エンドロール",
|
|
1071
1090
|
"ed主題歌"
|
|
1072
|
-
]),
|
|
1091
|
+
]), ot = /* @__PURE__ */ new Set(["intro", "イントロ"]), st = /* @__PURE__ */ new Set(["outro", "アウトロ"]), ct = {
|
|
1073
1092
|
"credits start": "ending",
|
|
1074
1093
|
"credits end": null,
|
|
1075
1094
|
"preview end": null,
|
|
1076
1095
|
"end credits": "ending",
|
|
1077
1096
|
"closing credits": "ending"
|
|
1078
|
-
},
|
|
1097
|
+
}, lt = /* @__PURE__ */ new Set([
|
|
1079
1098
|
"theme",
|
|
1080
1099
|
"themes",
|
|
1081
1100
|
"song",
|
|
@@ -1094,53 +1113,53 @@ var U = {
|
|
|
1094
1113
|
"the",
|
|
1095
1114
|
"主題歌",
|
|
1096
1115
|
"ノンクレジット"
|
|
1097
|
-
]),
|
|
1116
|
+
]), ut = /* @__PURE__ */ new Set([
|
|
1098
1117
|
"post",
|
|
1099
1118
|
"pre",
|
|
1100
1119
|
"after",
|
|
1101
1120
|
"before",
|
|
1102
1121
|
"non"
|
|
1103
|
-
]),
|
|
1104
|
-
if (
|
|
1105
|
-
if (
|
|
1122
|
+
]), dt = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, ft = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), pt = (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) && !lt.has(e)), mt = (e, t) => {
|
|
1123
|
+
if (it.has(e)) return "opening";
|
|
1124
|
+
if (at.has(e)) return "ending";
|
|
1106
1125
|
if (t) {
|
|
1107
|
-
if (
|
|
1108
|
-
if (
|
|
1126
|
+
if (ot.has(e)) return "opening";
|
|
1127
|
+
if (st.has(e)) return "ending";
|
|
1109
1128
|
}
|
|
1110
|
-
},
|
|
1111
|
-
if (
|
|
1129
|
+
}, ht = (e, t) => {
|
|
1130
|
+
if (ft(e)) return;
|
|
1112
1131
|
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
1113
|
-
if (n in
|
|
1114
|
-
let r = n.split(
|
|
1115
|
-
if (r.some((e) => e.split(/[\s_]+/u).some((e) =>
|
|
1132
|
+
if (n in ct) return ct[n] ?? void 0;
|
|
1133
|
+
let r = n.split(dt).map((e) => e.trim()).filter(Boolean);
|
|
1134
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => ut.has(e)))) return;
|
|
1116
1135
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
1117
1136
|
for (let e of i) {
|
|
1118
|
-
let n =
|
|
1137
|
+
let n = pt(e);
|
|
1119
1138
|
if (n.length !== 1) continue;
|
|
1120
|
-
let r =
|
|
1139
|
+
let r = mt(n[0], t);
|
|
1121
1140
|
if (r) return r;
|
|
1122
1141
|
}
|
|
1123
|
-
},
|
|
1142
|
+
}, gt = 15, _t = 87, vt = 93, yt = (e) => {
|
|
1124
1143
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
1125
1144
|
if (!n) return t;
|
|
1126
1145
|
let r = e.map((e, t) => ({
|
|
1127
1146
|
index: t,
|
|
1128
1147
|
start: e.start,
|
|
1129
1148
|
length: e.end - e.start
|
|
1130
|
-
})).filter(({ length: e }) => e >=
|
|
1149
|
+
})).filter(({ length: e }) => e >= _t && e <= vt), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
1131
1150
|
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
1132
|
-
},
|
|
1133
|
-
let t = e.map(({ title: e }) =>
|
|
1151
|
+
}, bt = (e) => {
|
|
1152
|
+
let t = e.map(({ title: e }) => ht(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);
|
|
1134
1153
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
1135
1154
|
let i = e.map((e, n) => {
|
|
1136
|
-
if (e.end - e.start <
|
|
1155
|
+
if (e.end - e.start < gt) return;
|
|
1137
1156
|
let r = t[n];
|
|
1138
1157
|
if (r) return r;
|
|
1139
|
-
let i =
|
|
1158
|
+
let i = ht(e.title, !0);
|
|
1140
1159
|
return i && !t.includes(i) ? i : void 0;
|
|
1141
1160
|
});
|
|
1142
|
-
return e.every(({ title: e }) =>
|
|
1143
|
-
},
|
|
1161
|
+
return e.every(({ title: e }) => ft(e)) ? yt(e) : i;
|
|
1162
|
+
}, xt = _`
|
|
1144
1163
|
position: relative;
|
|
1145
1164
|
height: calc(.4 * var(--mp-unit));
|
|
1146
1165
|
|
|
@@ -1359,7 +1378,7 @@ var U = {
|
|
|
1359
1378
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1360
1379
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1361
1380
|
}
|
|
1362
|
-
`,
|
|
1381
|
+
`, St = 4, Ct = () => {
|
|
1363
1382
|
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) => {
|
|
1364
1383
|
C(e), u(e);
|
|
1365
1384
|
}, T = !!S;
|
|
@@ -1368,13 +1387,13 @@ var U = {
|
|
|
1368
1387
|
}, [_, T]), f(() => {
|
|
1369
1388
|
v && w(void 0);
|
|
1370
1389
|
}, [v]);
|
|
1371
|
-
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } =
|
|
1390
|
+
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = Ze({
|
|
1372
1391
|
ref: y,
|
|
1373
1392
|
onChange: (e) => {
|
|
1374
1393
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1375
1394
|
else if (!M.current) {
|
|
1376
1395
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1377
|
-
Math.abs(e - j.current) * t >
|
|
1396
|
+
Math.abs(e - j.current) * t > St && (M.current = !0);
|
|
1378
1397
|
}
|
|
1379
1398
|
x(e), E.current !== "mouse" && w(e * r);
|
|
1380
1399
|
}
|
|
@@ -1437,7 +1456,7 @@ var U = {
|
|
|
1437
1456
|
N,
|
|
1438
1457
|
b,
|
|
1439
1458
|
g
|
|
1440
|
-
]), U = p(() =>
|
|
1459
|
+
]), U = p(() => nt(d, r), [d, r]), W = U.length > 0, G = p(() => {
|
|
1441
1460
|
if (!W || S === void 0 || !r) return -1;
|
|
1442
1461
|
let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
|
|
1443
1462
|
return t >= 0 ? t : U.length - 2;
|
|
@@ -1446,11 +1465,11 @@ var U = {
|
|
|
1446
1465
|
U,
|
|
1447
1466
|
S,
|
|
1448
1467
|
r
|
|
1449
|
-
]), re = p(() => W ?
|
|
1468
|
+
]), re = p(() => W ? rt(U, (e) => e !== G) : void 0, [
|
|
1450
1469
|
W,
|
|
1451
1470
|
U,
|
|
1452
1471
|
G
|
|
1453
|
-
]), ie = p(() => G >= 0 ?
|
|
1472
|
+
]), ie = p(() => G >= 0 ? rt(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
|
|
1454
1473
|
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1455
1474
|
}, [d, S]), J = p(() => {
|
|
1456
1475
|
if (S) {
|
|
@@ -1480,7 +1499,7 @@ var U = {
|
|
|
1480
1499
|
]
|
|
1481
1500
|
});
|
|
1482
1501
|
return /* @__PURE__ */ O("div", {
|
|
1483
|
-
css:
|
|
1502
|
+
css: xt,
|
|
1484
1503
|
ref: y,
|
|
1485
1504
|
className: [
|
|
1486
1505
|
"progress-bar",
|
|
@@ -1501,7 +1520,7 @@ var U = {
|
|
|
1501
1520
|
},
|
|
1502
1521
|
children: [/* @__PURE__ */ D("span", {
|
|
1503
1522
|
className: "cursor-time-value",
|
|
1504
|
-
children:
|
|
1523
|
+
children: Ke(S)
|
|
1505
1524
|
}), q ? /* @__PURE__ */ D("span", {
|
|
1506
1525
|
className: "chapter-title",
|
|
1507
1526
|
children: q.title
|
|
@@ -1525,7 +1544,7 @@ var U = {
|
|
|
1525
1544
|
})
|
|
1526
1545
|
]
|
|
1527
1546
|
});
|
|
1528
|
-
},
|
|
1547
|
+
}, wt = "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", Tt = {
|
|
1529
1548
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1530
1549
|
width: 24,
|
|
1531
1550
|
height: 24,
|
|
@@ -1535,8 +1554,8 @@ var U = {
|
|
|
1535
1554
|
strokeWidth: 2,
|
|
1536
1555
|
strokeLinecap: "round",
|
|
1537
1556
|
strokeLinejoin: "round"
|
|
1538
|
-
},
|
|
1539
|
-
...
|
|
1557
|
+
}, Et = (e) => /* @__PURE__ */ O("svg", {
|
|
1558
|
+
...Tt,
|
|
1540
1559
|
...e,
|
|
1541
1560
|
children: [
|
|
1542
1561
|
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1550,8 +1569,8 @@ var U = {
|
|
|
1550
1569
|
}),
|
|
1551
1570
|
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1552
1571
|
]
|
|
1553
|
-
}),
|
|
1554
|
-
...
|
|
1572
|
+
}), Dt = (e) => /* @__PURE__ */ O("svg", {
|
|
1573
|
+
...Tt,
|
|
1555
1574
|
...e,
|
|
1556
1575
|
children: [
|
|
1557
1576
|
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
@@ -1565,7 +1584,7 @@ var U = {
|
|
|
1565
1584
|
}),
|
|
1566
1585
|
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1567
1586
|
]
|
|
1568
|
-
}),
|
|
1587
|
+
}), Ot = _`
|
|
1569
1588
|
.popover {
|
|
1570
1589
|
position: absolute;
|
|
1571
1590
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1692,7 +1711,7 @@ var U = {
|
|
|
1692
1711
|
${Z.bSmall.regular}
|
|
1693
1712
|
}
|
|
1694
1713
|
}
|
|
1695
|
-
`,
|
|
1714
|
+
`, kt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1696
1715
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1697
1716
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1698
1717
|
return /* @__PURE__ */ O("div", {
|
|
@@ -1719,7 +1738,7 @@ var U = {
|
|
|
1719
1738
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1720
1739
|
]
|
|
1721
1740
|
});
|
|
1722
|
-
},
|
|
1741
|
+
}, At = ({ onReset: e } = {}) => {
|
|
1723
1742
|
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1724
1743
|
c.current = e;
|
|
1725
1744
|
let l = () => {
|
|
@@ -1760,7 +1779,7 @@ var U = {
|
|
|
1760
1779
|
});
|
|
1761
1780
|
}
|
|
1762
1781
|
};
|
|
1763
|
-
},
|
|
1782
|
+
}, jt = _`
|
|
1764
1783
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1765
1784
|
which is the width of the player box, so it can be clamped to it. */
|
|
1766
1785
|
position: static;
|
|
@@ -1776,7 +1795,7 @@ position: static;
|
|
|
1776
1795
|
}
|
|
1777
1796
|
}
|
|
1778
1797
|
|
|
1779
|
-
${
|
|
1798
|
+
${Ot}
|
|
1780
1799
|
|
|
1781
1800
|
.popover.error-list {
|
|
1782
1801
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1848,23 +1867,23 @@ ${Dt}
|
|
|
1848
1867
|
}
|
|
1849
1868
|
}
|
|
1850
1869
|
}
|
|
1851
|
-
`,
|
|
1852
|
-
let n =
|
|
1870
|
+
`, Mt = (e) => new Date(e).toLocaleTimeString(), Nt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Ke(Math.max(0, e)), Pt = (e) => e.reduce((e, t) => e + t.count, 0), Ft = (e) => e.map((e, t) => {
|
|
1871
|
+
let n = Nt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1853
1872
|
return [
|
|
1854
1873
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1855
1874
|
e.message,
|
|
1856
1875
|
e.detail
|
|
1857
1876
|
].filter(Boolean).join("\n");
|
|
1858
|
-
}).join("\n\n"),
|
|
1859
|
-
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } =
|
|
1877
|
+
}).join("\n\n"), It = () => {
|
|
1878
|
+
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = At(), [i, a] = h(!1);
|
|
1860
1879
|
if (e.length === 0) return null;
|
|
1861
1880
|
let o = () => {
|
|
1862
|
-
navigator.clipboard?.writeText(
|
|
1881
|
+
navigator.clipboard?.writeText(Ft(e)).then(() => {
|
|
1863
1882
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1864
1883
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1865
|
-
}, s = `Playback errors (${
|
|
1884
|
+
}, s = `Playback errors (${Pt(e)})`;
|
|
1866
1885
|
return /* @__PURE__ */ O("div", {
|
|
1867
|
-
css:
|
|
1886
|
+
css: jt,
|
|
1868
1887
|
ref: r,
|
|
1869
1888
|
children: [/* @__PURE__ */ D($, {
|
|
1870
1889
|
id: "errors",
|
|
@@ -1895,9 +1914,9 @@ ${Dt}
|
|
|
1895
1914
|
/* @__PURE__ */ O("span", {
|
|
1896
1915
|
className: "when",
|
|
1897
1916
|
children: [
|
|
1898
|
-
|
|
1899
|
-
e.count > 1 ? ` to ${
|
|
1900
|
-
|
|
1917
|
+
Mt(e.at),
|
|
1918
|
+
e.count > 1 ? ` to ${Mt(e.lastAt)}` : "",
|
|
1919
|
+
Nt(e.atMediaTime) ? ` at ${Nt(e.atMediaTime)}` : "",
|
|
1901
1920
|
e.recovered ? " recovered" : "",
|
|
1902
1921
|
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1903
1922
|
className: "count",
|
|
@@ -1917,7 +1936,7 @@ ${Dt}
|
|
|
1917
1936
|
}, `${e.at}-${t}`))]
|
|
1918
1937
|
})]
|
|
1919
1938
|
});
|
|
1920
|
-
},
|
|
1939
|
+
}, Lt = _`
|
|
1921
1940
|
display: flex;
|
|
1922
1941
|
align-items: center;
|
|
1923
1942
|
justify-content: center;
|
|
@@ -1970,8 +1989,8 @@ width: 100%;
|
|
|
1970
1989
|
}
|
|
1971
1990
|
}
|
|
1972
1991
|
}
|
|
1973
|
-
`,
|
|
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 } =
|
|
1992
|
+
`, Rt = () => {
|
|
1993
|
+
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 } = Ze({
|
|
1975
1994
|
ref: r,
|
|
1976
1995
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1977
1996
|
}), d = (t) => {
|
|
@@ -1987,7 +2006,7 @@ width: 100%;
|
|
|
1987
2006
|
}, [t]);
|
|
1988
2007
|
let p = c(s);
|
|
1989
2008
|
return /* @__PURE__ */ O("div", {
|
|
1990
|
-
css:
|
|
2009
|
+
css: Lt,
|
|
1991
2010
|
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1992
2011
|
className: "playback-slider",
|
|
1993
2012
|
ref: n,
|
|
@@ -2005,7 +2024,7 @@ width: 100%;
|
|
|
2005
2024
|
})
|
|
2006
2025
|
})]
|
|
2007
2026
|
});
|
|
2008
|
-
},
|
|
2027
|
+
}, zt = _`
|
|
2009
2028
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
2010
2029
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
2011
2030
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -2023,7 +2042,7 @@ position: static;
|
|
|
2023
2042
|
}
|
|
2024
2043
|
}
|
|
2025
2044
|
|
|
2026
|
-
${
|
|
2045
|
+
${Ot}
|
|
2027
2046
|
|
|
2028
2047
|
.switch {
|
|
2029
2048
|
position: relative;
|
|
@@ -2099,8 +2118,8 @@ ${Dt}
|
|
|
2099
2118
|
}
|
|
2100
2119
|
}
|
|
2101
2120
|
|
|
2102
|
-
`,
|
|
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 } =
|
|
2121
|
+
`, Bt = () => {
|
|
2122
|
+
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 } = At({ onReset: () => c(0) }), g = (t) => {
|
|
2104
2123
|
e.setPlaybackRate(t), c(0);
|
|
2105
2124
|
}, _ = (e) => {
|
|
2106
2125
|
e !== void 0 && m(e, () => i(e));
|
|
@@ -2110,7 +2129,7 @@ ${Dt}
|
|
|
2110
2129
|
c(e);
|
|
2111
2130
|
};
|
|
2112
2131
|
return /* @__PURE__ */ O("div", {
|
|
2113
|
-
css:
|
|
2132
|
+
css: zt,
|
|
2114
2133
|
ref: d,
|
|
2115
2134
|
children: [
|
|
2116
2135
|
/* @__PURE__ */ D($, {
|
|
@@ -2172,7 +2191,7 @@ ${Dt}
|
|
|
2172
2191
|
}),
|
|
2173
2192
|
/* @__PURE__ */ D("div", {
|
|
2174
2193
|
className: "slider no-hover",
|
|
2175
|
-
children: /* @__PURE__ */ D(
|
|
2194
|
+
children: /* @__PURE__ */ D(Rt, {})
|
|
2176
2195
|
}),
|
|
2177
2196
|
/* @__PURE__ */ O("div", {
|
|
2178
2197
|
className: "options no-hover",
|
|
@@ -2197,7 +2216,7 @@ ${Dt}
|
|
|
2197
2216
|
})
|
|
2198
2217
|
]
|
|
2199
2218
|
}),
|
|
2200
|
-
l && s === 2 && /* @__PURE__ */ D(
|
|
2219
|
+
l && s === 2 && /* @__PURE__ */ D(kt, {
|
|
2201
2220
|
title: "Audio",
|
|
2202
2221
|
tracks: n,
|
|
2203
2222
|
selected: r,
|
|
@@ -2206,7 +2225,7 @@ ${Dt}
|
|
|
2206
2225
|
pending: f,
|
|
2207
2226
|
failed: p
|
|
2208
2227
|
}),
|
|
2209
|
-
l && s === 3 && a && /* @__PURE__ */ D(
|
|
2228
|
+
l && s === 3 && a && /* @__PURE__ */ D(kt, {
|
|
2210
2229
|
title: "Quality",
|
|
2211
2230
|
tracks: a.options,
|
|
2212
2231
|
selected: a.selectedId ?? void 0,
|
|
@@ -2218,7 +2237,7 @@ ${Dt}
|
|
|
2218
2237
|
})
|
|
2219
2238
|
]
|
|
2220
2239
|
});
|
|
2221
|
-
},
|
|
2240
|
+
}, Vt = _`
|
|
2222
2241
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2223
2242
|
which is the width of the player box, so it can be clamped to it. */
|
|
2224
2243
|
position: static;
|
|
@@ -2234,13 +2253,13 @@ position: static;
|
|
|
2234
2253
|
}
|
|
2235
2254
|
}
|
|
2236
2255
|
|
|
2237
|
-
${
|
|
2238
|
-
`,
|
|
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 } =
|
|
2256
|
+
${Ot}
|
|
2257
|
+
`, Ht = () => {
|
|
2258
|
+
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 } = At();
|
|
2240
2259
|
if (e.length === 0) return null;
|
|
2241
2260
|
let u = t !== void 0;
|
|
2242
2261
|
return /* @__PURE__ */ O("div", {
|
|
2243
|
-
css:
|
|
2262
|
+
css: Vt,
|
|
2244
2263
|
ref: o,
|
|
2245
2264
|
children: [/* @__PURE__ */ D($, {
|
|
2246
2265
|
id: "subtitles",
|
|
@@ -2255,7 +2274,7 @@ ${Dt}
|
|
|
2255
2274
|
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
2256
2275
|
}),
|
|
2257
2276
|
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2258
|
-
}), i && /* @__PURE__ */ D(
|
|
2277
|
+
}), i && /* @__PURE__ */ D(kt, {
|
|
2259
2278
|
title: "Subtitles",
|
|
2260
2279
|
tracks: e,
|
|
2261
2280
|
selected: t,
|
|
@@ -2265,13 +2284,13 @@ ${Dt}
|
|
|
2265
2284
|
failed: c
|
|
2266
2285
|
})]
|
|
2267
2286
|
});
|
|
2268
|
-
},
|
|
2287
|
+
}, Ut = {
|
|
2269
2288
|
primary: "#EAEBEE",
|
|
2270
2289
|
secondary: "#D0D0D9",
|
|
2271
2290
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2272
2291
|
borderPrimary: "#384F70",
|
|
2273
2292
|
backgroundTooltip: "#222222"
|
|
2274
|
-
},
|
|
2293
|
+
}, Wt = _`
|
|
2275
2294
|
display: flex;
|
|
2276
2295
|
align-items: center;
|
|
2277
2296
|
|
|
@@ -2314,8 +2333,8 @@ ${Dt}
|
|
|
2314
2333
|
width: 10px;
|
|
2315
2334
|
height: 10px;
|
|
2316
2335
|
}
|
|
2317
|
-
`,
|
|
2318
|
-
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } =
|
|
2336
|
+
`, Gt = ({ value: e, onChange: t }) => {
|
|
2337
|
+
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } = Ze({
|
|
2319
2338
|
ref: a,
|
|
2320
2339
|
onChange: t
|
|
2321
2340
|
}), s = (n) => {
|
|
@@ -2329,12 +2348,12 @@ ${Dt}
|
|
|
2329
2348
|
e && e.removeEventListener("wheel", s);
|
|
2330
2349
|
};
|
|
2331
2350
|
}, [e]);
|
|
2332
|
-
let c = e * 100, l = p(() => Math.round(r ? 0 :
|
|
2351
|
+
let c = e * 100, l = p(() => Math.round(r ? 0 : Ge(n) * 100), [n, r]);
|
|
2333
2352
|
return /* @__PURE__ */ D($, {
|
|
2334
2353
|
id: "volume-slider",
|
|
2335
2354
|
text: /* @__PURE__ */ D("div", {
|
|
2336
2355
|
ref: i,
|
|
2337
|
-
css:
|
|
2356
|
+
css: Wt,
|
|
2338
2357
|
...o,
|
|
2339
2358
|
children: /* @__PURE__ */ D("div", {
|
|
2340
2359
|
ref: a,
|
|
@@ -2353,7 +2372,7 @@ ${Dt}
|
|
|
2353
2372
|
children: [l, "%"]
|
|
2354
2373
|
})
|
|
2355
2374
|
});
|
|
2356
|
-
},
|
|
2375
|
+
}, Kt = _`
|
|
2357
2376
|
position: relative;
|
|
2358
2377
|
display: flex;
|
|
2359
2378
|
align-items: center;
|
|
@@ -2416,10 +2435,10 @@ ${Dt}
|
|
|
2416
2435
|
}
|
|
2417
2436
|
}
|
|
2418
2437
|
|
|
2419
|
-
`,
|
|
2420
|
-
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() =>
|
|
2438
|
+
`, qt = ({ ref: e }) => {
|
|
2439
|
+
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() => Ge(n), [n]);
|
|
2421
2440
|
return /* @__PURE__ */ O("div", {
|
|
2422
|
-
css:
|
|
2441
|
+
css: Kt,
|
|
2423
2442
|
children: [/* @__PURE__ */ D($, {
|
|
2424
2443
|
id: "sound",
|
|
2425
2444
|
text: /* @__PURE__ */ D("button", {
|
|
@@ -2439,16 +2458,16 @@ ${Dt}
|
|
|
2439
2458
|
className: "volume-slider-container",
|
|
2440
2459
|
children: /* @__PURE__ */ D("div", {
|
|
2441
2460
|
className: "volume-slider-background",
|
|
2442
|
-
children: /* @__PURE__ */ D(
|
|
2461
|
+
children: /* @__PURE__ */ D(Gt, {
|
|
2443
2462
|
value: r ? 0 : i,
|
|
2444
2463
|
onChange: (e) => {
|
|
2445
|
-
t.setVolume(
|
|
2464
|
+
t.setVolume(We(e));
|
|
2446
2465
|
}
|
|
2447
2466
|
})
|
|
2448
2467
|
})
|
|
2449
2468
|
})]
|
|
2450
2469
|
});
|
|
2451
|
-
},
|
|
2470
|
+
}, Jt = .05, Yt = 5, Xt = 50, Zt = 1e3, Qt = _`
|
|
2452
2471
|
position: absolute;
|
|
2453
2472
|
bottom: 0;
|
|
2454
2473
|
width: 100%;
|
|
@@ -2540,7 +2559,7 @@ ${Dt}
|
|
|
2540
2559
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2541
2560
|
of its own and so is never :hover */
|
|
2542
2561
|
:hover, &.armed {
|
|
2543
|
-
background-color: ${
|
|
2562
|
+
background-color: ${Ut.hover};
|
|
2544
2563
|
}
|
|
2545
2564
|
|
|
2546
2565
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2578,10 +2597,10 @@ ${Dt}
|
|
|
2578
2597
|
}
|
|
2579
2598
|
}
|
|
2580
2599
|
}
|
|
2581
|
-
`,
|
|
2600
|
+
`, $t = ({ shortcuts: e = "window", root: t }) => {
|
|
2582
2601
|
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 =
|
|
2584
|
-
n.setVolume(
|
|
2602
|
+
let r = Ge(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2603
|
+
n.setVolume(We(a)), o && !n.muted && n.toggleMuted();
|
|
2585
2604
|
}, [n]), A = m(!1);
|
|
2586
2605
|
f(() => {
|
|
2587
2606
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
@@ -2598,16 +2617,16 @@ ${Dt}
|
|
|
2598
2617
|
else if (a.key === "m") n.toggleMuted();
|
|
2599
2618
|
else if (a.key === "ArrowUp") k({
|
|
2600
2619
|
direction: "up",
|
|
2601
|
-
stepSize:
|
|
2620
|
+
stepSize: Jt
|
|
2602
2621
|
});
|
|
2603
2622
|
else if (a.key === "ArrowDown") k({
|
|
2604
2623
|
direction: "down",
|
|
2605
|
-
stepSize:
|
|
2624
|
+
stepSize: Jt
|
|
2606
2625
|
});
|
|
2607
2626
|
else if (a.key === "ArrowRight") {
|
|
2608
2627
|
if (!n.duration) return;
|
|
2609
|
-
r(Math.min(n.currentTime +
|
|
2610
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2628
|
+
r(Math.min(n.currentTime + Yt, n.duration));
|
|
2629
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Yt, 0)) : (a.key === "<" || a.key === ">") && y ? y(a.key === ">" ? 1 : -1) : c = !1;
|
|
2611
2630
|
c && a.preventDefault();
|
|
2612
2631
|
};
|
|
2613
2632
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2624,10 +2643,10 @@ ${Dt}
|
|
|
2624
2643
|
let j = d((e) => {
|
|
2625
2644
|
e.preventDefault(), e.deltaY < 0 ? k({
|
|
2626
2645
|
direction: "up",
|
|
2627
|
-
stepSize:
|
|
2646
|
+
stepSize: Jt
|
|
2628
2647
|
}) : k({
|
|
2629
2648
|
direction: "down",
|
|
2630
|
-
stepSize:
|
|
2649
|
+
stepSize: Jt
|
|
2631
2650
|
});
|
|
2632
2651
|
}, [k]);
|
|
2633
2652
|
f(() => {
|
|
@@ -2653,18 +2672,18 @@ ${Dt}
|
|
|
2653
2672
|
}
|
|
2654
2673
|
let n = S.current, r = document.activeElement;
|
|
2655
2674
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2656
|
-
},
|
|
2675
|
+
}, Xt);
|
|
2657
2676
|
return C.current = t, () => {
|
|
2658
|
-
e = Date.now() +
|
|
2677
|
+
e = Date.now() + Zt;
|
|
2659
2678
|
};
|
|
2660
2679
|
}, [N]), f(() => () => clearInterval(C.current), []), /* @__PURE__ */ O("div", {
|
|
2661
2680
|
className: "control-bar",
|
|
2662
|
-
css:
|
|
2681
|
+
css: Qt,
|
|
2663
2682
|
style: { ...c ? {
|
|
2664
2683
|
opacity: "0",
|
|
2665
2684
|
pointerEvents: "none"
|
|
2666
2685
|
} : N ? { pointerEvents: "none" } : {} },
|
|
2667
|
-
children: [/* @__PURE__ */ D(
|
|
2686
|
+
children: [/* @__PURE__ */ D(Ct, {}), /* @__PURE__ */ O("div", {
|
|
2668
2687
|
className: "actions",
|
|
2669
2688
|
children: [/* @__PURE__ */ O("div", {
|
|
2670
2689
|
className: "left",
|
|
@@ -2681,18 +2700,18 @@ ${Dt}
|
|
|
2681
2700
|
}),
|
|
2682
2701
|
toolTipText: /* @__PURE__ */ D("span", { children: E ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2683
2702
|
}),
|
|
2684
|
-
/* @__PURE__ */ D(
|
|
2703
|
+
/* @__PURE__ */ D(qt, { ref: x }),
|
|
2685
2704
|
/* @__PURE__ */ D("div", {
|
|
2686
2705
|
className: "time",
|
|
2687
|
-
children:
|
|
2706
|
+
children: qe(o ?? i, a)
|
|
2688
2707
|
})
|
|
2689
2708
|
]
|
|
2690
2709
|
}), /* @__PURE__ */ O("div", {
|
|
2691
2710
|
className: "right",
|
|
2692
2711
|
children: [
|
|
2693
|
-
/* @__PURE__ */ D(
|
|
2694
|
-
/* @__PURE__ */ D(
|
|
2695
|
-
/* @__PURE__ */ D(
|
|
2712
|
+
/* @__PURE__ */ D(It, {}),
|
|
2713
|
+
/* @__PURE__ */ D(Ht, {}),
|
|
2714
|
+
/* @__PURE__ */ D(Bt, {}),
|
|
2696
2715
|
g ? /* @__PURE__ */ D($, {
|
|
2697
2716
|
id: "picture-in-picture",
|
|
2698
2717
|
tooltipPlace: "top-end",
|
|
@@ -2706,7 +2725,7 @@ ${Dt}
|
|
|
2706
2725
|
"aria-label": "Picture in picture",
|
|
2707
2726
|
"aria-pressed": g.active,
|
|
2708
2727
|
children: /* @__PURE__ */ D("img", {
|
|
2709
|
-
src:
|
|
2728
|
+
src: wt,
|
|
2710
2729
|
alt: ""
|
|
2711
2730
|
})
|
|
2712
2731
|
}),
|
|
@@ -2721,8 +2740,8 @@ ${Dt}
|
|
|
2721
2740
|
disabled: w && !T,
|
|
2722
2741
|
"aria-label": w ? "Put the subtitles in the video" : "Picture in picture",
|
|
2723
2742
|
"aria-pressed": w ? p : void 0,
|
|
2724
|
-
children: w ? D(p ?
|
|
2725
|
-
src:
|
|
2743
|
+
children: w ? D(p ? Et : Dt, {}) : /* @__PURE__ */ D("img", {
|
|
2744
|
+
src: wt,
|
|
2726
2745
|
alt: ""
|
|
2727
2746
|
})
|
|
2728
2747
|
}),
|
|
@@ -2745,7 +2764,7 @@ ${Dt}
|
|
|
2745
2764
|
})]
|
|
2746
2765
|
})]
|
|
2747
2766
|
});
|
|
2748
|
-
},
|
|
2767
|
+
}, en = 9e3, tn = _`
|
|
2749
2768
|
position: absolute;
|
|
2750
2769
|
inset: 0;
|
|
2751
2770
|
z-index: 2;
|
|
@@ -2788,7 +2807,7 @@ ${Dt}
|
|
|
2788
2807
|
line-height: 1;
|
|
2789
2808
|
color: #fff;
|
|
2790
2809
|
}
|
|
2791
|
-
`,
|
|
2810
|
+
`, nn = () => {
|
|
2792
2811
|
let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2793
2812
|
return f(() => {
|
|
2794
2813
|
if (t !== "burn-in" || !e) {
|
|
@@ -2796,10 +2815,10 @@ ${Dt}
|
|
|
2796
2815
|
return;
|
|
2797
2816
|
}
|
|
2798
2817
|
r(!0);
|
|
2799
|
-
let n = setTimeout(() => r(!1),
|
|
2818
|
+
let n = setTimeout(() => r(!1), en);
|
|
2800
2819
|
return () => clearTimeout(n);
|
|
2801
2820
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2802
|
-
css:
|
|
2821
|
+
css: tn,
|
|
2803
2822
|
className: n ? "show" : "",
|
|
2804
2823
|
role: "status",
|
|
2805
2824
|
children: /* @__PURE__ */ O("div", {
|
|
@@ -2814,10 +2833,10 @@ ${Dt}
|
|
|
2814
2833
|
})]
|
|
2815
2834
|
})
|
|
2816
2835
|
});
|
|
2817
|
-
},
|
|
2836
|
+
}, rn = 1, an = 6e3, on = 1, sn = {
|
|
2818
2837
|
opening: "Skip Opening",
|
|
2819
2838
|
ending: "Skip Ending"
|
|
2820
|
-
},
|
|
2839
|
+
}, cn = _`
|
|
2821
2840
|
position: absolute;
|
|
2822
2841
|
inset: 0;
|
|
2823
2842
|
z-index: 2;
|
|
@@ -2868,10 +2887,10 @@ ${Dt}
|
|
|
2868
2887
|
bottom: calc(9 * var(--mp-unit));
|
|
2869
2888
|
}
|
|
2870
2889
|
}
|
|
2871
|
-
`,
|
|
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(() =>
|
|
2890
|
+
`, ln = () => {
|
|
2891
|
+
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(() => bt(e), [e]), o = p(() => {
|
|
2873
2892
|
if (typeof t != "number") return;
|
|
2874
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2893
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - rn <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2875
2894
|
return r ? {
|
|
2876
2895
|
kind: r,
|
|
2877
2896
|
end: e[n].end
|
|
@@ -2883,7 +2902,7 @@ ${Dt}
|
|
|
2883
2902
|
]), s = m(0), [c, l] = h(0);
|
|
2884
2903
|
f(() => {
|
|
2885
2904
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2886
|
-
s.current = e, e < n -
|
|
2905
|
+
s.current = e, e < n - on && l((e) => e + 1);
|
|
2887
2906
|
}, [t]);
|
|
2888
2907
|
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2889
2908
|
return f(() => {
|
|
@@ -2892,12 +2911,12 @@ ${Dt}
|
|
|
2892
2911
|
return;
|
|
2893
2912
|
}
|
|
2894
2913
|
d(!0);
|
|
2895
|
-
let e = setTimeout(() => d(!1),
|
|
2914
|
+
let e = setTimeout(() => d(!1), an);
|
|
2896
2915
|
return () => clearTimeout(e);
|
|
2897
2916
|
}, [g, c]), f(() => {
|
|
2898
2917
|
o || d(!1);
|
|
2899
2918
|
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2900
|
-
css:
|
|
2919
|
+
css: cn,
|
|
2901
2920
|
className: u && !r ? "show" : "",
|
|
2902
2921
|
children: /* @__PURE__ */ D("button", {
|
|
2903
2922
|
type: "button",
|
|
@@ -2905,10 +2924,10 @@ ${Dt}
|
|
|
2905
2924
|
onClick: () => {
|
|
2906
2925
|
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2907
2926
|
},
|
|
2908
|
-
children:
|
|
2927
|
+
children: sn[o.kind]
|
|
2909
2928
|
})
|
|
2910
2929
|
}) : null;
|
|
2911
|
-
},
|
|
2930
|
+
}, un = 3e3, dn = _`
|
|
2912
2931
|
position: absolute;
|
|
2913
2932
|
inset: 0;
|
|
2914
2933
|
z-index: 2;
|
|
@@ -2919,10 +2938,10 @@ ${Dt}
|
|
|
2919
2938
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2920
2939
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2921
2940
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2922
|
-
`,
|
|
2941
|
+
`, fn = (e, t) => {
|
|
2923
2942
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2924
2943
|
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')`;
|
|
2925
|
-
},
|
|
2944
|
+
}, pn = _`
|
|
2926
2945
|
position: relative;
|
|
2927
2946
|
background-color: black;
|
|
2928
2947
|
display: flex;
|
|
@@ -2979,13 +2998,13 @@ ${Dt}
|
|
|
2979
2998
|
&.hide {
|
|
2980
2999
|
cursor: none;
|
|
2981
3000
|
}
|
|
2982
|
-
`,
|
|
3001
|
+
`, mn = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2983
3002
|
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2984
|
-
return u(e) && e.type === l ?
|
|
3003
|
+
return u(e) && e.type === l ? mn(e.props.children, `${r}/`) : [{
|
|
2985
3004
|
key: r,
|
|
2986
3005
|
item: e
|
|
2987
3006
|
}];
|
|
2988
|
-
}),
|
|
3007
|
+
}), hn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2989
3008
|
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({
|
|
2990
3009
|
x: -1,
|
|
2991
3010
|
y: -1
|
|
@@ -3006,12 +3025,12 @@ ${Dt}
|
|
|
3006
3025
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3007
3026
|
}, S = () => {
|
|
3008
3027
|
if (x()) {
|
|
3009
|
-
p.current = setTimeout(S,
|
|
3028
|
+
p.current = setTimeout(S, un);
|
|
3010
3029
|
return;
|
|
3011
3030
|
}
|
|
3012
3031
|
y();
|
|
3013
3032
|
}, C = () => {
|
|
3014
|
-
l(!1), clearTimeout(p.current), p.current = setTimeout(S,
|
|
3033
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, un);
|
|
3015
3034
|
}, w = (e) => {
|
|
3016
3035
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
3017
3036
|
x: e.clientX,
|
|
@@ -3023,7 +3042,7 @@ ${Dt}
|
|
|
3023
3042
|
_.current = !1;
|
|
3024
3043
|
}, k = m(!0);
|
|
3025
3044
|
return /* @__PURE__ */ O("div", {
|
|
3026
|
-
css:
|
|
3045
|
+
css: pn,
|
|
3027
3046
|
ref: b,
|
|
3028
3047
|
onPointerMove: w,
|
|
3029
3048
|
onPointerDown: T,
|
|
@@ -3038,9 +3057,9 @@ ${Dt}
|
|
|
3038
3057
|
className: c ? "hide" : "",
|
|
3039
3058
|
tabIndex: a === "player" ? -1 : void 0,
|
|
3040
3059
|
children: [
|
|
3041
|
-
/* @__PURE__ */ D(
|
|
3042
|
-
|
|
3043
|
-
css:
|
|
3060
|
+
/* @__PURE__ */ D(Ve, { onSubtitleRef: n }),
|
|
3061
|
+
mn(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
3062
|
+
css: dn,
|
|
3044
3063
|
style: { ...c ? {
|
|
3045
3064
|
opacity: "0",
|
|
3046
3065
|
visibility: "hidden",
|
|
@@ -3048,15 +3067,15 @@ ${Dt}
|
|
|
3048
3067
|
} : {} },
|
|
3049
3068
|
children: t
|
|
3050
3069
|
}, e)),
|
|
3051
|
-
i === !1 ? null : /* @__PURE__ */ D(
|
|
3070
|
+
i === !1 ? null : /* @__PURE__ */ D($t, {
|
|
3052
3071
|
shortcuts: a,
|
|
3053
3072
|
root: v
|
|
3054
3073
|
}),
|
|
3055
|
-
/* @__PURE__ */ D(
|
|
3056
|
-
/* @__PURE__ */ D(
|
|
3074
|
+
/* @__PURE__ */ D(nn, {}),
|
|
3075
|
+
/* @__PURE__ */ D(ln, {}),
|
|
3057
3076
|
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
3058
3077
|
className: "pass-through",
|
|
3059
|
-
style: { clipPath:
|
|
3078
|
+
style: { clipPath: fn(d.armed, v.current.getBoundingClientRect()) },
|
|
3060
3079
|
onPointerOver: d.disarm
|
|
3061
3080
|
}) : null,
|
|
3062
3081
|
/* @__PURE__ */ O("div", {
|
|
@@ -3079,9 +3098,9 @@ ${Dt}
|
|
|
3079
3098
|
})
|
|
3080
3099
|
]
|
|
3081
3100
|
});
|
|
3082
|
-
},
|
|
3101
|
+
}, gn = ({ options: e, children: t }) => {
|
|
3083
3102
|
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;
|
|
3084
|
-
f(() => (v?.(E), () => v?.(null)), [E, v]),
|
|
3103
|
+
f(() => (v?.(E), () => v?.(null)), [E, v]), pe(E, n?.stepFrame);
|
|
3085
3104
|
let { expose: O } = e, k = O === !0 ? {} : O || void 0, A = m(k);
|
|
3086
3105
|
A.current = k;
|
|
3087
3106
|
let j = k ? k.id : void 0, M = k ? k.origin : void 0, N = k ? k.channel : void 0;
|
|
@@ -3100,7 +3119,7 @@ ${Dt}
|
|
|
3100
3119
|
M,
|
|
3101
3120
|
N
|
|
3102
3121
|
]);
|
|
3103
|
-
let P = p(() =>
|
|
3122
|
+
let P = p(() => Pe(), [o]);
|
|
3104
3123
|
le(S, w, r, _ ? P.push : void 0);
|
|
3105
3124
|
let F = r?.normalizeVolume ?? !0, [I, L] = h(F);
|
|
3106
3125
|
f(() => {
|
|
@@ -3110,7 +3129,7 @@ ${Dt}
|
|
|
3110
3129
|
R.current = r?.onNormalizeVolumeChange;
|
|
3111
3130
|
let z = r?.normalizerWorkletUrl, B = m(d ?? u);
|
|
3112
3131
|
B.current = d ?? u;
|
|
3113
|
-
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } =
|
|
3132
|
+
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } = Ne(S, z, I, p(() => H && o && c && l && typeof V == "number" && V >= 0 ? _ ? {
|
|
3114
3133
|
tap: P,
|
|
3115
3134
|
audioStreamIndex: V
|
|
3116
3135
|
} : {
|
|
@@ -3137,13 +3156,13 @@ ${Dt}
|
|
|
3137
3156
|
z,
|
|
3138
3157
|
I,
|
|
3139
3158
|
ee
|
|
3140
|
-
]), { thumbnails: ne, requestThumbnail: U } =
|
|
3159
|
+
]), { thumbnails: ne, requestThumbnail: U } = ge({
|
|
3141
3160
|
publicPath: c,
|
|
3142
3161
|
workerUrl: l,
|
|
3143
3162
|
length: g === !1 ? void 0 : o,
|
|
3144
3163
|
read: d ?? u,
|
|
3145
3164
|
downloadedRanges: s
|
|
3146
|
-
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } =
|
|
3165
|
+
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } = _e(S, w), q = Ce(n?.media ?? null, n?.pictureInPicture), J = K((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
|
|
3147
3166
|
f(() => {
|
|
3148
3167
|
J({
|
|
3149
3168
|
title: i,
|
|
@@ -3209,7 +3228,7 @@ ${Dt}
|
|
|
3209
3228
|
J({ quality: se });
|
|
3210
3229
|
}, [J, se]), f(() => {
|
|
3211
3230
|
a && J({ chapters: a });
|
|
3212
|
-
}, [J, a]), /* @__PURE__ */ D(
|
|
3231
|
+
}, [J, a]), /* @__PURE__ */ D(hn, {
|
|
3213
3232
|
ref: y,
|
|
3214
3233
|
onVideoRef: n ? void 0 : C,
|
|
3215
3234
|
onSubtitleRef: T,
|
|
@@ -3218,7 +3237,7 @@ ${Dt}
|
|
|
3218
3237
|
shortcuts: e.shortcuts,
|
|
3219
3238
|
children: t
|
|
3220
3239
|
});
|
|
3221
|
-
},
|
|
3240
|
+
}, _n = _`
|
|
3222
3241
|
/**
|
|
3223
3242
|
* The chrome's whole scale, in one place.
|
|
3224
3243
|
*
|
|
@@ -3288,17 +3307,17 @@ ${Dt}
|
|
|
3288
3307
|
height: 100%;
|
|
3289
3308
|
width: 100%;
|
|
3290
3309
|
overflow: hidden;
|
|
3291
|
-
`,
|
|
3292
|
-
css:
|
|
3293
|
-
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(
|
|
3310
|
+
`, vn = (e) => /* @__PURE__ */ D("div", {
|
|
3311
|
+
css: _n,
|
|
3312
|
+
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(gn, {
|
|
3294
3313
|
options: e,
|
|
3295
3314
|
children: e.children
|
|
3296
3315
|
}) })
|
|
3297
|
-
}),
|
|
3316
|
+
}), yn = (e) => !!e && typeof e == "object" && "at" in e, bn = (e) => !!e && typeof e == "object" && "selection" in e, xn = ({ blob: e, name: t }) => ({
|
|
3298
3317
|
length: e.size,
|
|
3299
3318
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3300
3319
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3301
|
-
}),
|
|
3320
|
+
}), Sn = async (e, t) => {
|
|
3302
3321
|
let n = await fetch(e, {
|
|
3303
3322
|
headers: { Range: "bytes=0-1" },
|
|
3304
3323
|
credentials: t
|
|
@@ -3308,8 +3327,8 @@ ${Dt}
|
|
|
3308
3327
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3309
3328
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3310
3329
|
return i;
|
|
3311
|
-
},
|
|
3312
|
-
let i = t ?? await
|
|
3330
|
+
}, Cn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3331
|
+
let i = t ?? await Sn(e, r);
|
|
3313
3332
|
return {
|
|
3314
3333
|
length: i,
|
|
3315
3334
|
name: n,
|
|
@@ -3325,9 +3344,9 @@ ${Dt}
|
|
|
3325
3344
|
},
|
|
3326
3345
|
readsDownload: !0
|
|
3327
3346
|
};
|
|
3328
|
-
},
|
|
3329
|
-
if ("blob" in e) return
|
|
3330
|
-
if ("url" in e) return
|
|
3347
|
+
}, wn = async (e) => {
|
|
3348
|
+
if ("blob" in e) return xn(e);
|
|
3349
|
+
if ("url" in e) return Cn(e);
|
|
3331
3350
|
if ("read" in e) return {
|
|
3332
3351
|
length: e.length,
|
|
3333
3352
|
name: e.name,
|
|
@@ -3336,4 +3355,4 @@ ${Dt}
|
|
|
3336
3355
|
throw Error(`Unknown source type: ${e}`);
|
|
3337
3356
|
};
|
|
3338
3357
|
//#endregion
|
|
3339
|
-
export {
|
|
3358
|
+
export { vn as MediaPlayer, vn as default, G as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, wn as inputToRemuxerInput, bn as isDelegatedTracks, yn as isExternalThumbnails, W as sourceFeature, a as startPlayback, _e as usePictureInPicture, K as usePlayer, ge as useSeekThumbnails };
|