@banou/media-player 0.10.22 → 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 +5 -2
- package/dist/engine/index.js +1 -1
- package/dist/{engine-Cr_7OImR.js → engine-BdouHadr.js} +6 -6
- package/dist/index.js +305 -235
- package/dist/react/hooks/use-frame-step.d.ts +16 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +10 -0
- package/dist/react/video-player.d.ts +9 -0
- package/dist/volume-normalizer-worklet.js +9 -5
- package/package.json +3 -3
- package/src/lib/audio/volume-normalizer-worklet.js +9 -5
- 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 +139 -0
- package/src/lib/react/source-feature.ts +6 -0
- package/src/lib/react/video-player.tsx +11 -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,82 @@ 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 = !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;
|
|
297
|
+
f(() => {
|
|
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;
|
|
311
|
+
};
|
|
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);
|
|
316
|
+
};
|
|
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);
|
|
321
|
+
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
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 });
|
|
334
|
+
};
|
|
335
|
+
}, [
|
|
336
|
+
e,
|
|
337
|
+
a,
|
|
338
|
+
n,
|
|
339
|
+
r
|
|
340
|
+
]);
|
|
341
|
+
}, me = 5e3, he = 6e4, ge = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
273
342
|
let [o, s] = h([]), c = m(null), l = m(r);
|
|
274
343
|
l.current = r;
|
|
275
344
|
let u = p(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = m(u);
|
|
276
345
|
return g.current = u, f(() => {
|
|
277
346
|
if (!n || !r || !e || !t) return;
|
|
278
|
-
let a = !1, o = null, u, d =
|
|
347
|
+
let a = !1, o = null, u, d = me, f = () => {
|
|
279
348
|
i({
|
|
280
349
|
publicPath: e,
|
|
281
350
|
workerUrl: t,
|
|
@@ -291,7 +360,7 @@ var U = {
|
|
|
291
360
|
}
|
|
292
361
|
o = e, c.current = e, e.update(g.current);
|
|
293
362
|
}, () => {
|
|
294
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
363
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, he));
|
|
295
364
|
});
|
|
296
365
|
};
|
|
297
366
|
return f(), () => {
|
|
@@ -309,7 +378,7 @@ var U = {
|
|
|
309
378
|
c.current?.prioritize(e);
|
|
310
379
|
}, [])
|
|
311
380
|
};
|
|
312
|
-
},
|
|
381
|
+
}, _e = (e, t) => {
|
|
313
382
|
let r = m(null), [i, a] = h(!1), [s] = h(() => n());
|
|
314
383
|
f(() => {
|
|
315
384
|
if (!e || !t || !s) return;
|
|
@@ -337,10 +406,10 @@ var U = {
|
|
|
337
406
|
mode: s,
|
|
338
407
|
burnedIn: i
|
|
339
408
|
};
|
|
340
|
-
},
|
|
341
|
-
let t =
|
|
409
|
+
}, ve = "(hover: hover) and (pointer: fine)", ye = () => typeof matchMedia == "function" ? matchMedia(ve) : void 0, be = (e) => {
|
|
410
|
+
let t = ye();
|
|
342
411
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
343
|
-
},
|
|
412
|
+
}, xe = () => !!ye()?.matches, Se = () => !1, Ce = (e, t) => {
|
|
344
413
|
let [n, r] = h(!1), [i, a] = h(), o = m(t);
|
|
345
414
|
t && (o.current = t);
|
|
346
415
|
let s = m(!1), c = d((e) => {
|
|
@@ -363,7 +432,7 @@ var U = {
|
|
|
363
432
|
_,
|
|
364
433
|
u
|
|
365
434
|
]);
|
|
366
|
-
let v = g(
|
|
435
|
+
let v = g(be, xe, Se), [y, b] = h(!1);
|
|
367
436
|
f(() => {
|
|
368
437
|
if (!_) return;
|
|
369
438
|
let e = (e) => {
|
|
@@ -404,16 +473,16 @@ var U = {
|
|
|
404
473
|
u,
|
|
405
474
|
S
|
|
406
475
|
]);
|
|
407
|
-
},
|
|
476
|
+
}, we = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
408
477
|
channelCountMode: "max",
|
|
409
478
|
processorOptions: n
|
|
410
|
-
})),
|
|
479
|
+
})), Te = /* @__PURE__ */ new WeakMap(), Ee = (e) => new Promise((t, n) => {
|
|
411
480
|
let r = () => {
|
|
412
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")));
|
|
413
482
|
};
|
|
414
483
|
e.addEventListener("statechange", r), r();
|
|
415
|
-
}),
|
|
416
|
-
let r =
|
|
484
|
+
}), De = (e, t, n = {}) => {
|
|
485
|
+
let r = Te.get(e);
|
|
417
486
|
if (r) return r.wake(), r;
|
|
418
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 = () => {
|
|
419
488
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -429,12 +498,12 @@ var U = {
|
|
|
429
498
|
};
|
|
430
499
|
i.addEventListener("statechange", f), f();
|
|
431
500
|
let p = (async () => {
|
|
432
|
-
let r = await
|
|
501
|
+
let r = await we(i, t, {
|
|
433
502
|
...n,
|
|
434
503
|
enabled: a,
|
|
435
504
|
inputGainDb: c()
|
|
436
505
|
});
|
|
437
|
-
await
|
|
506
|
+
await Ee(i);
|
|
438
507
|
let s = T(i, e);
|
|
439
508
|
return r.port.postMessage({
|
|
440
509
|
enabled: a,
|
|
@@ -451,14 +520,14 @@ var U = {
|
|
|
451
520
|
a = e, o?.port.postMessage({ enabled: a });
|
|
452
521
|
},
|
|
453
522
|
release: () => {
|
|
454
|
-
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(() => {}));
|
|
455
524
|
},
|
|
456
525
|
wake: () => {
|
|
457
526
|
i.state !== "closed" && (s = !1, u(), f());
|
|
458
527
|
}
|
|
459
528
|
};
|
|
460
|
-
return
|
|
461
|
-
},
|
|
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 }) => {
|
|
462
531
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
463
532
|
for (let e of [...c]) e();
|
|
464
533
|
c.clear();
|
|
@@ -505,7 +574,7 @@ var U = {
|
|
|
505
574
|
}), S = () => p.postMessage({
|
|
506
575
|
type: "playhead",
|
|
507
576
|
time: n.currentTime
|
|
508
|
-
}), C = setInterval(x,
|
|
577
|
+
}), C = setInterval(x, je), T = [
|
|
509
578
|
"play",
|
|
510
579
|
"playing",
|
|
511
580
|
"pause",
|
|
@@ -522,7 +591,7 @@ var U = {
|
|
|
522
591
|
return t >= (h.end ?? E) - .05 ? null : t;
|
|
523
592
|
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
524
593
|
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
525
|
-
if (t !== null && t < e +
|
|
594
|
+
if (t !== null && t < e + Oe) return r && A <= t + 1 && t <= j + ke ? "read" : P(t);
|
|
526
595
|
if (r) return "read";
|
|
527
596
|
let i = t ?? N(0);
|
|
528
597
|
return i === null ? "done" : P(i);
|
|
@@ -586,7 +655,7 @@ var U = {
|
|
|
586
655
|
await H(e), e.finished && await V(!0);
|
|
587
656
|
} else {
|
|
588
657
|
await V(!1), M.set(Math.round(e * 10), g);
|
|
589
|
-
let t = B.seek(Math.max(0, e -
|
|
658
|
+
let t = B.seek(Math.max(0, e - Ae));
|
|
590
659
|
f(!0);
|
|
591
660
|
let n = await L(t);
|
|
592
661
|
if (a) return;
|
|
@@ -656,12 +725,12 @@ var U = {
|
|
|
656
725
|
},
|
|
657
726
|
stop: U
|
|
658
727
|
};
|
|
659
|
-
},
|
|
728
|
+
}, Ne = (e, t, n, r, i) => {
|
|
660
729
|
let a = m(null), [o, s] = h(!1), [c, l] = h(null);
|
|
661
730
|
f(() => {
|
|
662
731
|
if (e && t) {
|
|
663
732
|
if (n && !a.current) {
|
|
664
|
-
let r =
|
|
733
|
+
let r = De(e, t, { enabled: n });
|
|
665
734
|
a.current = r, r.routed.then((e) => {
|
|
666
735
|
a.current === r && l(e);
|
|
667
736
|
}, (e) => {
|
|
@@ -685,7 +754,7 @@ var U = {
|
|
|
685
754
|
return f(() => {
|
|
686
755
|
let r = p.current;
|
|
687
756
|
if (!c || !e || !t || !n || !r) return;
|
|
688
|
-
let i =
|
|
757
|
+
let i = Me({
|
|
689
758
|
node: c,
|
|
690
759
|
element: e,
|
|
691
760
|
scriptUrl: t,
|
|
@@ -707,7 +776,7 @@ var U = {
|
|
|
707
776
|
]), f(() => {
|
|
708
777
|
d.current?.update(i);
|
|
709
778
|
}, [i]), { refused: o };
|
|
710
|
-
},
|
|
779
|
+
}, Pe = () => {
|
|
711
780
|
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
712
781
|
return {
|
|
713
782
|
push: (n) => {
|
|
@@ -756,7 +825,7 @@ var U = {
|
|
|
756
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 ",
|
|
757
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 "
|
|
758
827
|
}
|
|
759
|
-
},
|
|
828
|
+
}, Fe = _`
|
|
760
829
|
display: flex;
|
|
761
830
|
justify-content: center;
|
|
762
831
|
align-items: center;
|
|
@@ -769,7 +838,7 @@ var U = {
|
|
|
769
838
|
margin: auto;
|
|
770
839
|
pointer-events: none;
|
|
771
840
|
}
|
|
772
|
-
`,
|
|
841
|
+
`, Ie = _`
|
|
773
842
|
position: absolute;
|
|
774
843
|
top: 0;
|
|
775
844
|
left: 0;
|
|
@@ -798,9 +867,9 @@ var U = {
|
|
|
798
867
|
|
|
799
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%);
|
|
800
869
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
801
|
-
`,
|
|
870
|
+
`, Le = v`
|
|
802
871
|
to { transform: rotate(360deg); }
|
|
803
|
-
`,
|
|
872
|
+
`, Re = _`
|
|
804
873
|
position: absolute;
|
|
805
874
|
inset: 0;
|
|
806
875
|
z-index: 2;
|
|
@@ -816,9 +885,9 @@ var U = {
|
|
|
816
885
|
border-radius: 50%;
|
|
817
886
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
818
887
|
border-top-color: #fff;
|
|
819
|
-
animation: ${
|
|
888
|
+
animation: ${Le} 0.8s linear infinite;
|
|
820
889
|
}
|
|
821
|
-
`,
|
|
890
|
+
`, ze = _`
|
|
822
891
|
position: absolute;
|
|
823
892
|
inset: auto 0 20%;
|
|
824
893
|
z-index: 3;
|
|
@@ -828,34 +897,34 @@ var U = {
|
|
|
828
897
|
${Z.bLarge.regular}
|
|
829
898
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
830
899
|
pointer-events: none;
|
|
831
|
-
`,
|
|
900
|
+
`, Be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ve = ({ onSubtitleRef: e }) => {
|
|
832
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);
|
|
833
902
|
return /* @__PURE__ */ O(E, { children: [
|
|
834
903
|
t ? /* @__PURE__ */ D("div", {
|
|
835
904
|
className: "title",
|
|
836
|
-
css:
|
|
905
|
+
css: Ie,
|
|
837
906
|
style: { ...n ? {
|
|
838
907
|
opacity: "0",
|
|
839
908
|
pointerEvents: "none"
|
|
840
909
|
} : {} },
|
|
841
910
|
children: t
|
|
842
911
|
}) : void 0,
|
|
843
|
-
((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,
|
|
844
913
|
r ? /* @__PURE__ */ D("div", {
|
|
845
|
-
css:
|
|
846
|
-
children:
|
|
914
|
+
css: ze,
|
|
915
|
+
children: Be(r)
|
|
847
916
|
}) : void 0,
|
|
848
917
|
/* @__PURE__ */ D("div", {
|
|
849
918
|
className: "subtitles",
|
|
850
919
|
ref: e,
|
|
851
|
-
css:
|
|
920
|
+
css: Fe
|
|
852
921
|
})
|
|
853
922
|
] });
|
|
854
|
-
},
|
|
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) => {
|
|
855
924
|
if (e === void 0) return "0:00";
|
|
856
925
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
857
926
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
858
|
-
},
|
|
927
|
+
}, qe = (e, t) => `${Ke(e)} / ${Ke(t)}`, Je = (e) => _`
|
|
859
928
|
display: flex;
|
|
860
929
|
justify-content: flex-start;
|
|
861
930
|
|
|
@@ -903,17 +972,17 @@ var U = {
|
|
|
903
972
|
x: -1,
|
|
904
973
|
y: -1,
|
|
905
974
|
anchors: 0
|
|
906
|
-
},
|
|
975
|
+
}, Ye = (e) => {
|
|
907
976
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
908
|
-
},
|
|
977
|
+
}, Xe = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Ye, {
|
|
909
978
|
capture: !0,
|
|
910
979
|
passive: !0
|
|
911
980
|
}), () => {
|
|
912
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
981
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", Ye, { capture: !0 });
|
|
913
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" }) => {
|
|
914
983
|
let l = m(null), u = m(null);
|
|
915
984
|
return f(() => {
|
|
916
|
-
let e =
|
|
985
|
+
let e = Xe(), t = () => {
|
|
917
986
|
let e = l.current;
|
|
918
987
|
if (!e) return;
|
|
919
988
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -935,12 +1004,12 @@ var U = {
|
|
|
935
1004
|
children: n
|
|
936
1005
|
}), !s && /* @__PURE__ */ D(ne, {
|
|
937
1006
|
ref: u,
|
|
938
|
-
css:
|
|
1007
|
+
css: Je(c),
|
|
939
1008
|
id: e,
|
|
940
1009
|
noArrow: !0,
|
|
941
1010
|
children: t
|
|
942
1011
|
})] });
|
|
943
|
-
},
|
|
1012
|
+
}, Ze = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
944
1013
|
let [i, a] = h(!1), o = m(t);
|
|
945
1014
|
o.current = t;
|
|
946
1015
|
let s = m(null), c = d((t, r) => {
|
|
@@ -979,26 +1048,26 @@ var U = {
|
|
|
979
1048
|
style: { touchAction: "none" }
|
|
980
1049
|
}
|
|
981
1050
|
};
|
|
982
|
-
},
|
|
1051
|
+
}, Qe = 2, $e = .005, et = "#000", tt = "#0000", nt = (e, t) => {
|
|
983
1052
|
if (!t) return [];
|
|
984
1053
|
let n = /* @__PURE__ */ new Set();
|
|
985
1054
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
986
1055
|
let r = e / t;
|
|
987
|
-
r <=
|
|
1056
|
+
r <= $e || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
988
1057
|
}
|
|
989
1058
|
return n.size ? [
|
|
990
1059
|
0,
|
|
991
1060
|
...[...n].sort((e, t) => e - t),
|
|
992
1061
|
100
|
|
993
1062
|
] : [];
|
|
994
|
-
},
|
|
995
|
-
let n =
|
|
1063
|
+
}, rt = (e, t) => {
|
|
1064
|
+
let n = Qe / 2, r = e.length - 2, i = [];
|
|
996
1065
|
for (let a = 0; a <= r; a += 1) {
|
|
997
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)`;
|
|
998
|
-
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)`);
|
|
999
1068
|
}
|
|
1000
1069
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
1001
|
-
},
|
|
1070
|
+
}, it = /* @__PURE__ */ new Set([
|
|
1002
1071
|
"op",
|
|
1003
1072
|
"ops",
|
|
1004
1073
|
"opening",
|
|
@@ -1006,7 +1075,7 @@ var U = {
|
|
|
1006
1075
|
"ncop",
|
|
1007
1076
|
"オープニング",
|
|
1008
1077
|
"op主題歌"
|
|
1009
|
-
]),
|
|
1078
|
+
]), at = /* @__PURE__ */ new Set([
|
|
1010
1079
|
"ed",
|
|
1011
1080
|
"eds",
|
|
1012
1081
|
"ending",
|
|
@@ -1019,13 +1088,13 @@ var U = {
|
|
|
1019
1088
|
"エンドカード",
|
|
1020
1089
|
"エンドロール",
|
|
1021
1090
|
"ed主題歌"
|
|
1022
|
-
]),
|
|
1091
|
+
]), ot = /* @__PURE__ */ new Set(["intro", "イントロ"]), st = /* @__PURE__ */ new Set(["outro", "アウトロ"]), ct = {
|
|
1023
1092
|
"credits start": "ending",
|
|
1024
1093
|
"credits end": null,
|
|
1025
1094
|
"preview end": null,
|
|
1026
1095
|
"end credits": "ending",
|
|
1027
1096
|
"closing credits": "ending"
|
|
1028
|
-
},
|
|
1097
|
+
}, lt = /* @__PURE__ */ new Set([
|
|
1029
1098
|
"theme",
|
|
1030
1099
|
"themes",
|
|
1031
1100
|
"song",
|
|
@@ -1044,53 +1113,53 @@ var U = {
|
|
|
1044
1113
|
"the",
|
|
1045
1114
|
"主題歌",
|
|
1046
1115
|
"ノンクレジット"
|
|
1047
|
-
]),
|
|
1116
|
+
]), ut = /* @__PURE__ */ new Set([
|
|
1048
1117
|
"post",
|
|
1049
1118
|
"pre",
|
|
1050
1119
|
"after",
|
|
1051
1120
|
"before",
|
|
1052
1121
|
"non"
|
|
1053
|
-
]),
|
|
1054
|
-
if (
|
|
1055
|
-
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";
|
|
1056
1125
|
if (t) {
|
|
1057
|
-
if (
|
|
1058
|
-
if (
|
|
1126
|
+
if (ot.has(e)) return "opening";
|
|
1127
|
+
if (st.has(e)) return "ending";
|
|
1059
1128
|
}
|
|
1060
|
-
},
|
|
1061
|
-
if (
|
|
1129
|
+
}, ht = (e, t) => {
|
|
1130
|
+
if (ft(e)) return;
|
|
1062
1131
|
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) =>
|
|
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;
|
|
1066
1135
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
1067
1136
|
for (let e of i) {
|
|
1068
|
-
let n =
|
|
1137
|
+
let n = pt(e);
|
|
1069
1138
|
if (n.length !== 1) continue;
|
|
1070
|
-
let r =
|
|
1139
|
+
let r = mt(n[0], t);
|
|
1071
1140
|
if (r) return r;
|
|
1072
1141
|
}
|
|
1073
|
-
},
|
|
1142
|
+
}, gt = 15, _t = 87, vt = 93, yt = (e) => {
|
|
1074
1143
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
1075
1144
|
if (!n) return t;
|
|
1076
1145
|
let r = e.map((e, t) => ({
|
|
1077
1146
|
index: t,
|
|
1078
1147
|
start: e.start,
|
|
1079
1148
|
length: e.end - e.start
|
|
1080
|
-
})).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);
|
|
1081
1150
|
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 }) =>
|
|
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);
|
|
1084
1153
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
1085
1154
|
let i = e.map((e, n) => {
|
|
1086
|
-
if (e.end - e.start <
|
|
1155
|
+
if (e.end - e.start < gt) return;
|
|
1087
1156
|
let r = t[n];
|
|
1088
1157
|
if (r) return r;
|
|
1089
|
-
let i =
|
|
1158
|
+
let i = ht(e.title, !0);
|
|
1090
1159
|
return i && !t.includes(i) ? i : void 0;
|
|
1091
1160
|
});
|
|
1092
|
-
return e.every(({ title: e }) =>
|
|
1093
|
-
},
|
|
1161
|
+
return e.every(({ title: e }) => ft(e)) ? yt(e) : i;
|
|
1162
|
+
}, xt = _`
|
|
1094
1163
|
position: relative;
|
|
1095
1164
|
height: calc(.4 * var(--mp-unit));
|
|
1096
1165
|
|
|
@@ -1309,7 +1378,7 @@ var U = {
|
|
|
1309
1378
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1310
1379
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1311
1380
|
}
|
|
1312
|
-
`,
|
|
1381
|
+
`, St = 4, Ct = () => {
|
|
1313
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) => {
|
|
1314
1383
|
C(e), u(e);
|
|
1315
1384
|
}, T = !!S;
|
|
@@ -1318,13 +1387,13 @@ var U = {
|
|
|
1318
1387
|
}, [_, T]), f(() => {
|
|
1319
1388
|
v && w(void 0);
|
|
1320
1389
|
}, [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 } =
|
|
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({
|
|
1322
1391
|
ref: y,
|
|
1323
1392
|
onChange: (e) => {
|
|
1324
1393
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1325
1394
|
else if (!M.current) {
|
|
1326
1395
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1327
|
-
Math.abs(e - j.current) * t >
|
|
1396
|
+
Math.abs(e - j.current) * t > St && (M.current = !0);
|
|
1328
1397
|
}
|
|
1329
1398
|
x(e), E.current !== "mouse" && w(e * r);
|
|
1330
1399
|
}
|
|
@@ -1387,7 +1456,7 @@ var U = {
|
|
|
1387
1456
|
N,
|
|
1388
1457
|
b,
|
|
1389
1458
|
g
|
|
1390
|
-
]), U = p(() =>
|
|
1459
|
+
]), U = p(() => nt(d, r), [d, r]), W = U.length > 0, G = p(() => {
|
|
1391
1460
|
if (!W || S === void 0 || !r) return -1;
|
|
1392
1461
|
let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
|
|
1393
1462
|
return t >= 0 ? t : U.length - 2;
|
|
@@ -1396,11 +1465,11 @@ var U = {
|
|
|
1396
1465
|
U,
|
|
1397
1466
|
S,
|
|
1398
1467
|
r
|
|
1399
|
-
]), re = p(() => W ?
|
|
1468
|
+
]), re = p(() => W ? rt(U, (e) => e !== G) : void 0, [
|
|
1400
1469
|
W,
|
|
1401
1470
|
U,
|
|
1402
1471
|
G
|
|
1403
|
-
]), ie = p(() => G >= 0 ?
|
|
1472
|
+
]), ie = p(() => G >= 0 ? rt(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
|
|
1404
1473
|
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1405
1474
|
}, [d, S]), J = p(() => {
|
|
1406
1475
|
if (S) {
|
|
@@ -1430,7 +1499,7 @@ var U = {
|
|
|
1430
1499
|
]
|
|
1431
1500
|
});
|
|
1432
1501
|
return /* @__PURE__ */ O("div", {
|
|
1433
|
-
css:
|
|
1502
|
+
css: xt,
|
|
1434
1503
|
ref: y,
|
|
1435
1504
|
className: [
|
|
1436
1505
|
"progress-bar",
|
|
@@ -1451,7 +1520,7 @@ var U = {
|
|
|
1451
1520
|
},
|
|
1452
1521
|
children: [/* @__PURE__ */ D("span", {
|
|
1453
1522
|
className: "cursor-time-value",
|
|
1454
|
-
children:
|
|
1523
|
+
children: Ke(S)
|
|
1455
1524
|
}), q ? /* @__PURE__ */ D("span", {
|
|
1456
1525
|
className: "chapter-title",
|
|
1457
1526
|
children: q.title
|
|
@@ -1475,7 +1544,7 @@ var U = {
|
|
|
1475
1544
|
})
|
|
1476
1545
|
]
|
|
1477
1546
|
});
|
|
1478
|
-
},
|
|
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 = {
|
|
1479
1548
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1480
1549
|
width: 24,
|
|
1481
1550
|
height: 24,
|
|
@@ -1485,8 +1554,8 @@ var U = {
|
|
|
1485
1554
|
strokeWidth: 2,
|
|
1486
1555
|
strokeLinecap: "round",
|
|
1487
1556
|
strokeLinejoin: "round"
|
|
1488
|
-
},
|
|
1489
|
-
...
|
|
1557
|
+
}, Et = (e) => /* @__PURE__ */ O("svg", {
|
|
1558
|
+
...Tt,
|
|
1490
1559
|
...e,
|
|
1491
1560
|
children: [
|
|
1492
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" }),
|
|
@@ -1500,8 +1569,8 @@ var U = {
|
|
|
1500
1569
|
}),
|
|
1501
1570
|
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1502
1571
|
]
|
|
1503
|
-
}),
|
|
1504
|
-
...
|
|
1572
|
+
}), Dt = (e) => /* @__PURE__ */ O("svg", {
|
|
1573
|
+
...Tt,
|
|
1505
1574
|
...e,
|
|
1506
1575
|
children: [
|
|
1507
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" }),
|
|
@@ -1515,7 +1584,7 @@ var U = {
|
|
|
1515
1584
|
}),
|
|
1516
1585
|
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1517
1586
|
]
|
|
1518
|
-
}),
|
|
1587
|
+
}), Ot = _`
|
|
1519
1588
|
.popover {
|
|
1520
1589
|
position: absolute;
|
|
1521
1590
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1642,7 +1711,7 @@ var U = {
|
|
|
1642
1711
|
${Z.bSmall.regular}
|
|
1643
1712
|
}
|
|
1644
1713
|
}
|
|
1645
|
-
`,
|
|
1714
|
+
`, kt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1646
1715
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1647
1716
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1648
1717
|
return /* @__PURE__ */ O("div", {
|
|
@@ -1669,7 +1738,7 @@ var U = {
|
|
|
1669
1738
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1670
1739
|
]
|
|
1671
1740
|
});
|
|
1672
|
-
},
|
|
1741
|
+
}, At = ({ onReset: e } = {}) => {
|
|
1673
1742
|
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1674
1743
|
c.current = e;
|
|
1675
1744
|
let l = () => {
|
|
@@ -1710,7 +1779,7 @@ var U = {
|
|
|
1710
1779
|
});
|
|
1711
1780
|
}
|
|
1712
1781
|
};
|
|
1713
|
-
},
|
|
1782
|
+
}, jt = _`
|
|
1714
1783
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1715
1784
|
which is the width of the player box, so it can be clamped to it. */
|
|
1716
1785
|
position: static;
|
|
@@ -1726,7 +1795,7 @@ position: static;
|
|
|
1726
1795
|
}
|
|
1727
1796
|
}
|
|
1728
1797
|
|
|
1729
|
-
${
|
|
1798
|
+
${Ot}
|
|
1730
1799
|
|
|
1731
1800
|
.popover.error-list {
|
|
1732
1801
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1798,23 +1867,23 @@ ${wt}
|
|
|
1798
1867
|
}
|
|
1799
1868
|
}
|
|
1800
1869
|
}
|
|
1801
|
-
`,
|
|
1802
|
-
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();
|
|
1803
1872
|
return [
|
|
1804
1873
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1805
1874
|
e.message,
|
|
1806
1875
|
e.detail
|
|
1807
1876
|
].filter(Boolean).join("\n");
|
|
1808
|
-
}).join("\n\n"),
|
|
1809
|
-
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);
|
|
1810
1879
|
if (e.length === 0) return null;
|
|
1811
1880
|
let o = () => {
|
|
1812
|
-
navigator.clipboard?.writeText(
|
|
1881
|
+
navigator.clipboard?.writeText(Ft(e)).then(() => {
|
|
1813
1882
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1814
1883
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1815
|
-
}, s = `Playback errors (${
|
|
1884
|
+
}, s = `Playback errors (${Pt(e)})`;
|
|
1816
1885
|
return /* @__PURE__ */ O("div", {
|
|
1817
|
-
css:
|
|
1886
|
+
css: jt,
|
|
1818
1887
|
ref: r,
|
|
1819
1888
|
children: [/* @__PURE__ */ D($, {
|
|
1820
1889
|
id: "errors",
|
|
@@ -1845,9 +1914,9 @@ ${wt}
|
|
|
1845
1914
|
/* @__PURE__ */ O("span", {
|
|
1846
1915
|
className: "when",
|
|
1847
1916
|
children: [
|
|
1848
|
-
|
|
1849
|
-
e.count > 1 ? ` to ${
|
|
1850
|
-
|
|
1917
|
+
Mt(e.at),
|
|
1918
|
+
e.count > 1 ? ` to ${Mt(e.lastAt)}` : "",
|
|
1919
|
+
Nt(e.atMediaTime) ? ` at ${Nt(e.atMediaTime)}` : "",
|
|
1851
1920
|
e.recovered ? " recovered" : "",
|
|
1852
1921
|
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1853
1922
|
className: "count",
|
|
@@ -1867,7 +1936,7 @@ ${wt}
|
|
|
1867
1936
|
}, `${e.at}-${t}`))]
|
|
1868
1937
|
})]
|
|
1869
1938
|
});
|
|
1870
|
-
},
|
|
1939
|
+
}, Lt = _`
|
|
1871
1940
|
display: flex;
|
|
1872
1941
|
align-items: center;
|
|
1873
1942
|
justify-content: center;
|
|
@@ -1920,8 +1989,8 @@ width: 100%;
|
|
|
1920
1989
|
}
|
|
1921
1990
|
}
|
|
1922
1991
|
}
|
|
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 } =
|
|
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({
|
|
1925
1994
|
ref: r,
|
|
1926
1995
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1927
1996
|
}), d = (t) => {
|
|
@@ -1937,7 +2006,7 @@ width: 100%;
|
|
|
1937
2006
|
}, [t]);
|
|
1938
2007
|
let p = c(s);
|
|
1939
2008
|
return /* @__PURE__ */ O("div", {
|
|
1940
|
-
css:
|
|
2009
|
+
css: Lt,
|
|
1941
2010
|
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1942
2011
|
className: "playback-slider",
|
|
1943
2012
|
ref: n,
|
|
@@ -1955,7 +2024,7 @@ width: 100%;
|
|
|
1955
2024
|
})
|
|
1956
2025
|
})]
|
|
1957
2026
|
});
|
|
1958
|
-
},
|
|
2027
|
+
}, zt = _`
|
|
1959
2028
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1960
2029
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1961
2030
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1973,7 +2042,7 @@ position: static;
|
|
|
1973
2042
|
}
|
|
1974
2043
|
}
|
|
1975
2044
|
|
|
1976
|
-
${
|
|
2045
|
+
${Ot}
|
|
1977
2046
|
|
|
1978
2047
|
.switch {
|
|
1979
2048
|
position: relative;
|
|
@@ -2049,8 +2118,8 @@ ${wt}
|
|
|
2049
2118
|
}
|
|
2050
2119
|
}
|
|
2051
2120
|
|
|
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 } =
|
|
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) => {
|
|
2054
2123
|
e.setPlaybackRate(t), c(0);
|
|
2055
2124
|
}, _ = (e) => {
|
|
2056
2125
|
e !== void 0 && m(e, () => i(e));
|
|
@@ -2060,7 +2129,7 @@ ${wt}
|
|
|
2060
2129
|
c(e);
|
|
2061
2130
|
};
|
|
2062
2131
|
return /* @__PURE__ */ O("div", {
|
|
2063
|
-
css:
|
|
2132
|
+
css: zt,
|
|
2064
2133
|
ref: d,
|
|
2065
2134
|
children: [
|
|
2066
2135
|
/* @__PURE__ */ D($, {
|
|
@@ -2122,7 +2191,7 @@ ${wt}
|
|
|
2122
2191
|
}),
|
|
2123
2192
|
/* @__PURE__ */ D("div", {
|
|
2124
2193
|
className: "slider no-hover",
|
|
2125
|
-
children: /* @__PURE__ */ D(
|
|
2194
|
+
children: /* @__PURE__ */ D(Rt, {})
|
|
2126
2195
|
}),
|
|
2127
2196
|
/* @__PURE__ */ O("div", {
|
|
2128
2197
|
className: "options no-hover",
|
|
@@ -2147,7 +2216,7 @@ ${wt}
|
|
|
2147
2216
|
})
|
|
2148
2217
|
]
|
|
2149
2218
|
}),
|
|
2150
|
-
l && s === 2 && /* @__PURE__ */ D(
|
|
2219
|
+
l && s === 2 && /* @__PURE__ */ D(kt, {
|
|
2151
2220
|
title: "Audio",
|
|
2152
2221
|
tracks: n,
|
|
2153
2222
|
selected: r,
|
|
@@ -2156,7 +2225,7 @@ ${wt}
|
|
|
2156
2225
|
pending: f,
|
|
2157
2226
|
failed: p
|
|
2158
2227
|
}),
|
|
2159
|
-
l && s === 3 && a && /* @__PURE__ */ D(
|
|
2228
|
+
l && s === 3 && a && /* @__PURE__ */ D(kt, {
|
|
2160
2229
|
title: "Quality",
|
|
2161
2230
|
tracks: a.options,
|
|
2162
2231
|
selected: a.selectedId ?? void 0,
|
|
@@ -2168,7 +2237,7 @@ ${wt}
|
|
|
2168
2237
|
})
|
|
2169
2238
|
]
|
|
2170
2239
|
});
|
|
2171
|
-
},
|
|
2240
|
+
}, Vt = _`
|
|
2172
2241
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2173
2242
|
which is the width of the player box, so it can be clamped to it. */
|
|
2174
2243
|
position: static;
|
|
@@ -2184,13 +2253,13 @@ position: static;
|
|
|
2184
2253
|
}
|
|
2185
2254
|
}
|
|
2186
2255
|
|
|
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 } =
|
|
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();
|
|
2190
2259
|
if (e.length === 0) return null;
|
|
2191
2260
|
let u = t !== void 0;
|
|
2192
2261
|
return /* @__PURE__ */ O("div", {
|
|
2193
|
-
css:
|
|
2262
|
+
css: Vt,
|
|
2194
2263
|
ref: o,
|
|
2195
2264
|
children: [/* @__PURE__ */ D($, {
|
|
2196
2265
|
id: "subtitles",
|
|
@@ -2205,7 +2274,7 @@ ${wt}
|
|
|
2205
2274
|
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
2206
2275
|
}),
|
|
2207
2276
|
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2208
|
-
}), i && /* @__PURE__ */ D(
|
|
2277
|
+
}), i && /* @__PURE__ */ D(kt, {
|
|
2209
2278
|
title: "Subtitles",
|
|
2210
2279
|
tracks: e,
|
|
2211
2280
|
selected: t,
|
|
@@ -2215,13 +2284,13 @@ ${wt}
|
|
|
2215
2284
|
failed: c
|
|
2216
2285
|
})]
|
|
2217
2286
|
});
|
|
2218
|
-
},
|
|
2287
|
+
}, Ut = {
|
|
2219
2288
|
primary: "#EAEBEE",
|
|
2220
2289
|
secondary: "#D0D0D9",
|
|
2221
2290
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2222
2291
|
borderPrimary: "#384F70",
|
|
2223
2292
|
backgroundTooltip: "#222222"
|
|
2224
|
-
},
|
|
2293
|
+
}, Wt = _`
|
|
2225
2294
|
display: flex;
|
|
2226
2295
|
align-items: center;
|
|
2227
2296
|
|
|
@@ -2264,8 +2333,8 @@ ${wt}
|
|
|
2264
2333
|
width: 10px;
|
|
2265
2334
|
height: 10px;
|
|
2266
2335
|
}
|
|
2267
|
-
`,
|
|
2268
|
-
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({
|
|
2269
2338
|
ref: a,
|
|
2270
2339
|
onChange: t
|
|
2271
2340
|
}), s = (n) => {
|
|
@@ -2279,12 +2348,12 @@ ${wt}
|
|
|
2279
2348
|
e && e.removeEventListener("wheel", s);
|
|
2280
2349
|
};
|
|
2281
2350
|
}, [e]);
|
|
2282
|
-
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]);
|
|
2283
2352
|
return /* @__PURE__ */ D($, {
|
|
2284
2353
|
id: "volume-slider",
|
|
2285
2354
|
text: /* @__PURE__ */ D("div", {
|
|
2286
2355
|
ref: i,
|
|
2287
|
-
css:
|
|
2356
|
+
css: Wt,
|
|
2288
2357
|
...o,
|
|
2289
2358
|
children: /* @__PURE__ */ D("div", {
|
|
2290
2359
|
ref: a,
|
|
@@ -2303,7 +2372,7 @@ ${wt}
|
|
|
2303
2372
|
children: [l, "%"]
|
|
2304
2373
|
})
|
|
2305
2374
|
});
|
|
2306
|
-
},
|
|
2375
|
+
}, Kt = _`
|
|
2307
2376
|
position: relative;
|
|
2308
2377
|
display: flex;
|
|
2309
2378
|
align-items: center;
|
|
@@ -2366,10 +2435,10 @@ ${wt}
|
|
|
2366
2435
|
}
|
|
2367
2436
|
}
|
|
2368
2437
|
|
|
2369
|
-
`,
|
|
2370
|
-
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]);
|
|
2371
2440
|
return /* @__PURE__ */ O("div", {
|
|
2372
|
-
css:
|
|
2441
|
+
css: Kt,
|
|
2373
2442
|
children: [/* @__PURE__ */ D($, {
|
|
2374
2443
|
id: "sound",
|
|
2375
2444
|
text: /* @__PURE__ */ D("button", {
|
|
@@ -2389,16 +2458,16 @@ ${wt}
|
|
|
2389
2458
|
className: "volume-slider-container",
|
|
2390
2459
|
children: /* @__PURE__ */ D("div", {
|
|
2391
2460
|
className: "volume-slider-background",
|
|
2392
|
-
children: /* @__PURE__ */ D(
|
|
2461
|
+
children: /* @__PURE__ */ D(Gt, {
|
|
2393
2462
|
value: r ? 0 : i,
|
|
2394
2463
|
onChange: (e) => {
|
|
2395
|
-
t.setVolume(
|
|
2464
|
+
t.setVolume(We(e));
|
|
2396
2465
|
}
|
|
2397
2466
|
})
|
|
2398
2467
|
})
|
|
2399
2468
|
})]
|
|
2400
2469
|
});
|
|
2401
|
-
},
|
|
2470
|
+
}, Jt = .05, Yt = 5, Xt = 50, Zt = 1e3, Qt = _`
|
|
2402
2471
|
position: absolute;
|
|
2403
2472
|
bottom: 0;
|
|
2404
2473
|
width: 100%;
|
|
@@ -2490,7 +2559,7 @@ ${wt}
|
|
|
2490
2559
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2491
2560
|
of its own and so is never :hover */
|
|
2492
2561
|
:hover, &.armed {
|
|
2493
|
-
background-color: ${
|
|
2562
|
+
background-color: ${Ut.hover};
|
|
2494
2563
|
}
|
|
2495
2564
|
|
|
2496
2565
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2528,36 +2597,36 @@ ${wt}
|
|
|
2528
2597
|
}
|
|
2529
2598
|
}
|
|
2530
2599
|
}
|
|
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]),
|
|
2600
|
+
`, $t = ({ shortcuts: e = "window", root: t }) => {
|
|
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 }) => {
|
|
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();
|
|
2604
|
+
}, [n]), A = m(!1);
|
|
2536
2605
|
f(() => {
|
|
2537
2606
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
2538
|
-
|
|
2607
|
+
A.current = !!t.current?.contains(i(e) ?? null);
|
|
2539
2608
|
}, o = (a) => {
|
|
2540
2609
|
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 &&
|
|
2610
|
+
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "") || (a.ctrlKey || a.metaKey || a.altKey) && !a.getModifierState("AltGraph")) return;
|
|
2611
|
+
let s = t.current?.contains(o ?? null) || o === document.body && A.current;
|
|
2543
2612
|
if (e === "player" && !n.fullscreen && !s) return;
|
|
2544
2613
|
let c = !0;
|
|
2545
2614
|
if (a.key === "f") n.toggleFullscreen();
|
|
2546
2615
|
else if (a.key === "k") n.togglePaused();
|
|
2547
2616
|
else if (a.key === " ") n.togglePaused();
|
|
2548
2617
|
else if (a.key === "m") n.toggleMuted();
|
|
2549
|
-
else if (a.key === "ArrowUp")
|
|
2618
|
+
else if (a.key === "ArrowUp") k({
|
|
2550
2619
|
direction: "up",
|
|
2551
|
-
stepSize:
|
|
2620
|
+
stepSize: Jt
|
|
2552
2621
|
});
|
|
2553
|
-
else if (a.key === "ArrowDown")
|
|
2622
|
+
else if (a.key === "ArrowDown") k({
|
|
2554
2623
|
direction: "down",
|
|
2555
|
-
stepSize:
|
|
2624
|
+
stepSize: Jt
|
|
2556
2625
|
});
|
|
2557
2626
|
else if (a.key === "ArrowRight") {
|
|
2558
2627
|
if (!n.duration) return;
|
|
2559
|
-
r(Math.min(n.currentTime +
|
|
2560
|
-
} 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;
|
|
2561
2630
|
c && a.preventDefault();
|
|
2562
2631
|
};
|
|
2563
2632
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2565,24 +2634,25 @@ ${wt}
|
|
|
2565
2634
|
};
|
|
2566
2635
|
}, [
|
|
2567
2636
|
n,
|
|
2568
|
-
|
|
2637
|
+
k,
|
|
2569
2638
|
v,
|
|
2639
|
+
y,
|
|
2570
2640
|
e,
|
|
2571
2641
|
t
|
|
2572
2642
|
]);
|
|
2573
|
-
let
|
|
2574
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2643
|
+
let j = d((e) => {
|
|
2644
|
+
e.preventDefault(), e.deltaY < 0 ? k({
|
|
2575
2645
|
direction: "up",
|
|
2576
|
-
stepSize:
|
|
2577
|
-
}) :
|
|
2646
|
+
stepSize: Jt
|
|
2647
|
+
}) : k({
|
|
2578
2648
|
direction: "down",
|
|
2579
|
-
stepSize:
|
|
2649
|
+
stepSize: Jt
|
|
2580
2650
|
});
|
|
2581
|
-
}, [
|
|
2651
|
+
}, [k]);
|
|
2582
2652
|
f(() => {
|
|
2583
|
-
if (
|
|
2584
|
-
}, [
|
|
2585
|
-
let
|
|
2653
|
+
if (b) return b.addEventListener("wheel", j, { passive: !1 }), () => b.removeEventListener("wheel", j);
|
|
2654
|
+
}, [b, j]);
|
|
2655
|
+
let M = (e) => {
|
|
2586
2656
|
if (!g || g.active || g.armed || e.pointerType === "touch") return;
|
|
2587
2657
|
let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
|
|
2588
2658
|
g.arm({
|
|
@@ -2591,29 +2661,29 @@ ${wt}
|
|
|
2591
2661
|
width: r,
|
|
2592
2662
|
height: i
|
|
2593
2663
|
});
|
|
2594
|
-
},
|
|
2664
|
+
}, N = !!g?.armed;
|
|
2595
2665
|
return f(() => {
|
|
2596
|
-
if (!
|
|
2597
|
-
clearInterval(
|
|
2666
|
+
if (!N) return;
|
|
2667
|
+
clearInterval(C.current);
|
|
2598
2668
|
let e = Infinity, t = setInterval(() => {
|
|
2599
2669
|
if (Date.now() > e) {
|
|
2600
2670
|
clearInterval(t);
|
|
2601
2671
|
return;
|
|
2602
2672
|
}
|
|
2603
|
-
let n =
|
|
2673
|
+
let n = S.current, r = document.activeElement;
|
|
2604
2674
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2605
|
-
},
|
|
2606
|
-
return
|
|
2607
|
-
e = Date.now() +
|
|
2675
|
+
}, Xt);
|
|
2676
|
+
return C.current = t, () => {
|
|
2677
|
+
e = Date.now() + Zt;
|
|
2608
2678
|
};
|
|
2609
|
-
}, [
|
|
2679
|
+
}, [N]), f(() => () => clearInterval(C.current), []), /* @__PURE__ */ O("div", {
|
|
2610
2680
|
className: "control-bar",
|
|
2611
|
-
css:
|
|
2681
|
+
css: Qt,
|
|
2612
2682
|
style: { ...c ? {
|
|
2613
2683
|
opacity: "0",
|
|
2614
2684
|
pointerEvents: "none"
|
|
2615
|
-
} :
|
|
2616
|
-
children: [/* @__PURE__ */ D(
|
|
2685
|
+
} : N ? { pointerEvents: "none" } : {} },
|
|
2686
|
+
children: [/* @__PURE__ */ D(Ct, {}), /* @__PURE__ */ O("div", {
|
|
2617
2687
|
className: "actions",
|
|
2618
2688
|
children: [/* @__PURE__ */ O("div", {
|
|
2619
2689
|
className: "left",
|
|
@@ -2625,37 +2695,37 @@ ${wt}
|
|
|
2625
2695
|
className: "play",
|
|
2626
2696
|
type: "button",
|
|
2627
2697
|
onClick: () => n.togglePaused(),
|
|
2628
|
-
"aria-label":
|
|
2629
|
-
children: D(
|
|
2698
|
+
"aria-label": E ? "Replay" : r ? "Play" : "Pause",
|
|
2699
|
+
children: D(E ? z : r ? R : L, {})
|
|
2630
2700
|
}),
|
|
2631
|
-
toolTipText: /* @__PURE__ */ D("span", { children:
|
|
2701
|
+
toolTipText: /* @__PURE__ */ D("span", { children: E ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2632
2702
|
}),
|
|
2633
|
-
/* @__PURE__ */ D(
|
|
2703
|
+
/* @__PURE__ */ D(qt, { ref: x }),
|
|
2634
2704
|
/* @__PURE__ */ D("div", {
|
|
2635
2705
|
className: "time",
|
|
2636
|
-
children:
|
|
2706
|
+
children: qe(o ?? i, a)
|
|
2637
2707
|
})
|
|
2638
2708
|
]
|
|
2639
2709
|
}), /* @__PURE__ */ O("div", {
|
|
2640
2710
|
className: "right",
|
|
2641
2711
|
children: [
|
|
2642
|
-
/* @__PURE__ */ D(Mt, {}),
|
|
2643
|
-
/* @__PURE__ */ D(Rt, {}),
|
|
2644
2712
|
/* @__PURE__ */ D(It, {}),
|
|
2713
|
+
/* @__PURE__ */ D(Ht, {}),
|
|
2714
|
+
/* @__PURE__ */ D(Bt, {}),
|
|
2645
2715
|
g ? /* @__PURE__ */ D($, {
|
|
2646
2716
|
id: "picture-in-picture",
|
|
2647
2717
|
tooltipPlace: "top-end",
|
|
2648
2718
|
text: /* @__PURE__ */ D("button", {
|
|
2649
|
-
ref:
|
|
2719
|
+
ref: S,
|
|
2650
2720
|
className: g.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2651
2721
|
type: "button",
|
|
2652
|
-
onPointerEnter:
|
|
2653
|
-
onPointerMove:
|
|
2722
|
+
onPointerEnter: M,
|
|
2723
|
+
onPointerMove: M,
|
|
2654
2724
|
onClick: g.active ? g.exit : void 0,
|
|
2655
2725
|
"aria-label": "Picture in picture",
|
|
2656
2726
|
"aria-pressed": g.active,
|
|
2657
2727
|
children: /* @__PURE__ */ D("img", {
|
|
2658
|
-
src:
|
|
2728
|
+
src: wt,
|
|
2659
2729
|
alt: ""
|
|
2660
2730
|
})
|
|
2661
2731
|
}),
|
|
@@ -2667,15 +2737,15 @@ ${wt}
|
|
|
2667
2737
|
className: "picture-in-picture",
|
|
2668
2738
|
type: "button",
|
|
2669
2739
|
onClick: l,
|
|
2670
|
-
disabled:
|
|
2671
|
-
"aria-label":
|
|
2672
|
-
"aria-pressed":
|
|
2673
|
-
children:
|
|
2674
|
-
src:
|
|
2740
|
+
disabled: w && !T,
|
|
2741
|
+
"aria-label": w ? "Put the subtitles in the video" : "Picture in picture",
|
|
2742
|
+
"aria-pressed": w ? p : void 0,
|
|
2743
|
+
children: w ? D(p ? Et : Dt, {}) : /* @__PURE__ */ D("img", {
|
|
2744
|
+
src: wt,
|
|
2675
2745
|
alt: ""
|
|
2676
2746
|
})
|
|
2677
2747
|
}),
|
|
2678
|
-
toolTipText: /* @__PURE__ */ D("span", { children:
|
|
2748
|
+
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
2749
|
}) : null,
|
|
2680
2750
|
/* @__PURE__ */ D($, {
|
|
2681
2751
|
id: "full-screen",
|
|
@@ -2694,7 +2764,7 @@ ${wt}
|
|
|
2694
2764
|
})]
|
|
2695
2765
|
})]
|
|
2696
2766
|
});
|
|
2697
|
-
},
|
|
2767
|
+
}, en = 9e3, tn = _`
|
|
2698
2768
|
position: absolute;
|
|
2699
2769
|
inset: 0;
|
|
2700
2770
|
z-index: 2;
|
|
@@ -2737,7 +2807,7 @@ ${wt}
|
|
|
2737
2807
|
line-height: 1;
|
|
2738
2808
|
color: #fff;
|
|
2739
2809
|
}
|
|
2740
|
-
`,
|
|
2810
|
+
`, nn = () => {
|
|
2741
2811
|
let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2742
2812
|
return f(() => {
|
|
2743
2813
|
if (t !== "burn-in" || !e) {
|
|
@@ -2745,10 +2815,10 @@ ${wt}
|
|
|
2745
2815
|
return;
|
|
2746
2816
|
}
|
|
2747
2817
|
r(!0);
|
|
2748
|
-
let n = setTimeout(() => r(!1),
|
|
2818
|
+
let n = setTimeout(() => r(!1), en);
|
|
2749
2819
|
return () => clearTimeout(n);
|
|
2750
2820
|
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2751
|
-
css:
|
|
2821
|
+
css: tn,
|
|
2752
2822
|
className: n ? "show" : "",
|
|
2753
2823
|
role: "status",
|
|
2754
2824
|
children: /* @__PURE__ */ O("div", {
|
|
@@ -2763,10 +2833,10 @@ ${wt}
|
|
|
2763
2833
|
})]
|
|
2764
2834
|
})
|
|
2765
2835
|
});
|
|
2766
|
-
},
|
|
2836
|
+
}, rn = 1, an = 6e3, on = 1, sn = {
|
|
2767
2837
|
opening: "Skip Opening",
|
|
2768
2838
|
ending: "Skip Ending"
|
|
2769
|
-
},
|
|
2839
|
+
}, cn = _`
|
|
2770
2840
|
position: absolute;
|
|
2771
2841
|
inset: 0;
|
|
2772
2842
|
z-index: 2;
|
|
@@ -2817,10 +2887,10 @@ ${wt}
|
|
|
2817
2887
|
bottom: calc(9 * var(--mp-unit));
|
|
2818
2888
|
}
|
|
2819
2889
|
}
|
|
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(() =>
|
|
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(() => {
|
|
2822
2892
|
if (typeof t != "number") return;
|
|
2823
|
-
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;
|
|
2824
2894
|
return r ? {
|
|
2825
2895
|
kind: r,
|
|
2826
2896
|
end: e[n].end
|
|
@@ -2832,7 +2902,7 @@ ${wt}
|
|
|
2832
2902
|
]), s = m(0), [c, l] = h(0);
|
|
2833
2903
|
f(() => {
|
|
2834
2904
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2835
|
-
s.current = e, e < n -
|
|
2905
|
+
s.current = e, e < n - on && l((e) => e + 1);
|
|
2836
2906
|
}, [t]);
|
|
2837
2907
|
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2838
2908
|
return f(() => {
|
|
@@ -2841,12 +2911,12 @@ ${wt}
|
|
|
2841
2911
|
return;
|
|
2842
2912
|
}
|
|
2843
2913
|
d(!0);
|
|
2844
|
-
let e = setTimeout(() => d(!1),
|
|
2914
|
+
let e = setTimeout(() => d(!1), an);
|
|
2845
2915
|
return () => clearTimeout(e);
|
|
2846
2916
|
}, [g, c]), f(() => {
|
|
2847
2917
|
o || d(!1);
|
|
2848
2918
|
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2849
|
-
css:
|
|
2919
|
+
css: cn,
|
|
2850
2920
|
className: u && !r ? "show" : "",
|
|
2851
2921
|
children: /* @__PURE__ */ D("button", {
|
|
2852
2922
|
type: "button",
|
|
@@ -2854,10 +2924,10 @@ ${wt}
|
|
|
2854
2924
|
onClick: () => {
|
|
2855
2925
|
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2856
2926
|
},
|
|
2857
|
-
children:
|
|
2927
|
+
children: sn[o.kind]
|
|
2858
2928
|
})
|
|
2859
2929
|
}) : null;
|
|
2860
|
-
},
|
|
2930
|
+
}, un = 3e3, dn = _`
|
|
2861
2931
|
position: absolute;
|
|
2862
2932
|
inset: 0;
|
|
2863
2933
|
z-index: 2;
|
|
@@ -2868,10 +2938,10 @@ ${wt}
|
|
|
2868
2938
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2869
2939
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2870
2940
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2871
|
-
`,
|
|
2941
|
+
`, fn = (e, t) => {
|
|
2872
2942
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2873
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')`;
|
|
2874
|
-
},
|
|
2944
|
+
}, pn = _`
|
|
2875
2945
|
position: relative;
|
|
2876
2946
|
background-color: black;
|
|
2877
2947
|
display: flex;
|
|
@@ -2928,13 +2998,13 @@ ${wt}
|
|
|
2928
2998
|
&.hide {
|
|
2929
2999
|
cursor: none;
|
|
2930
3000
|
}
|
|
2931
|
-
`,
|
|
3001
|
+
`, mn = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2932
3002
|
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2933
|
-
return u(e) && e.type === l ?
|
|
3003
|
+
return u(e) && e.type === l ? mn(e.props.children, `${r}/`) : [{
|
|
2934
3004
|
key: r,
|
|
2935
3005
|
item: e
|
|
2936
3006
|
}];
|
|
2937
|
-
}),
|
|
3007
|
+
}), hn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2938
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({
|
|
2939
3009
|
x: -1,
|
|
2940
3010
|
y: -1
|
|
@@ -2955,12 +3025,12 @@ ${wt}
|
|
|
2955
3025
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
2956
3026
|
}, S = () => {
|
|
2957
3027
|
if (x()) {
|
|
2958
|
-
p.current = setTimeout(S,
|
|
3028
|
+
p.current = setTimeout(S, un);
|
|
2959
3029
|
return;
|
|
2960
3030
|
}
|
|
2961
3031
|
y();
|
|
2962
3032
|
}, C = () => {
|
|
2963
|
-
l(!1), clearTimeout(p.current), p.current = setTimeout(S,
|
|
3033
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, un);
|
|
2964
3034
|
}, w = (e) => {
|
|
2965
3035
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
2966
3036
|
x: e.clientX,
|
|
@@ -2972,7 +3042,7 @@ ${wt}
|
|
|
2972
3042
|
_.current = !1;
|
|
2973
3043
|
}, k = m(!0);
|
|
2974
3044
|
return /* @__PURE__ */ O("div", {
|
|
2975
|
-
css:
|
|
3045
|
+
css: pn,
|
|
2976
3046
|
ref: b,
|
|
2977
3047
|
onPointerMove: w,
|
|
2978
3048
|
onPointerDown: T,
|
|
@@ -2987,9 +3057,9 @@ ${wt}
|
|
|
2987
3057
|
className: c ? "hide" : "",
|
|
2988
3058
|
tabIndex: a === "player" ? -1 : void 0,
|
|
2989
3059
|
children: [
|
|
2990
|
-
/* @__PURE__ */ D(
|
|
2991
|
-
|
|
2992
|
-
css:
|
|
3060
|
+
/* @__PURE__ */ D(Ve, { onSubtitleRef: n }),
|
|
3061
|
+
mn(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
3062
|
+
css: dn,
|
|
2993
3063
|
style: { ...c ? {
|
|
2994
3064
|
opacity: "0",
|
|
2995
3065
|
visibility: "hidden",
|
|
@@ -2997,15 +3067,15 @@ ${wt}
|
|
|
2997
3067
|
} : {} },
|
|
2998
3068
|
children: t
|
|
2999
3069
|
}, e)),
|
|
3000
|
-
i === !1 ? null : /* @__PURE__ */ D(
|
|
3070
|
+
i === !1 ? null : /* @__PURE__ */ D($t, {
|
|
3001
3071
|
shortcuts: a,
|
|
3002
3072
|
root: v
|
|
3003
3073
|
}),
|
|
3004
|
-
/* @__PURE__ */ D(
|
|
3005
|
-
/* @__PURE__ */ D(
|
|
3074
|
+
/* @__PURE__ */ D(nn, {}),
|
|
3075
|
+
/* @__PURE__ */ D(ln, {}),
|
|
3006
3076
|
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
3007
3077
|
className: "pass-through",
|
|
3008
|
-
style: { clipPath:
|
|
3078
|
+
style: { clipPath: fn(d.armed, v.current.getBoundingClientRect()) },
|
|
3009
3079
|
onPointerOver: d.disarm
|
|
3010
3080
|
}) : null,
|
|
3011
3081
|
/* @__PURE__ */ O("div", {
|
|
@@ -3028,9 +3098,9 @@ ${wt}
|
|
|
3028
3098
|
})
|
|
3029
3099
|
]
|
|
3030
3100
|
});
|
|
3031
|
-
},
|
|
3101
|
+
}, gn = ({ options: e, children: t }) => {
|
|
3032
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;
|
|
3033
|
-
f(() => (v?.(E), () => v?.(null)), [E, v]);
|
|
3103
|
+
f(() => (v?.(E), () => v?.(null)), [E, v]), pe(E, n?.stepFrame);
|
|
3034
3104
|
let { expose: O } = e, k = O === !0 ? {} : O || void 0, A = m(k);
|
|
3035
3105
|
A.current = k;
|
|
3036
3106
|
let j = k ? k.id : void 0, M = k ? k.origin : void 0, N = k ? k.channel : void 0;
|
|
@@ -3049,7 +3119,7 @@ ${wt}
|
|
|
3049
3119
|
M,
|
|
3050
3120
|
N
|
|
3051
3121
|
]);
|
|
3052
|
-
let P = p(() =>
|
|
3122
|
+
let P = p(() => Pe(), [o]);
|
|
3053
3123
|
le(S, w, r, _ ? P.push : void 0);
|
|
3054
3124
|
let F = r?.normalizeVolume ?? !0, [I, L] = h(F);
|
|
3055
3125
|
f(() => {
|
|
@@ -3059,7 +3129,7 @@ ${wt}
|
|
|
3059
3129
|
R.current = r?.onNormalizeVolumeChange;
|
|
3060
3130
|
let z = r?.normalizerWorkletUrl, B = m(d ?? u);
|
|
3061
3131
|
B.current = d ?? u;
|
|
3062
|
-
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 ? _ ? {
|
|
3063
3133
|
tap: P,
|
|
3064
3134
|
audioStreamIndex: V
|
|
3065
3135
|
} : {
|
|
@@ -3086,13 +3156,13 @@ ${wt}
|
|
|
3086
3156
|
z,
|
|
3087
3157
|
I,
|
|
3088
3158
|
ee
|
|
3089
|
-
]), { thumbnails: ne, requestThumbnail: U } =
|
|
3159
|
+
]), { thumbnails: ne, requestThumbnail: U } = ge({
|
|
3090
3160
|
publicPath: c,
|
|
3091
3161
|
workerUrl: l,
|
|
3092
3162
|
length: g === !1 ? void 0 : o,
|
|
3093
3163
|
read: d ?? u,
|
|
3094
3164
|
downloadedRanges: s
|
|
3095
|
-
}), 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;
|
|
3096
3166
|
f(() => {
|
|
3097
3167
|
J({
|
|
3098
3168
|
title: i,
|
|
@@ -3158,7 +3228,7 @@ ${wt}
|
|
|
3158
3228
|
J({ quality: se });
|
|
3159
3229
|
}, [J, se]), f(() => {
|
|
3160
3230
|
a && J({ chapters: a });
|
|
3161
|
-
}, [J, a]), /* @__PURE__ */ D(
|
|
3231
|
+
}, [J, a]), /* @__PURE__ */ D(hn, {
|
|
3162
3232
|
ref: y,
|
|
3163
3233
|
onVideoRef: n ? void 0 : C,
|
|
3164
3234
|
onSubtitleRef: T,
|
|
@@ -3167,7 +3237,7 @@ ${wt}
|
|
|
3167
3237
|
shortcuts: e.shortcuts,
|
|
3168
3238
|
children: t
|
|
3169
3239
|
});
|
|
3170
|
-
},
|
|
3240
|
+
}, _n = _`
|
|
3171
3241
|
/**
|
|
3172
3242
|
* The chrome's whole scale, in one place.
|
|
3173
3243
|
*
|
|
@@ -3237,17 +3307,17 @@ ${wt}
|
|
|
3237
3307
|
height: 100%;
|
|
3238
3308
|
width: 100%;
|
|
3239
3309
|
overflow: hidden;
|
|
3240
|
-
`,
|
|
3241
|
-
css:
|
|
3242
|
-
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, {
|
|
3243
3313
|
options: e,
|
|
3244
3314
|
children: e.children
|
|
3245
3315
|
}) })
|
|
3246
|
-
}),
|
|
3316
|
+
}), yn = (e) => !!e && typeof e == "object" && "at" in e, bn = (e) => !!e && typeof e == "object" && "selection" in e, xn = ({ blob: e, name: t }) => ({
|
|
3247
3317
|
length: e.size,
|
|
3248
3318
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3249
3319
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3250
|
-
}),
|
|
3320
|
+
}), Sn = async (e, t) => {
|
|
3251
3321
|
let n = await fetch(e, {
|
|
3252
3322
|
headers: { Range: "bytes=0-1" },
|
|
3253
3323
|
credentials: t
|
|
@@ -3257,8 +3327,8 @@ ${wt}
|
|
|
3257
3327
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3258
3328
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3259
3329
|
return i;
|
|
3260
|
-
},
|
|
3261
|
-
let i = t ?? await
|
|
3330
|
+
}, Cn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3331
|
+
let i = t ?? await Sn(e, r);
|
|
3262
3332
|
return {
|
|
3263
3333
|
length: i,
|
|
3264
3334
|
name: n,
|
|
@@ -3274,9 +3344,9 @@ ${wt}
|
|
|
3274
3344
|
},
|
|
3275
3345
|
readsDownload: !0
|
|
3276
3346
|
};
|
|
3277
|
-
},
|
|
3278
|
-
if ("blob" in e) return
|
|
3279
|
-
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);
|
|
3280
3350
|
if ("read" in e) return {
|
|
3281
3351
|
length: e.length,
|
|
3282
3352
|
name: e.name,
|
|
@@ -3285,4 +3355,4 @@ ${wt}
|
|
|
3285
3355
|
throw Error(`Unknown source type: ${e}`);
|
|
3286
3356
|
};
|
|
3287
3357
|
//#endregion
|
|
3288
|
-
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 };
|