@livo-tv/blocks 1.17.0 → 1.18.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 +168 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +169 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -748,6 +748,8 @@ 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;
|
|
751
753
|
quality?: string;
|
|
752
754
|
auto?: string;
|
|
753
755
|
speed?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -748,6 +748,8 @@ 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;
|
|
751
753
|
quality?: string;
|
|
752
754
|
auto?: string;
|
|
753
755
|
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, EllipsisVertical, Minimize, Maximize, 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,7 @@ var DEFAULT_LABELS3 = {
|
|
|
4237
4266
|
pictureInPicture: "Picture in picture",
|
|
4238
4267
|
cast: "Cast",
|
|
4239
4268
|
settings: "Settings",
|
|
4269
|
+
more: "More",
|
|
4240
4270
|
quality: "Quality",
|
|
4241
4271
|
auto: "Auto",
|
|
4242
4272
|
speed: "Speed",
|
|
@@ -4262,6 +4292,7 @@ var PLAYBACK_RATES = [0.75, 1, 1.25, 1.5, 2];
|
|
|
4262
4292
|
var CONTROLS_HIDE_MS = 3e3;
|
|
4263
4293
|
var LIVE_EDGE_THRESHOLD_S = 8;
|
|
4264
4294
|
var SEEK_STEP_S = 5;
|
|
4295
|
+
var COMPACT_CHROME_PX = 640;
|
|
4265
4296
|
var VIDEO_MEDIA_STYLE = `
|
|
4266
4297
|
.livo-video-player-media::-webkit-media-controls-start-playback-button {
|
|
4267
4298
|
display: none !important;
|
|
@@ -4364,6 +4395,7 @@ function VideoPlayer({
|
|
|
4364
4395
|
const [controlsVisible, setControlsVisible] = React9.useState(true);
|
|
4365
4396
|
const [playbackRate, setPlaybackRate] = React9.useState(1);
|
|
4366
4397
|
const [openMenu, setOpenMenu] = React9.useState(null);
|
|
4398
|
+
const [compactChrome, setCompactChrome] = React9.useState(false);
|
|
4367
4399
|
const [captionLocale, setCaptionLocale] = React9.useState(defaultCaptionLocale ?? "off");
|
|
4368
4400
|
const [captionCues, setCaptionCues] = React9.useState([]);
|
|
4369
4401
|
const [liveCaptionCues, setLiveCaptionCues] = React9.useState([]);
|
|
@@ -4372,8 +4404,24 @@ function VideoPlayer({
|
|
|
4372
4404
|
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React9.useState(false);
|
|
4373
4405
|
const [embedded, setEmbedded] = React9.useState(false);
|
|
4374
4406
|
const [cssFullscreen, setCssFullscreen] = React9.useState(false);
|
|
4407
|
+
const [appleMobile, setAppleMobile] = React9.useState(false);
|
|
4375
4408
|
const hideTimerRef = React9.useRef(null);
|
|
4376
4409
|
cssFullscreenRef.current = cssFullscreen;
|
|
4410
|
+
React9.useEffect(() => {
|
|
4411
|
+
const el = containerRef.current;
|
|
4412
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4413
|
+
const apply = (width) => {
|
|
4414
|
+
if (width <= 0) return;
|
|
4415
|
+
setCompactChrome(width < COMPACT_CHROME_PX);
|
|
4416
|
+
};
|
|
4417
|
+
apply(el.clientWidth);
|
|
4418
|
+
const observer = new ResizeObserver((entries) => {
|
|
4419
|
+
const width = entries[0]?.contentRect.width;
|
|
4420
|
+
if (typeof width === "number") apply(width);
|
|
4421
|
+
});
|
|
4422
|
+
observer.observe(el);
|
|
4423
|
+
return () => observer.disconnect();
|
|
4424
|
+
}, [active]);
|
|
4377
4425
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
4378
4426
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
|
|
4379
4427
|
React9.useEffect(() => {
|
|
@@ -4429,6 +4477,7 @@ function VideoPlayer({
|
|
|
4429
4477
|
}, [paused, videoRef, isPlaying]);
|
|
4430
4478
|
React9.useEffect(() => {
|
|
4431
4479
|
setEmbedded(isEmbeddedWindow());
|
|
4480
|
+
setAppleMobile(isAppleMobileDevice());
|
|
4432
4481
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
4433
4482
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
4434
4483
|
videoRef.current?.setAttribute("webkit-playsinline", "");
|
|
@@ -4548,6 +4597,7 @@ function VideoPlayer({
|
|
|
4548
4597
|
const liveDueCues = liveCaptionsBaseUrl ? coalesceLiveCaptionCues(
|
|
4549
4598
|
liveCuesDue(liveCaptionCues, Date.now(), liveLagMs)
|
|
4550
4599
|
) : endedLiveReplay ? coalesceLiveCaptionCues(vttCuesDueAt(captionCues, currentTime)) : [];
|
|
4600
|
+
const captionStackCues = appleMobile ? lastLiveCaptionWindow(liveDueCues) : liveDueCues;
|
|
4551
4601
|
const activeCaption = liveCaptionsBaseUrl || endedLiveReplay ? null : captionAtTime(captionCues, currentTime);
|
|
4552
4602
|
React9.useEffect(() => {
|
|
4553
4603
|
const video = videoRef.current;
|
|
@@ -4580,8 +4630,12 @@ function VideoPlayer({
|
|
|
4580
4630
|
const track = nativeTrackRef.current;
|
|
4581
4631
|
if (!video || !track) return;
|
|
4582
4632
|
if (!(liveCaptionsBaseUrl || endedLiveReplay)) return;
|
|
4583
|
-
syncNativeCaptionCue(
|
|
4584
|
-
|
|
4633
|
+
syncNativeCaptionCue(
|
|
4634
|
+
video,
|
|
4635
|
+
track,
|
|
4636
|
+
lastCaptionLines(joinCaptionTexts(captionStackCues))
|
|
4637
|
+
);
|
|
4638
|
+
}, [captionStackCues, liveCaptionsBaseUrl, endedLiveReplay]);
|
|
4585
4639
|
function togglePlay() {
|
|
4586
4640
|
const video = videoRef.current;
|
|
4587
4641
|
if (!video) return;
|
|
@@ -4733,6 +4787,7 @@ function VideoPlayer({
|
|
|
4733
4787
|
const showControls = active && state === "ready" && (controlsVisible || !isPlaying);
|
|
4734
4788
|
const showPoster = !active && !!poster;
|
|
4735
4789
|
const currentLevelLabel = activeLevel < 0 ? t.auto : `${qualities.find((q) => q.index === activeLevel)?.height ?? ""}p`;
|
|
4790
|
+
const showQuality = showQualitySelector && qualities.length > 1;
|
|
4736
4791
|
return /* @__PURE__ */ jsxs(
|
|
4737
4792
|
"div",
|
|
4738
4793
|
{
|
|
@@ -4831,7 +4886,14 @@ function VideoPlayer({
|
|
|
4831
4886
|
] }),
|
|
4832
4887
|
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
4888
|
] }),
|
|
4834
|
-
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsx(
|
|
4889
|
+
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsx(
|
|
4890
|
+
LiveCaptionStack,
|
|
4891
|
+
{
|
|
4892
|
+
cues: captionStackCues,
|
|
4893
|
+
latestLabel: t.captionsLatest,
|
|
4894
|
+
variant: appleMobile ? "window" : "scroll"
|
|
4895
|
+
}
|
|
4896
|
+
),
|
|
4835
4897
|
!liveCaptionsBaseUrl && !endedLiveReplay && activeCaption && captionLocale !== "off" && /* @__PURE__ */ jsx(
|
|
4836
4898
|
"div",
|
|
4837
4899
|
{
|
|
@@ -4860,7 +4922,7 @@ function VideoPlayer({
|
|
|
4860
4922
|
formatTime
|
|
4861
4923
|
}
|
|
4862
4924
|
),
|
|
4863
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4925
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1 sm:gap-2", children: [
|
|
4864
4926
|
/* @__PURE__ */ jsx(
|
|
4865
4927
|
ControlButton,
|
|
4866
4928
|
{
|
|
@@ -4878,7 +4940,7 @@ function VideoPlayer({
|
|
|
4878
4940
|
children: /* @__PURE__ */ jsx(VolumeIcon, { className: "size-5" })
|
|
4879
4941
|
}
|
|
4880
4942
|
),
|
|
4881
|
-
/* @__PURE__ */ jsx("div", { className: "w-20 px-1", children: /* @__PURE__ */ jsx(
|
|
4943
|
+
!compactChrome && /* @__PURE__ */ jsx("div", { className: "w-20 px-1", children: /* @__PURE__ */ jsx(
|
|
4882
4944
|
Slider,
|
|
4883
4945
|
{
|
|
4884
4946
|
"aria-label": "Volume",
|
|
@@ -4890,25 +4952,24 @@ function VideoPlayer({
|
|
|
4890
4952
|
}
|
|
4891
4953
|
) })
|
|
4892
4954
|
] }),
|
|
4893
|
-
mode === "vod" && /* @__PURE__ */ jsxs("span", { className: "ml-1 text-xs tabular-nums", children: [
|
|
4955
|
+
mode === "vod" && /* @__PURE__ */ jsxs("span", { className: "ml-1 shrink-0 text-xs tabular-nums", children: [
|
|
4894
4956
|
formatTime(currentTime),
|
|
4895
|
-
|
|
4896
|
-
formatTime(duration)
|
|
4957
|
+
!compactChrome && ` / ${formatTime(duration)}`
|
|
4897
4958
|
] }),
|
|
4898
4959
|
mode === "live" && behindLive && /* @__PURE__ */ jsxs(
|
|
4899
4960
|
"button",
|
|
4900
4961
|
{
|
|
4901
4962
|
type: "button",
|
|
4902
4963
|
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",
|
|
4964
|
+
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
4965
|
children: [
|
|
4905
4966
|
/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
|
|
4906
4967
|
t.goLive
|
|
4907
4968
|
]
|
|
4908
4969
|
}
|
|
4909
4970
|
),
|
|
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` }),
|
|
4971
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1", children: [
|
|
4972
|
+
!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
4973
|
/* @__PURE__ */ jsxs(
|
|
4913
4974
|
MenuControl,
|
|
4914
4975
|
{
|
|
@@ -4937,7 +4998,7 @@ function VideoPlayer({
|
|
|
4937
4998
|
]
|
|
4938
4999
|
}
|
|
4939
5000
|
),
|
|
4940
|
-
mode === "vod" && /* @__PURE__ */ jsx(
|
|
5001
|
+
!compactChrome && mode === "vod" && /* @__PURE__ */ jsx(
|
|
4941
5002
|
MenuControl,
|
|
4942
5003
|
{
|
|
4943
5004
|
label: t.speed,
|
|
@@ -4961,7 +5022,7 @@ function VideoPlayer({
|
|
|
4961
5022
|
))
|
|
4962
5023
|
}
|
|
4963
5024
|
),
|
|
4964
|
-
|
|
5025
|
+
!compactChrome && showQuality && /* @__PURE__ */ jsxs(
|
|
4965
5026
|
MenuControl,
|
|
4966
5027
|
{
|
|
4967
5028
|
label: t.quality,
|
|
@@ -4993,7 +5054,7 @@ function VideoPlayer({
|
|
|
4993
5054
|
]
|
|
4994
5055
|
}
|
|
4995
5056
|
),
|
|
4996
|
-
/* @__PURE__ */ jsx(
|
|
5057
|
+
!compactChrome && /* @__PURE__ */ jsx(
|
|
4997
5058
|
ControlButton,
|
|
4998
5059
|
{
|
|
4999
5060
|
label: t.cast,
|
|
@@ -5003,12 +5064,81 @@ function VideoPlayer({
|
|
|
5003
5064
|
children: /* @__PURE__ */ jsx(Cast, { className: "size-5" })
|
|
5004
5065
|
}
|
|
5005
5066
|
),
|
|
5006
|
-
pipSupported && /* @__PURE__ */ jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsx(
|
|
5067
|
+
!compactChrome && pipSupported && /* @__PURE__ */ jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsx(
|
|
5007
5068
|
PictureInPicture2,
|
|
5008
5069
|
{
|
|
5009
5070
|
className: cn("size-5", pipActive && "text-primary")
|
|
5010
5071
|
}
|
|
5011
5072
|
) }),
|
|
5073
|
+
compactChrome && /* @__PURE__ */ jsxs(
|
|
5074
|
+
MenuControl,
|
|
5075
|
+
{
|
|
5076
|
+
label: t.more,
|
|
5077
|
+
open: openMenu === "more",
|
|
5078
|
+
onOpenChange: (o) => setOpenMenu(o ? "more" : null),
|
|
5079
|
+
trigger: /* @__PURE__ */ jsx(EllipsisVertical, { className: "size-5" }),
|
|
5080
|
+
children: [
|
|
5081
|
+
mode === "vod" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5082
|
+
/* @__PURE__ */ jsx(MenuSection, { children: t.speed }),
|
|
5083
|
+
PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxs(
|
|
5084
|
+
MenuItem,
|
|
5085
|
+
{
|
|
5086
|
+
selected: rate === playbackRate,
|
|
5087
|
+
onSelect: () => changeRate(rate),
|
|
5088
|
+
children: [
|
|
5089
|
+
rate,
|
|
5090
|
+
"\xD7"
|
|
5091
|
+
]
|
|
5092
|
+
},
|
|
5093
|
+
rate
|
|
5094
|
+
))
|
|
5095
|
+
] }),
|
|
5096
|
+
showQuality && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5097
|
+
/* @__PURE__ */ jsx(MenuSection, { children: t.quality }),
|
|
5098
|
+
/* @__PURE__ */ jsx(
|
|
5099
|
+
MenuItem,
|
|
5100
|
+
{
|
|
5101
|
+
selected: activeLevel < 0,
|
|
5102
|
+
onSelect: () => chooseLevel(-1),
|
|
5103
|
+
children: t.auto
|
|
5104
|
+
}
|
|
5105
|
+
),
|
|
5106
|
+
qualities.map((q) => /* @__PURE__ */ jsxs(
|
|
5107
|
+
MenuItem,
|
|
5108
|
+
{
|
|
5109
|
+
selected: activeLevel === q.index,
|
|
5110
|
+
onSelect: () => chooseLevel(q.index),
|
|
5111
|
+
children: [
|
|
5112
|
+
q.height,
|
|
5113
|
+
"p"
|
|
5114
|
+
]
|
|
5115
|
+
},
|
|
5116
|
+
q.index
|
|
5117
|
+
))
|
|
5118
|
+
] }),
|
|
5119
|
+
/* @__PURE__ */ jsx(
|
|
5120
|
+
MenuAction,
|
|
5121
|
+
{
|
|
5122
|
+
onSelect: () => {
|
|
5123
|
+
setOpenMenu(null);
|
|
5124
|
+
void castHlsUrl(src).catch(() => void 0);
|
|
5125
|
+
},
|
|
5126
|
+
children: t.cast
|
|
5127
|
+
}
|
|
5128
|
+
),
|
|
5129
|
+
pipSupported && /* @__PURE__ */ jsx(
|
|
5130
|
+
MenuAction,
|
|
5131
|
+
{
|
|
5132
|
+
onSelect: () => {
|
|
5133
|
+
setOpenMenu(null);
|
|
5134
|
+
togglePip();
|
|
5135
|
+
},
|
|
5136
|
+
children: t.pictureInPicture
|
|
5137
|
+
}
|
|
5138
|
+
)
|
|
5139
|
+
]
|
|
5140
|
+
}
|
|
5141
|
+
),
|
|
5012
5142
|
fullscreenSupported && /* @__PURE__ */ jsx(
|
|
5013
5143
|
ControlButton,
|
|
5014
5144
|
{
|
|
@@ -5078,6 +5208,9 @@ function MenuControl({
|
|
|
5078
5208
|
)
|
|
5079
5209
|
] });
|
|
5080
5210
|
}
|
|
5211
|
+
function MenuSection({ children }) {
|
|
5212
|
+
return /* @__PURE__ */ jsx("div", { className: "px-2 pt-1.5 pb-0.5 text-[10px] font-semibold tracking-wide text-white/50 uppercase", children });
|
|
5213
|
+
}
|
|
5081
5214
|
function MenuItem({
|
|
5082
5215
|
selected,
|
|
5083
5216
|
onSelect,
|
|
@@ -5098,6 +5231,21 @@ function MenuItem({
|
|
|
5098
5231
|
}
|
|
5099
5232
|
);
|
|
5100
5233
|
}
|
|
5234
|
+
function MenuAction({
|
|
5235
|
+
onSelect,
|
|
5236
|
+
children
|
|
5237
|
+
}) {
|
|
5238
|
+
return /* @__PURE__ */ jsx(
|
|
5239
|
+
"button",
|
|
5240
|
+
{
|
|
5241
|
+
type: "button",
|
|
5242
|
+
role: "menuitem",
|
|
5243
|
+
onClick: onSelect,
|
|
5244
|
+
className: "flex w-full items-center rounded px-2 py-1.5 text-left text-white/90 hover:bg-white/15",
|
|
5245
|
+
children
|
|
5246
|
+
}
|
|
5247
|
+
);
|
|
5248
|
+
}
|
|
5101
5249
|
|
|
5102
5250
|
// src/components/video/feedPlaybackCoordinator.ts
|
|
5103
5251
|
var players = /* @__PURE__ */ new Map();
|