@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.d.cts
CHANGED
|
@@ -748,6 +748,10 @@ interface VideoPlayerLabels {
|
|
|
748
748
|
pictureInPicture?: string;
|
|
749
749
|
cast?: string;
|
|
750
750
|
settings?: string;
|
|
751
|
+
/** Overflow menu for speed / quality / cast / PiP on a narrow player. */
|
|
752
|
+
more?: string;
|
|
753
|
+
/** Back control on compact More speed / quality panes. */
|
|
754
|
+
back?: string;
|
|
751
755
|
quality?: string;
|
|
752
756
|
auto?: string;
|
|
753
757
|
speed?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -748,6 +748,10 @@ interface VideoPlayerLabels {
|
|
|
748
748
|
pictureInPicture?: string;
|
|
749
749
|
cast?: string;
|
|
750
750
|
settings?: string;
|
|
751
|
+
/** Overflow menu for speed / quality / cast / PiP on a narrow player. */
|
|
752
|
+
more?: string;
|
|
753
|
+
/** Back control on compact More speed / quality panes. */
|
|
754
|
+
back?: string;
|
|
751
755
|
quality?: string;
|
|
752
756
|
auto?: string;
|
|
753
757
|
speed?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React9 from 'react';
|
|
3
3
|
import { createContext, useContext, useState, useRef, useId, useEffect, useCallback, useLayoutEffect } from 'react';
|
|
4
|
-
import { Loader2, AlertTriangle, Inbox, Bell, Monitor, Sun, Moon, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Captions, Settings, Cast, PictureInPicture2, Minimize, Maximize, XIcon } from 'lucide-react';
|
|
4
|
+
import { Loader2, AlertTriangle, Inbox, Bell, Monitor, Sun, Moon, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Captions, Settings, Cast, PictureInPicture2, Gauge, EllipsisVertical, Minimize, Maximize, ChevronRight, ChevronLeft, XIcon } from 'lucide-react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
@@ -3867,10 +3867,18 @@ function useHlsPlayback({
|
|
|
3867
3867
|
};
|
|
3868
3868
|
}
|
|
3869
3869
|
|
|
3870
|
+
// src/components/video/appleMobile.ts
|
|
3871
|
+
function isAppleMobileDevice(nav = navigator) {
|
|
3872
|
+
if (/iP(hone|ad|od)/.test(nav.userAgent)) return true;
|
|
3873
|
+
return nav.platform === "MacIntel" && nav.maxTouchPoints > 1;
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3870
3876
|
// src/components/video/captions.ts
|
|
3871
3877
|
var CAPTION_LOCALES = ["en", "es", "pt"];
|
|
3872
3878
|
var LIVE_CUE_EXTRA_LAG_MS = 2e3;
|
|
3873
3879
|
var LIVE_STACK_MAX_CUES = 150;
|
|
3880
|
+
var IOS_CAPTION_WINDOW_LINES = 3;
|
|
3881
|
+
var IOS_CAPTION_CHARS_PER_LINE = 40;
|
|
3874
3882
|
var LIVE_LAG_SPIKE_MS = 2500;
|
|
3875
3883
|
function stabilizeLiveLagMs(previous, next) {
|
|
3876
3884
|
if (previous == null || !Number.isFinite(previous)) return next;
|
|
@@ -4018,6 +4026,17 @@ function coalesceLiveCaptionCues(cues) {
|
|
|
4018
4026
|
}
|
|
4019
4027
|
return out;
|
|
4020
4028
|
}
|
|
4029
|
+
function lastLiveCaptionWindow(cues, maxCues = IOS_CAPTION_WINDOW_LINES) {
|
|
4030
|
+
return cues.slice(-Math.max(1, maxCues));
|
|
4031
|
+
}
|
|
4032
|
+
function lastCaptionLines(text, lines = IOS_CAPTION_WINDOW_LINES, charsPerLine = IOS_CAPTION_CHARS_PER_LINE) {
|
|
4033
|
+
const trimmed = text.trim().replace(/\s+/g, " ");
|
|
4034
|
+
const maxChars = Math.max(1, lines) * Math.max(1, charsPerLine);
|
|
4035
|
+
if (trimmed.length <= maxChars) return trimmed;
|
|
4036
|
+
const slice = trimmed.slice(-maxChars);
|
|
4037
|
+
const space = slice.indexOf(" ");
|
|
4038
|
+
return (space > 0 ? slice.slice(space + 1) : slice).trim();
|
|
4039
|
+
}
|
|
4021
4040
|
function mergeLiveCaptionCues(existing, incoming, cap = LIVE_STACK_MAX_CUES) {
|
|
4022
4041
|
const map = /* @__PURE__ */ new Map();
|
|
4023
4042
|
for (const cue of existing) {
|
|
@@ -4087,7 +4106,11 @@ function isEmbeddedWindow(win = window) {
|
|
|
4087
4106
|
}
|
|
4088
4107
|
}
|
|
4089
4108
|
var NEAR_BOTTOM_PX = 24;
|
|
4090
|
-
function LiveCaptionStack({
|
|
4109
|
+
function LiveCaptionStack({
|
|
4110
|
+
cues,
|
|
4111
|
+
latestLabel,
|
|
4112
|
+
variant = "scroll"
|
|
4113
|
+
}) {
|
|
4091
4114
|
const scrollerRef = React9.useRef(null);
|
|
4092
4115
|
const followRef = React9.useRef(true);
|
|
4093
4116
|
const ignoreScrollRef = React9.useRef(false);
|
|
@@ -4126,13 +4149,15 @@ function LiveCaptionStack({ cues, latestLabel }) {
|
|
|
4126
4149
|
});
|
|
4127
4150
|
}, [lastReceivedAt, prefersReduced, cues.length]);
|
|
4128
4151
|
if (cues.length === 0) return null;
|
|
4152
|
+
const windowed = variant === "window";
|
|
4129
4153
|
return /* @__PURE__ */ jsx(
|
|
4130
4154
|
"div",
|
|
4131
4155
|
{
|
|
4132
4156
|
className: "pointer-events-none absolute inset-x-0 bottom-16 z-[1] flex justify-center px-4",
|
|
4133
4157
|
"data-slot": "video-captions",
|
|
4158
|
+
"data-caption-mode": variant,
|
|
4134
4159
|
children: /* @__PURE__ */ jsxs("div", { className: "relative w-full max-w-[90%]", children: [
|
|
4135
|
-
!following && /* @__PURE__ */ jsx(
|
|
4160
|
+
!windowed && !following && /* @__PURE__ */ jsx(
|
|
4136
4161
|
"button",
|
|
4137
4162
|
{
|
|
4138
4163
|
type: "button",
|
|
@@ -4144,11 +4169,14 @@ function LiveCaptionStack({ cues, latestLabel }) {
|
|
|
4144
4169
|
/* @__PURE__ */ jsx(
|
|
4145
4170
|
"div",
|
|
4146
4171
|
{
|
|
4147
|
-
ref: scrollerRef,
|
|
4172
|
+
ref: windowed ? void 0 : scrollerRef,
|
|
4148
4173
|
role: "log",
|
|
4149
4174
|
"aria-relevant": "additions",
|
|
4150
|
-
className:
|
|
4151
|
-
|
|
4175
|
+
className: cn(
|
|
4176
|
+
"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%]",
|
|
4177
|
+
windowed ? "overflow-hidden" : "pointer-events-auto max-h-[min(4.5rem,18cqh)] overflow-x-hidden overflow-y-auto"
|
|
4178
|
+
),
|
|
4179
|
+
onScroll: windowed ? void 0 : (event) => {
|
|
4152
4180
|
if (ignoreScrollRef.current) return;
|
|
4153
4181
|
const scroller = event.currentTarget;
|
|
4154
4182
|
const nearBottom = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight < NEAR_BOTTOM_PX;
|
|
@@ -4160,6 +4188,7 @@ function LiveCaptionStack({ cues, latestLabel }) {
|
|
|
4160
4188
|
{
|
|
4161
4189
|
className: cn(
|
|
4162
4190
|
"text-justify [text-align-last:left] leading-snug break-words",
|
|
4191
|
+
windowed && "line-clamp-3",
|
|
4163
4192
|
!prefersReduced && "transition-opacity"
|
|
4164
4193
|
),
|
|
4165
4194
|
children: cues.map((cue, index) => {
|
|
@@ -4237,6 +4266,8 @@ var DEFAULT_LABELS3 = {
|
|
|
4237
4266
|
pictureInPicture: "Picture in picture",
|
|
4238
4267
|
cast: "Cast",
|
|
4239
4268
|
settings: "Settings",
|
|
4269
|
+
more: "More",
|
|
4270
|
+
back: "Back",
|
|
4240
4271
|
quality: "Quality",
|
|
4241
4272
|
auto: "Auto",
|
|
4242
4273
|
speed: "Speed",
|
|
@@ -4262,6 +4293,7 @@ var PLAYBACK_RATES = [0.75, 1, 1.25, 1.5, 2];
|
|
|
4262
4293
|
var CONTROLS_HIDE_MS = 3e3;
|
|
4263
4294
|
var LIVE_EDGE_THRESHOLD_S = 8;
|
|
4264
4295
|
var SEEK_STEP_S = 5;
|
|
4296
|
+
var COMPACT_CHROME_PX = 640;
|
|
4265
4297
|
var VIDEO_MEDIA_STYLE = `
|
|
4266
4298
|
.livo-video-player-media::-webkit-media-controls-start-playback-button {
|
|
4267
4299
|
display: none !important;
|
|
@@ -4364,6 +4396,10 @@ function VideoPlayer({
|
|
|
4364
4396
|
const [controlsVisible, setControlsVisible] = React9.useState(true);
|
|
4365
4397
|
const [playbackRate, setPlaybackRate] = React9.useState(1);
|
|
4366
4398
|
const [openMenu, setOpenMenu] = React9.useState(null);
|
|
4399
|
+
const [morePane, setMorePane] = React9.useState(
|
|
4400
|
+
"root"
|
|
4401
|
+
);
|
|
4402
|
+
const [compactChrome, setCompactChrome] = React9.useState(false);
|
|
4367
4403
|
const [captionLocale, setCaptionLocale] = React9.useState(defaultCaptionLocale ?? "off");
|
|
4368
4404
|
const [captionCues, setCaptionCues] = React9.useState([]);
|
|
4369
4405
|
const [liveCaptionCues, setLiveCaptionCues] = React9.useState([]);
|
|
@@ -4372,8 +4408,27 @@ function VideoPlayer({
|
|
|
4372
4408
|
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React9.useState(false);
|
|
4373
4409
|
const [embedded, setEmbedded] = React9.useState(false);
|
|
4374
4410
|
const [cssFullscreen, setCssFullscreen] = React9.useState(false);
|
|
4411
|
+
const [appleMobile, setAppleMobile] = React9.useState(false);
|
|
4375
4412
|
const hideTimerRef = React9.useRef(null);
|
|
4376
4413
|
cssFullscreenRef.current = cssFullscreen;
|
|
4414
|
+
React9.useEffect(() => {
|
|
4415
|
+
const el = containerRef.current;
|
|
4416
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4417
|
+
const apply = (width) => {
|
|
4418
|
+
if (width <= 0) return;
|
|
4419
|
+
setCompactChrome(width < COMPACT_CHROME_PX);
|
|
4420
|
+
};
|
|
4421
|
+
apply(el.clientWidth);
|
|
4422
|
+
const observer = new ResizeObserver((entries) => {
|
|
4423
|
+
const width = entries[0]?.contentRect.width;
|
|
4424
|
+
if (typeof width === "number") apply(width);
|
|
4425
|
+
});
|
|
4426
|
+
observer.observe(el);
|
|
4427
|
+
return () => observer.disconnect();
|
|
4428
|
+
}, [active]);
|
|
4429
|
+
React9.useEffect(() => {
|
|
4430
|
+
if (openMenu !== "more") setMorePane("root");
|
|
4431
|
+
}, [openMenu]);
|
|
4377
4432
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
4378
4433
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
|
|
4379
4434
|
React9.useEffect(() => {
|
|
@@ -4429,6 +4484,7 @@ function VideoPlayer({
|
|
|
4429
4484
|
}, [paused, videoRef, isPlaying]);
|
|
4430
4485
|
React9.useEffect(() => {
|
|
4431
4486
|
setEmbedded(isEmbeddedWindow());
|
|
4487
|
+
setAppleMobile(isAppleMobileDevice());
|
|
4432
4488
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
4433
4489
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
4434
4490
|
videoRef.current?.setAttribute("webkit-playsinline", "");
|
|
@@ -4548,6 +4604,7 @@ function VideoPlayer({
|
|
|
4548
4604
|
const liveDueCues = liveCaptionsBaseUrl ? coalesceLiveCaptionCues(
|
|
4549
4605
|
liveCuesDue(liveCaptionCues, Date.now(), liveLagMs)
|
|
4550
4606
|
) : endedLiveReplay ? coalesceLiveCaptionCues(vttCuesDueAt(captionCues, currentTime)) : [];
|
|
4607
|
+
const captionStackCues = appleMobile ? lastLiveCaptionWindow(liveDueCues) : liveDueCues;
|
|
4551
4608
|
const activeCaption = liveCaptionsBaseUrl || endedLiveReplay ? null : captionAtTime(captionCues, currentTime);
|
|
4552
4609
|
React9.useEffect(() => {
|
|
4553
4610
|
const video = videoRef.current;
|
|
@@ -4580,8 +4637,12 @@ function VideoPlayer({
|
|
|
4580
4637
|
const track = nativeTrackRef.current;
|
|
4581
4638
|
if (!video || !track) return;
|
|
4582
4639
|
if (!(liveCaptionsBaseUrl || endedLiveReplay)) return;
|
|
4583
|
-
syncNativeCaptionCue(
|
|
4584
|
-
|
|
4640
|
+
syncNativeCaptionCue(
|
|
4641
|
+
video,
|
|
4642
|
+
track,
|
|
4643
|
+
lastCaptionLines(joinCaptionTexts(captionStackCues))
|
|
4644
|
+
);
|
|
4645
|
+
}, [captionStackCues, liveCaptionsBaseUrl, endedLiveReplay]);
|
|
4585
4646
|
function togglePlay() {
|
|
4586
4647
|
const video = videoRef.current;
|
|
4587
4648
|
if (!video) return;
|
|
@@ -4733,6 +4794,7 @@ function VideoPlayer({
|
|
|
4733
4794
|
const showControls = active && state === "ready" && (controlsVisible || !isPlaying);
|
|
4734
4795
|
const showPoster = !active && !!poster;
|
|
4735
4796
|
const currentLevelLabel = activeLevel < 0 ? t.auto : `${qualities.find((q) => q.index === activeLevel)?.height ?? ""}p`;
|
|
4797
|
+
const showQuality = showQualitySelector && qualities.length > 1;
|
|
4736
4798
|
return /* @__PURE__ */ jsxs(
|
|
4737
4799
|
"div",
|
|
4738
4800
|
{
|
|
@@ -4831,7 +4893,14 @@ function VideoPlayer({
|
|
|
4831
4893
|
] }),
|
|
4832
4894
|
typeof stats?.viewers === "number" && /* @__PURE__ */ 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}` })
|
|
4833
4895
|
] }),
|
|
4834
|
-
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsx(
|
|
4896
|
+
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsx(
|
|
4897
|
+
LiveCaptionStack,
|
|
4898
|
+
{
|
|
4899
|
+
cues: captionStackCues,
|
|
4900
|
+
latestLabel: t.captionsLatest,
|
|
4901
|
+
variant: appleMobile ? "window" : "scroll"
|
|
4902
|
+
}
|
|
4903
|
+
),
|
|
4835
4904
|
!liveCaptionsBaseUrl && !endedLiveReplay && activeCaption && captionLocale !== "off" && /* @__PURE__ */ jsx(
|
|
4836
4905
|
"div",
|
|
4837
4906
|
{
|
|
@@ -4860,7 +4929,7 @@ function VideoPlayer({
|
|
|
4860
4929
|
formatTime
|
|
4861
4930
|
}
|
|
4862
4931
|
),
|
|
4863
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4932
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1 sm:gap-2", children: [
|
|
4864
4933
|
/* @__PURE__ */ jsx(
|
|
4865
4934
|
ControlButton,
|
|
4866
4935
|
{
|
|
@@ -4878,7 +4947,7 @@ function VideoPlayer({
|
|
|
4878
4947
|
children: /* @__PURE__ */ jsx(VolumeIcon, { className: "size-5" })
|
|
4879
4948
|
}
|
|
4880
4949
|
),
|
|
4881
|
-
/* @__PURE__ */ jsx("div", { className: "w-20 px-1", children: /* @__PURE__ */ jsx(
|
|
4950
|
+
!compactChrome && /* @__PURE__ */ jsx("div", { className: "w-20 px-1", children: /* @__PURE__ */ jsx(
|
|
4882
4951
|
Slider,
|
|
4883
4952
|
{
|
|
4884
4953
|
"aria-label": "Volume",
|
|
@@ -4890,25 +4959,24 @@ function VideoPlayer({
|
|
|
4890
4959
|
}
|
|
4891
4960
|
) })
|
|
4892
4961
|
] }),
|
|
4893
|
-
mode === "vod" && /* @__PURE__ */ jsxs("span", { className: "ml-1 text-xs tabular-nums", children: [
|
|
4962
|
+
mode === "vod" && /* @__PURE__ */ jsxs("span", { className: "ml-1 shrink-0 text-xs tabular-nums", children: [
|
|
4894
4963
|
formatTime(currentTime),
|
|
4895
|
-
|
|
4896
|
-
formatTime(duration)
|
|
4964
|
+
!compactChrome && ` / ${formatTime(duration)}`
|
|
4897
4965
|
] }),
|
|
4898
4966
|
mode === "live" && behindLive && /* @__PURE__ */ jsxs(
|
|
4899
4967
|
"button",
|
|
4900
4968
|
{
|
|
4901
4969
|
type: "button",
|
|
4902
4970
|
onClick: goToLiveEdge,
|
|
4903
|
-
className: "ml-1 flex items-center gap-1 rounded bg-white/15 px-2 py-0.5 text-xs hover:bg-white/25",
|
|
4971
|
+
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",
|
|
4904
4972
|
children: [
|
|
4905
4973
|
/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
|
|
4906
4974
|
t.goLive
|
|
4907
4975
|
]
|
|
4908
4976
|
}
|
|
4909
4977
|
),
|
|
4910
|
-
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
4911
|
-
mode === "vod" && typeof stats?.views === "number" && /* @__PURE__ */ jsx("span", { className: "mr-1 text-xs", children: t.formatViews ? t.formatViews(stats.views) : `${stats.views} views` }),
|
|
4978
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1", children: [
|
|
4979
|
+
!compactChrome && mode === "vod" && typeof stats?.views === "number" && /* @__PURE__ */ jsx("span", { className: "mr-1 text-xs", children: t.formatViews ? t.formatViews(stats.views) : `${stats.views} views` }),
|
|
4912
4980
|
/* @__PURE__ */ jsxs(
|
|
4913
4981
|
MenuControl,
|
|
4914
4982
|
{
|
|
@@ -4937,7 +5005,7 @@ function VideoPlayer({
|
|
|
4937
5005
|
]
|
|
4938
5006
|
}
|
|
4939
5007
|
),
|
|
4940
|
-
mode === "vod" && /* @__PURE__ */ jsx(
|
|
5008
|
+
!compactChrome && mode === "vod" && /* @__PURE__ */ jsx(
|
|
4941
5009
|
MenuControl,
|
|
4942
5010
|
{
|
|
4943
5011
|
label: t.speed,
|
|
@@ -4961,7 +5029,7 @@ function VideoPlayer({
|
|
|
4961
5029
|
))
|
|
4962
5030
|
}
|
|
4963
5031
|
),
|
|
4964
|
-
|
|
5032
|
+
!compactChrome && showQuality && /* @__PURE__ */ jsxs(
|
|
4965
5033
|
MenuControl,
|
|
4966
5034
|
{
|
|
4967
5035
|
label: t.quality,
|
|
@@ -4993,7 +5061,7 @@ function VideoPlayer({
|
|
|
4993
5061
|
]
|
|
4994
5062
|
}
|
|
4995
5063
|
),
|
|
4996
|
-
/* @__PURE__ */ jsx(
|
|
5064
|
+
!compactChrome && /* @__PURE__ */ jsx(
|
|
4997
5065
|
ControlButton,
|
|
4998
5066
|
{
|
|
4999
5067
|
label: t.cast,
|
|
@@ -5003,12 +5071,115 @@ function VideoPlayer({
|
|
|
5003
5071
|
children: /* @__PURE__ */ jsx(Cast, { className: "size-5" })
|
|
5004
5072
|
}
|
|
5005
5073
|
),
|
|
5006
|
-
pipSupported && /* @__PURE__ */ jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsx(
|
|
5074
|
+
!compactChrome && pipSupported && /* @__PURE__ */ jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsx(
|
|
5007
5075
|
PictureInPicture2,
|
|
5008
5076
|
{
|
|
5009
5077
|
className: cn("size-5", pipActive && "text-primary")
|
|
5010
5078
|
}
|
|
5011
5079
|
) }),
|
|
5080
|
+
compactChrome && /* @__PURE__ */ jsx(
|
|
5081
|
+
MenuControl,
|
|
5082
|
+
{
|
|
5083
|
+
label: t.more,
|
|
5084
|
+
open: openMenu === "more",
|
|
5085
|
+
onOpenChange: (o) => setOpenMenu(o ? "more" : null),
|
|
5086
|
+
trigger: /* @__PURE__ */ jsx(EllipsisVertical, { className: "size-5" }),
|
|
5087
|
+
children: morePane === "speed" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5088
|
+
/* @__PURE__ */ jsx(
|
|
5089
|
+
MenuBack,
|
|
5090
|
+
{
|
|
5091
|
+
label: t.back,
|
|
5092
|
+
title: t.speed,
|
|
5093
|
+
onSelect: () => setMorePane("root")
|
|
5094
|
+
}
|
|
5095
|
+
),
|
|
5096
|
+
PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxs(
|
|
5097
|
+
MenuItem,
|
|
5098
|
+
{
|
|
5099
|
+
selected: rate === playbackRate,
|
|
5100
|
+
onSelect: () => changeRate(rate),
|
|
5101
|
+
children: [
|
|
5102
|
+
rate,
|
|
5103
|
+
"\xD7"
|
|
5104
|
+
]
|
|
5105
|
+
},
|
|
5106
|
+
rate
|
|
5107
|
+
))
|
|
5108
|
+
] }) : morePane === "quality" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5109
|
+
/* @__PURE__ */ jsx(
|
|
5110
|
+
MenuBack,
|
|
5111
|
+
{
|
|
5112
|
+
label: t.back,
|
|
5113
|
+
title: t.quality,
|
|
5114
|
+
onSelect: () => setMorePane("root")
|
|
5115
|
+
}
|
|
5116
|
+
),
|
|
5117
|
+
/* @__PURE__ */ jsx(
|
|
5118
|
+
MenuItem,
|
|
5119
|
+
{
|
|
5120
|
+
selected: activeLevel < 0,
|
|
5121
|
+
onSelect: () => chooseLevel(-1),
|
|
5122
|
+
children: t.auto
|
|
5123
|
+
}
|
|
5124
|
+
),
|
|
5125
|
+
qualities.map((q) => /* @__PURE__ */ jsxs(
|
|
5126
|
+
MenuItem,
|
|
5127
|
+
{
|
|
5128
|
+
selected: activeLevel === q.index,
|
|
5129
|
+
onSelect: () => chooseLevel(q.index),
|
|
5130
|
+
children: [
|
|
5131
|
+
q.height,
|
|
5132
|
+
"p"
|
|
5133
|
+
]
|
|
5134
|
+
},
|
|
5135
|
+
q.index
|
|
5136
|
+
))
|
|
5137
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5138
|
+
mode === "vod" && /* @__PURE__ */ jsx(
|
|
5139
|
+
MenuNavRow,
|
|
5140
|
+
{
|
|
5141
|
+
icon: /* @__PURE__ */ jsx(Gauge, { className: "size-4" }),
|
|
5142
|
+
label: t.speed,
|
|
5143
|
+
value: `${playbackRate}\xD7`,
|
|
5144
|
+
onSelect: () => setMorePane("speed")
|
|
5145
|
+
}
|
|
5146
|
+
),
|
|
5147
|
+
showQuality && /* @__PURE__ */ jsx(
|
|
5148
|
+
MenuNavRow,
|
|
5149
|
+
{
|
|
5150
|
+
icon: /* @__PURE__ */ jsx(Settings, { className: "size-4" }),
|
|
5151
|
+
label: t.quality,
|
|
5152
|
+
value: currentLevelLabel,
|
|
5153
|
+
onSelect: () => setMorePane("quality")
|
|
5154
|
+
}
|
|
5155
|
+
),
|
|
5156
|
+
(mode === "vod" || showQuality) && /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-white/15" }),
|
|
5157
|
+
/* @__PURE__ */ jsx(
|
|
5158
|
+
MenuAction,
|
|
5159
|
+
{
|
|
5160
|
+
icon: /* @__PURE__ */ jsx(Cast, { className: "size-4" }),
|
|
5161
|
+
onSelect: () => {
|
|
5162
|
+
setOpenMenu(null);
|
|
5163
|
+
void castHlsUrl(src).catch(() => void 0);
|
|
5164
|
+
},
|
|
5165
|
+
children: t.cast
|
|
5166
|
+
}
|
|
5167
|
+
),
|
|
5168
|
+
pipSupported && /* @__PURE__ */ jsx(
|
|
5169
|
+
MenuAction,
|
|
5170
|
+
{
|
|
5171
|
+
icon: /* @__PURE__ */ jsx(PictureInPicture2, { className: "size-4" }),
|
|
5172
|
+
active: pipActive,
|
|
5173
|
+
onSelect: () => {
|
|
5174
|
+
setOpenMenu(null);
|
|
5175
|
+
togglePip();
|
|
5176
|
+
},
|
|
5177
|
+
children: t.pictureInPicture
|
|
5178
|
+
}
|
|
5179
|
+
)
|
|
5180
|
+
] })
|
|
5181
|
+
}
|
|
5182
|
+
),
|
|
5012
5183
|
fullscreenSupported && /* @__PURE__ */ jsx(
|
|
5013
5184
|
ControlButton,
|
|
5014
5185
|
{
|
|
@@ -5072,7 +5243,7 @@ function MenuControl({
|
|
|
5072
5243
|
"div",
|
|
5073
5244
|
{
|
|
5074
5245
|
role: "menu",
|
|
5075
|
-
className: "absolute right-0 bottom-full z-10 mb-2 min-w-
|
|
5246
|
+
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",
|
|
5076
5247
|
children
|
|
5077
5248
|
}
|
|
5078
5249
|
)
|
|
@@ -5090,7 +5261,7 @@ function MenuItem({
|
|
|
5090
5261
|
role: "menuitemradio",
|
|
5091
5262
|
"aria-checked": selected,
|
|
5092
5263
|
onClick: onSelect,
|
|
5093
|
-
className: "flex w-full items-center justify-between gap-3 rounded px-2 py-
|
|
5264
|
+
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",
|
|
5094
5265
|
children: [
|
|
5095
5266
|
children,
|
|
5096
5267
|
selected && /* @__PURE__ */ jsx(Check, { className: "size-4" })
|
|
@@ -5098,6 +5269,72 @@ function MenuItem({
|
|
|
5098
5269
|
}
|
|
5099
5270
|
);
|
|
5100
5271
|
}
|
|
5272
|
+
function MenuNavRow({
|
|
5273
|
+
icon,
|
|
5274
|
+
label,
|
|
5275
|
+
value,
|
|
5276
|
+
onSelect
|
|
5277
|
+
}) {
|
|
5278
|
+
return /* @__PURE__ */ jsxs(
|
|
5279
|
+
"button",
|
|
5280
|
+
{
|
|
5281
|
+
type: "button",
|
|
5282
|
+
role: "menuitem",
|
|
5283
|
+
"aria-label": `${label}, ${value}`,
|
|
5284
|
+
onClick: onSelect,
|
|
5285
|
+
className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5286
|
+
children: [
|
|
5287
|
+
/* @__PURE__ */ jsx("span", { className: "text-white/70", children: icon }),
|
|
5288
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: label }),
|
|
5289
|
+
/* @__PURE__ */ jsx("span", { className: "text-white/50", children: value }),
|
|
5290
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "size-4 text-white/50" })
|
|
5291
|
+
]
|
|
5292
|
+
}
|
|
5293
|
+
);
|
|
5294
|
+
}
|
|
5295
|
+
function MenuBack({
|
|
5296
|
+
label,
|
|
5297
|
+
title,
|
|
5298
|
+
onSelect
|
|
5299
|
+
}) {
|
|
5300
|
+
return /* @__PURE__ */ jsxs(
|
|
5301
|
+
"button",
|
|
5302
|
+
{
|
|
5303
|
+
type: "button",
|
|
5304
|
+
role: "menuitem",
|
|
5305
|
+
"aria-label": label,
|
|
5306
|
+
onClick: onSelect,
|
|
5307
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5308
|
+
children: [
|
|
5309
|
+
/* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
|
|
5310
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: title })
|
|
5311
|
+
]
|
|
5312
|
+
}
|
|
5313
|
+
);
|
|
5314
|
+
}
|
|
5315
|
+
function MenuAction({
|
|
5316
|
+
onSelect,
|
|
5317
|
+
icon,
|
|
5318
|
+
active,
|
|
5319
|
+
children
|
|
5320
|
+
}) {
|
|
5321
|
+
return /* @__PURE__ */ jsxs(
|
|
5322
|
+
"button",
|
|
5323
|
+
{
|
|
5324
|
+
type: "button",
|
|
5325
|
+
role: "menuitem",
|
|
5326
|
+
onClick: onSelect,
|
|
5327
|
+
className: cn(
|
|
5328
|
+
"flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
|
|
5329
|
+
active && "text-primary"
|
|
5330
|
+
),
|
|
5331
|
+
children: [
|
|
5332
|
+
icon ? /* @__PURE__ */ jsx("span", { className: cn("text-white/70", active && "text-primary"), children: icon }) : null,
|
|
5333
|
+
children
|
|
5334
|
+
]
|
|
5335
|
+
}
|
|
5336
|
+
);
|
|
5337
|
+
}
|
|
5101
5338
|
|
|
5102
5339
|
// src/components/video/feedPlaybackCoordinator.ts
|
|
5103
5340
|
var players = /* @__PURE__ */ new Map();
|