@livo-tv/blocks 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +259 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +260 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3893,10 +3893,18 @@ function useHlsPlayback({
|
|
|
3893
3893
|
};
|
|
3894
3894
|
}
|
|
3895
3895
|
|
|
3896
|
+
// src/components/video/appleMobile.ts
|
|
3897
|
+
function isAppleMobileDevice(nav = navigator) {
|
|
3898
|
+
if (/iP(hone|ad|od)/.test(nav.userAgent)) return true;
|
|
3899
|
+
return nav.platform === "MacIntel" && nav.maxTouchPoints > 1;
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3896
3902
|
// src/components/video/captions.ts
|
|
3897
3903
|
var CAPTION_LOCALES = ["en", "es", "pt"];
|
|
3898
3904
|
var LIVE_CUE_EXTRA_LAG_MS = 2e3;
|
|
3899
3905
|
var LIVE_STACK_MAX_CUES = 150;
|
|
3906
|
+
var IOS_CAPTION_WINDOW_LINES = 3;
|
|
3907
|
+
var IOS_CAPTION_CHARS_PER_LINE = 40;
|
|
3900
3908
|
var LIVE_LAG_SPIKE_MS = 2500;
|
|
3901
3909
|
function stabilizeLiveLagMs(previous, next) {
|
|
3902
3910
|
if (previous == null || !Number.isFinite(previous)) return next;
|
|
@@ -4044,6 +4052,17 @@ function coalesceLiveCaptionCues(cues) {
|
|
|
4044
4052
|
}
|
|
4045
4053
|
return out;
|
|
4046
4054
|
}
|
|
4055
|
+
function lastLiveCaptionWindow(cues, maxCues = IOS_CAPTION_WINDOW_LINES) {
|
|
4056
|
+
return cues.slice(-Math.max(1, maxCues));
|
|
4057
|
+
}
|
|
4058
|
+
function lastCaptionLines(text, lines = IOS_CAPTION_WINDOW_LINES, charsPerLine = IOS_CAPTION_CHARS_PER_LINE) {
|
|
4059
|
+
const trimmed = text.trim().replace(/\s+/g, " ");
|
|
4060
|
+
const maxChars = Math.max(1, lines) * Math.max(1, charsPerLine);
|
|
4061
|
+
if (trimmed.length <= maxChars) return trimmed;
|
|
4062
|
+
const slice = trimmed.slice(-maxChars);
|
|
4063
|
+
const space = slice.indexOf(" ");
|
|
4064
|
+
return (space > 0 ? slice.slice(space + 1) : slice).trim();
|
|
4065
|
+
}
|
|
4047
4066
|
function mergeLiveCaptionCues(existing, incoming, cap = LIVE_STACK_MAX_CUES) {
|
|
4048
4067
|
const map = /* @__PURE__ */ new Map();
|
|
4049
4068
|
for (const cue of existing) {
|
|
@@ -4113,7 +4132,11 @@ function isEmbeddedWindow(win = window) {
|
|
|
4113
4132
|
}
|
|
4114
4133
|
}
|
|
4115
4134
|
var NEAR_BOTTOM_PX = 24;
|
|
4116
|
-
function LiveCaptionStack({
|
|
4135
|
+
function LiveCaptionStack({
|
|
4136
|
+
cues,
|
|
4137
|
+
latestLabel,
|
|
4138
|
+
variant = "scroll"
|
|
4139
|
+
}) {
|
|
4117
4140
|
const scrollerRef = React9__namespace.useRef(null);
|
|
4118
4141
|
const followRef = React9__namespace.useRef(true);
|
|
4119
4142
|
const ignoreScrollRef = React9__namespace.useRef(false);
|
|
@@ -4152,13 +4175,15 @@ function LiveCaptionStack({ cues, latestLabel }) {
|
|
|
4152
4175
|
});
|
|
4153
4176
|
}, [lastReceivedAt, prefersReduced, cues.length]);
|
|
4154
4177
|
if (cues.length === 0) return null;
|
|
4178
|
+
const windowed = variant === "window";
|
|
4155
4179
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4156
4180
|
"div",
|
|
4157
4181
|
{
|
|
4158
4182
|
className: "pointer-events-none absolute inset-x-0 bottom-16 z-[1] flex justify-center px-4",
|
|
4159
4183
|
"data-slot": "video-captions",
|
|
4184
|
+
"data-caption-mode": variant,
|
|
4160
4185
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full max-w-[90%]", children: [
|
|
4161
|
-
!following && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4186
|
+
!windowed && !following && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4162
4187
|
"button",
|
|
4163
4188
|
{
|
|
4164
4189
|
type: "button",
|
|
@@ -4170,11 +4195,14 @@ function LiveCaptionStack({ cues, latestLabel }) {
|
|
|
4170
4195
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4171
4196
|
"div",
|
|
4172
4197
|
{
|
|
4173
|
-
ref: scrollerRef,
|
|
4198
|
+
ref: windowed ? void 0 : scrollerRef,
|
|
4174
4199
|
role: "log",
|
|
4175
4200
|
"aria-relevant": "additions",
|
|
4176
|
-
className:
|
|
4177
|
-
|
|
4201
|
+
className: cn(
|
|
4202
|
+
"rounded-sm bg-black/70 px-3 py-1.5 text-[length:clamp(10px,2.6cqh,0.875rem)] font-medium text-white shadow-sm [-webkit-text-size-adjust:100%] [text-size-adjust:100%]",
|
|
4203
|
+
windowed ? "overflow-hidden" : "pointer-events-auto max-h-[min(4.5rem,18cqh)] overflow-x-hidden overflow-y-auto"
|
|
4204
|
+
),
|
|
4205
|
+
onScroll: windowed ? void 0 : (event) => {
|
|
4178
4206
|
if (ignoreScrollRef.current) return;
|
|
4179
4207
|
const scroller = event.currentTarget;
|
|
4180
4208
|
const nearBottom = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight < NEAR_BOTTOM_PX;
|
|
@@ -4186,6 +4214,7 @@ function LiveCaptionStack({ cues, latestLabel }) {
|
|
|
4186
4214
|
{
|
|
4187
4215
|
className: cn(
|
|
4188
4216
|
"text-justify [text-align-last:left] leading-snug break-words",
|
|
4217
|
+
windowed && "line-clamp-3",
|
|
4189
4218
|
!prefersReduced && "transition-opacity"
|
|
4190
4219
|
),
|
|
4191
4220
|
children: cues.map((cue, index) => {
|
|
@@ -4263,6 +4292,8 @@ var DEFAULT_LABELS3 = {
|
|
|
4263
4292
|
pictureInPicture: "Picture in picture",
|
|
4264
4293
|
cast: "Cast",
|
|
4265
4294
|
settings: "Settings",
|
|
4295
|
+
more: "More",
|
|
4296
|
+
back: "Back",
|
|
4266
4297
|
quality: "Quality",
|
|
4267
4298
|
auto: "Auto",
|
|
4268
4299
|
speed: "Speed",
|
|
@@ -4288,6 +4319,7 @@ var PLAYBACK_RATES = [0.75, 1, 1.25, 1.5, 2];
|
|
|
4288
4319
|
var CONTROLS_HIDE_MS = 3e3;
|
|
4289
4320
|
var LIVE_EDGE_THRESHOLD_S = 8;
|
|
4290
4321
|
var SEEK_STEP_S = 5;
|
|
4322
|
+
var COMPACT_CHROME_PX = 640;
|
|
4291
4323
|
var VIDEO_MEDIA_STYLE = `
|
|
4292
4324
|
.livo-video-player-media::-webkit-media-controls-start-playback-button {
|
|
4293
4325
|
display: none !important;
|
|
@@ -4390,6 +4422,10 @@ function VideoPlayer({
|
|
|
4390
4422
|
const [controlsVisible, setControlsVisible] = React9__namespace.useState(true);
|
|
4391
4423
|
const [playbackRate, setPlaybackRate] = React9__namespace.useState(1);
|
|
4392
4424
|
const [openMenu, setOpenMenu] = React9__namespace.useState(null);
|
|
4425
|
+
const [morePane, setMorePane] = React9__namespace.useState(
|
|
4426
|
+
"root"
|
|
4427
|
+
);
|
|
4428
|
+
const [compactChrome, setCompactChrome] = React9__namespace.useState(false);
|
|
4393
4429
|
const [captionLocale, setCaptionLocale] = React9__namespace.useState(defaultCaptionLocale ?? "off");
|
|
4394
4430
|
const [captionCues, setCaptionCues] = React9__namespace.useState([]);
|
|
4395
4431
|
const [liveCaptionCues, setLiveCaptionCues] = React9__namespace.useState([]);
|
|
@@ -4398,8 +4434,27 @@ function VideoPlayer({
|
|
|
4398
4434
|
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React9__namespace.useState(false);
|
|
4399
4435
|
const [embedded, setEmbedded] = React9__namespace.useState(false);
|
|
4400
4436
|
const [cssFullscreen, setCssFullscreen] = React9__namespace.useState(false);
|
|
4437
|
+
const [appleMobile, setAppleMobile] = React9__namespace.useState(false);
|
|
4401
4438
|
const hideTimerRef = React9__namespace.useRef(null);
|
|
4402
4439
|
cssFullscreenRef.current = cssFullscreen;
|
|
4440
|
+
React9__namespace.useEffect(() => {
|
|
4441
|
+
const el = containerRef.current;
|
|
4442
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4443
|
+
const apply = (width) => {
|
|
4444
|
+
if (width <= 0) return;
|
|
4445
|
+
setCompactChrome(width < COMPACT_CHROME_PX);
|
|
4446
|
+
};
|
|
4447
|
+
apply(el.clientWidth);
|
|
4448
|
+
const observer = new ResizeObserver((entries) => {
|
|
4449
|
+
const width = entries[0]?.contentRect.width;
|
|
4450
|
+
if (typeof width === "number") apply(width);
|
|
4451
|
+
});
|
|
4452
|
+
observer.observe(el);
|
|
4453
|
+
return () => observer.disconnect();
|
|
4454
|
+
}, [active]);
|
|
4455
|
+
React9__namespace.useEffect(() => {
|
|
4456
|
+
if (openMenu !== "more") setMorePane("root");
|
|
4457
|
+
}, [openMenu]);
|
|
4403
4458
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
4404
4459
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
|
|
4405
4460
|
React9__namespace.useEffect(() => {
|
|
@@ -4455,6 +4510,7 @@ function VideoPlayer({
|
|
|
4455
4510
|
}, [paused, videoRef, isPlaying]);
|
|
4456
4511
|
React9__namespace.useEffect(() => {
|
|
4457
4512
|
setEmbedded(isEmbeddedWindow());
|
|
4513
|
+
setAppleMobile(isAppleMobileDevice());
|
|
4458
4514
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
4459
4515
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
4460
4516
|
videoRef.current?.setAttribute("webkit-playsinline", "");
|
|
@@ -4574,6 +4630,7 @@ function VideoPlayer({
|
|
|
4574
4630
|
const liveDueCues = liveCaptionsBaseUrl ? coalesceLiveCaptionCues(
|
|
4575
4631
|
liveCuesDue(liveCaptionCues, Date.now(), liveLagMs)
|
|
4576
4632
|
) : endedLiveReplay ? coalesceLiveCaptionCues(vttCuesDueAt(captionCues, currentTime)) : [];
|
|
4633
|
+
const captionStackCues = appleMobile ? lastLiveCaptionWindow(liveDueCues) : liveDueCues;
|
|
4577
4634
|
const activeCaption = liveCaptionsBaseUrl || endedLiveReplay ? null : captionAtTime(captionCues, currentTime);
|
|
4578
4635
|
React9__namespace.useEffect(() => {
|
|
4579
4636
|
const video = videoRef.current;
|
|
@@ -4606,8 +4663,12 @@ function VideoPlayer({
|
|
|
4606
4663
|
const track = nativeTrackRef.current;
|
|
4607
4664
|
if (!video || !track) return;
|
|
4608
4665
|
if (!(liveCaptionsBaseUrl || endedLiveReplay)) return;
|
|
4609
|
-
syncNativeCaptionCue(
|
|
4610
|
-
|
|
4666
|
+
syncNativeCaptionCue(
|
|
4667
|
+
video,
|
|
4668
|
+
track,
|
|
4669
|
+
lastCaptionLines(joinCaptionTexts(captionStackCues))
|
|
4670
|
+
);
|
|
4671
|
+
}, [captionStackCues, liveCaptionsBaseUrl, endedLiveReplay]);
|
|
4611
4672
|
function togglePlay() {
|
|
4612
4673
|
const video = videoRef.current;
|
|
4613
4674
|
if (!video) return;
|
|
@@ -4759,6 +4820,7 @@ function VideoPlayer({
|
|
|
4759
4820
|
const showControls = active && state === "ready" && (controlsVisible || !isPlaying);
|
|
4760
4821
|
const showPoster = !active && !!poster;
|
|
4761
4822
|
const currentLevelLabel = activeLevel < 0 ? t.auto : `${qualities.find((q) => q.index === activeLevel)?.height ?? ""}p`;
|
|
4823
|
+
const showQuality = showQualitySelector && qualities.length > 1;
|
|
4762
4824
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4763
4825
|
"div",
|
|
4764
4826
|
{
|
|
@@ -4857,7 +4919,14 @@ function VideoPlayer({
|
|
|
4857
4919
|
] }),
|
|
4858
4920
|
typeof stats?.viewers === "number" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-black/60 px-2 py-0.5 text-xs", children: t.formatViewers ? t.formatViewers(stats.viewers) : `\u{1F441} ${stats.viewers}` })
|
|
4859
4921
|
] }),
|
|
4860
|
-
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4922
|
+
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4923
|
+
LiveCaptionStack,
|
|
4924
|
+
{
|
|
4925
|
+
cues: captionStackCues,
|
|
4926
|
+
latestLabel: t.captionsLatest,
|
|
4927
|
+
variant: appleMobile ? "window" : "scroll"
|
|
4928
|
+
}
|
|
4929
|
+
),
|
|
4861
4930
|
!liveCaptionsBaseUrl && !endedLiveReplay && activeCaption && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4862
4931
|
"div",
|
|
4863
4932
|
{
|
|
@@ -4886,7 +4955,7 @@ function VideoPlayer({
|
|
|
4886
4955
|
formatTime
|
|
4887
4956
|
}
|
|
4888
4957
|
),
|
|
4889
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4958
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-1 sm:gap-2", children: [
|
|
4890
4959
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4891
4960
|
ControlButton,
|
|
4892
4961
|
{
|
|
@@ -4904,7 +4973,7 @@ function VideoPlayer({
|
|
|
4904
4973
|
children: /* @__PURE__ */ jsxRuntime.jsx(VolumeIcon, { className: "size-5" })
|
|
4905
4974
|
}
|
|
4906
4975
|
),
|
|
4907
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 px-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4976
|
+
!compactChrome && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 px-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4908
4977
|
Slider,
|
|
4909
4978
|
{
|
|
4910
4979
|
"aria-label": "Volume",
|
|
@@ -4916,25 +4985,24 @@ function VideoPlayer({
|
|
|
4916
4985
|
}
|
|
4917
4986
|
) })
|
|
4918
4987
|
] }),
|
|
4919
|
-
mode === "vod" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 text-xs tabular-nums", children: [
|
|
4988
|
+
mode === "vod" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 shrink-0 text-xs tabular-nums", children: [
|
|
4920
4989
|
formatTime(currentTime),
|
|
4921
|
-
|
|
4922
|
-
formatTime(duration)
|
|
4990
|
+
!compactChrome && ` / ${formatTime(duration)}`
|
|
4923
4991
|
] }),
|
|
4924
4992
|
mode === "live" && behindLive && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4925
4993
|
"button",
|
|
4926
4994
|
{
|
|
4927
4995
|
type: "button",
|
|
4928
4996
|
onClick: goToLiveEdge,
|
|
4929
|
-
className: "ml-1 flex items-center gap-1 rounded bg-white/15 px-2 py-0.5 text-xs hover:bg-white/25",
|
|
4997
|
+
className: "ml-1 flex shrink-0 items-center gap-1 rounded bg-white/15 px-2 py-0.5 text-xs hover:bg-white/25",
|
|
4930
4998
|
children: [
|
|
4931
4999
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
|
|
4932
5000
|
t.goLive
|
|
4933
5001
|
]
|
|
4934
5002
|
}
|
|
4935
5003
|
),
|
|
4936
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
4937
|
-
mode === "vod" && typeof stats?.views === "number" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1 text-xs", children: t.formatViews ? t.formatViews(stats.views) : `${stats.views} views` }),
|
|
5004
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1", children: [
|
|
5005
|
+
!compactChrome && mode === "vod" && typeof stats?.views === "number" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1 text-xs", children: t.formatViews ? t.formatViews(stats.views) : `${stats.views} views` }),
|
|
4938
5006
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4939
5007
|
MenuControl,
|
|
4940
5008
|
{
|
|
@@ -4963,7 +5031,7 @@ function VideoPlayer({
|
|
|
4963
5031
|
]
|
|
4964
5032
|
}
|
|
4965
5033
|
),
|
|
4966
|
-
mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5034
|
+
!compactChrome && mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4967
5035
|
MenuControl,
|
|
4968
5036
|
{
|
|
4969
5037
|
label: t.speed,
|
|
@@ -4987,7 +5055,7 @@ function VideoPlayer({
|
|
|
4987
5055
|
))
|
|
4988
5056
|
}
|
|
4989
5057
|
),
|
|
4990
|
-
|
|
5058
|
+
!compactChrome && showQuality && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4991
5059
|
MenuControl,
|
|
4992
5060
|
{
|
|
4993
5061
|
label: t.quality,
|
|
@@ -5019,7 +5087,7 @@ function VideoPlayer({
|
|
|
5019
5087
|
]
|
|
5020
5088
|
}
|
|
5021
5089
|
),
|
|
5022
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5090
|
+
!compactChrome && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5023
5091
|
ControlButton,
|
|
5024
5092
|
{
|
|
5025
5093
|
label: t.cast,
|
|
@@ -5029,12 +5097,115 @@ function VideoPlayer({
|
|
|
5029
5097
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cast, { className: "size-5" })
|
|
5030
5098
|
}
|
|
5031
5099
|
),
|
|
5032
|
-
pipSupported && /* @__PURE__ */ jsxRuntime.jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5100
|
+
!compactChrome && pipSupported && /* @__PURE__ */ jsxRuntime.jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5033
5101
|
lucideReact.PictureInPicture2,
|
|
5034
5102
|
{
|
|
5035
5103
|
className: cn("size-5", pipActive && "text-primary")
|
|
5036
5104
|
}
|
|
5037
5105
|
) }),
|
|
5106
|
+
compactChrome && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5107
|
+
MenuControl,
|
|
5108
|
+
{
|
|
5109
|
+
label: t.more,
|
|
5110
|
+
open: openMenu === "more",
|
|
5111
|
+
onOpenChange: (o) => setOpenMenu(o ? "more" : null),
|
|
5112
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EllipsisVertical, { className: "size-5" }),
|
|
5113
|
+
children: morePane === "speed" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5114
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5115
|
+
MenuBack,
|
|
5116
|
+
{
|
|
5117
|
+
label: t.back,
|
|
5118
|
+
title: t.speed,
|
|
5119
|
+
onSelect: () => setMorePane("root")
|
|
5120
|
+
}
|
|
5121
|
+
),
|
|
5122
|
+
PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5123
|
+
MenuItem,
|
|
5124
|
+
{
|
|
5125
|
+
selected: rate === playbackRate,
|
|
5126
|
+
onSelect: () => changeRate(rate),
|
|
5127
|
+
children: [
|
|
5128
|
+
rate,
|
|
5129
|
+
"\xD7"
|
|
5130
|
+
]
|
|
5131
|
+
},
|
|
5132
|
+
rate
|
|
5133
|
+
))
|
|
5134
|
+
] }) : morePane === "quality" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5135
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5136
|
+
MenuBack,
|
|
5137
|
+
{
|
|
5138
|
+
label: t.back,
|
|
5139
|
+
title: t.quality,
|
|
5140
|
+
onSelect: () => setMorePane("root")
|
|
5141
|
+
}
|
|
5142
|
+
),
|
|
5143
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5144
|
+
MenuItem,
|
|
5145
|
+
{
|
|
5146
|
+
selected: activeLevel < 0,
|
|
5147
|
+
onSelect: () => chooseLevel(-1),
|
|
5148
|
+
children: t.auto
|
|
5149
|
+
}
|
|
5150
|
+
),
|
|
5151
|
+
qualities.map((q) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5152
|
+
MenuItem,
|
|
5153
|
+
{
|
|
5154
|
+
selected: activeLevel === q.index,
|
|
5155
|
+
onSelect: () => chooseLevel(q.index),
|
|
5156
|
+
children: [
|
|
5157
|
+
q.height,
|
|
5158
|
+
"p"
|
|
5159
|
+
]
|
|
5160
|
+
},
|
|
5161
|
+
q.index
|
|
5162
|
+
))
|
|
5163
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5164
|
+
mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5165
|
+
MenuNavRow,
|
|
5166
|
+
{
|
|
5167
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Gauge, { className: "size-4" }),
|
|
5168
|
+
label: t.speed,
|
|
5169
|
+
value: `${playbackRate}\xD7`,
|
|
5170
|
+
onSelect: () => setMorePane("speed")
|
|
5171
|
+
}
|
|
5172
|
+
),
|
|
5173
|
+
showQuality && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5174
|
+
MenuNavRow,
|
|
5175
|
+
{
|
|
5176
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" }),
|
|
5177
|
+
label: t.quality,
|
|
5178
|
+
value: currentLevelLabel,
|
|
5179
|
+
onSelect: () => setMorePane("quality")
|
|
5180
|
+
}
|
|
5181
|
+
),
|
|
5182
|
+
(mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-white/15" }),
|
|
5183
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5184
|
+
MenuAction,
|
|
5185
|
+
{
|
|
5186
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cast, { className: "size-4" }),
|
|
5187
|
+
onSelect: () => {
|
|
5188
|
+
setOpenMenu(null);
|
|
5189
|
+
void castHlsUrl(src).catch(() => void 0);
|
|
5190
|
+
},
|
|
5191
|
+
children: t.cast
|
|
5192
|
+
}
|
|
5193
|
+
),
|
|
5194
|
+
pipSupported && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5195
|
+
MenuAction,
|
|
5196
|
+
{
|
|
5197
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PictureInPicture2, { className: "size-4" }),
|
|
5198
|
+
active: pipActive,
|
|
5199
|
+
onSelect: () => {
|
|
5200
|
+
setOpenMenu(null);
|
|
5201
|
+
togglePip();
|
|
5202
|
+
},
|
|
5203
|
+
children: t.pictureInPicture
|
|
5204
|
+
}
|
|
5205
|
+
)
|
|
5206
|
+
] })
|
|
5207
|
+
}
|
|
5208
|
+
),
|
|
5038
5209
|
fullscreenSupported && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5039
5210
|
ControlButton,
|
|
5040
5211
|
{
|
|
@@ -5098,7 +5269,7 @@ function MenuControl({
|
|
|
5098
5269
|
"div",
|
|
5099
5270
|
{
|
|
5100
5271
|
role: "menu",
|
|
5101
|
-
className: "absolute right-0 bottom-full z-10 mb-2 min-w-
|
|
5272
|
+
className: "absolute right-0 bottom-full z-10 mb-2 min-w-52 rounded-md bg-black/90 p-1 text-sm shadow-lg backdrop-blur-sm",
|
|
5102
5273
|
children
|
|
5103
5274
|
}
|
|
5104
5275
|
)
|
|
@@ -5116,7 +5287,7 @@ function MenuItem({
|
|
|
5116
5287
|
role: "menuitemradio",
|
|
5117
5288
|
"aria-checked": selected,
|
|
5118
5289
|
onClick: onSelect,
|
|
5119
|
-
className: "flex w-full items-center justify-between gap-3 rounded px-2 py-
|
|
5290
|
+
className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5120
5291
|
children: [
|
|
5121
5292
|
children,
|
|
5122
5293
|
selected && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4" })
|
|
@@ -5124,6 +5295,72 @@ function MenuItem({
|
|
|
5124
5295
|
}
|
|
5125
5296
|
);
|
|
5126
5297
|
}
|
|
5298
|
+
function MenuNavRow({
|
|
5299
|
+
icon,
|
|
5300
|
+
label,
|
|
5301
|
+
value,
|
|
5302
|
+
onSelect
|
|
5303
|
+
}) {
|
|
5304
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5305
|
+
"button",
|
|
5306
|
+
{
|
|
5307
|
+
type: "button",
|
|
5308
|
+
role: "menuitem",
|
|
5309
|
+
"aria-label": `${label}, ${value}`,
|
|
5310
|
+
onClick: onSelect,
|
|
5311
|
+
className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5312
|
+
children: [
|
|
5313
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/70", children: icon }),
|
|
5314
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: label }),
|
|
5315
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/50", children: value }),
|
|
5316
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-4 text-white/50" })
|
|
5317
|
+
]
|
|
5318
|
+
}
|
|
5319
|
+
);
|
|
5320
|
+
}
|
|
5321
|
+
function MenuBack({
|
|
5322
|
+
label,
|
|
5323
|
+
title,
|
|
5324
|
+
onSelect
|
|
5325
|
+
}) {
|
|
5326
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5327
|
+
"button",
|
|
5328
|
+
{
|
|
5329
|
+
type: "button",
|
|
5330
|
+
role: "menuitem",
|
|
5331
|
+
"aria-label": label,
|
|
5332
|
+
onClick: onSelect,
|
|
5333
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5334
|
+
children: [
|
|
5335
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" }),
|
|
5336
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: title })
|
|
5337
|
+
]
|
|
5338
|
+
}
|
|
5339
|
+
);
|
|
5340
|
+
}
|
|
5341
|
+
function MenuAction({
|
|
5342
|
+
onSelect,
|
|
5343
|
+
icon,
|
|
5344
|
+
active,
|
|
5345
|
+
children
|
|
5346
|
+
}) {
|
|
5347
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5348
|
+
"button",
|
|
5349
|
+
{
|
|
5350
|
+
type: "button",
|
|
5351
|
+
role: "menuitem",
|
|
5352
|
+
onClick: onSelect,
|
|
5353
|
+
className: cn(
|
|
5354
|
+
"flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5355
|
+
active && "text-primary"
|
|
5356
|
+
),
|
|
5357
|
+
children: [
|
|
5358
|
+
icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-white/70", active && "text-primary"), children: icon }) : null,
|
|
5359
|
+
children
|
|
5360
|
+
]
|
|
5361
|
+
}
|
|
5362
|
+
);
|
|
5363
|
+
}
|
|
5127
5364
|
|
|
5128
5365
|
// src/components/video/feedPlaybackCoordinator.ts
|
|
5129
5366
|
var players = /* @__PURE__ */ new Map();
|