@geekapps/silo-elements-nextjs 0.1.20 → 0.1.22
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/VideoPlayer.js +200 -118
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +200 -118
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useMultipartUpload, useBatchUpload, useSignedUrl, useFileStatus } from
|
|
|
3
3
|
export { SiloProvider, useBatchUpload, useFileStatus, useMultipartUpload, useSignedUrl, useSiloClient } from '@geekapps/silo-nextjs';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import gsap from 'gsap';
|
|
6
|
-
import { Play, Pause, FastForward, VolumeX, Volume2,
|
|
6
|
+
import { Play, Rewind, Pause, FastForward, VolumeX, Volume2, Settings, Minimize, Maximize } from 'lucide-react';
|
|
7
7
|
|
|
8
8
|
// src/ImageUploader.tsx
|
|
9
9
|
|
|
@@ -1208,6 +1208,7 @@ var AUTO_QUALITY = {
|
|
|
1208
1208
|
label: "Auto",
|
|
1209
1209
|
type: "auto"
|
|
1210
1210
|
};
|
|
1211
|
+
var PLAYBACK_SPEEDS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
1211
1212
|
function Sources(_props) {
|
|
1212
1213
|
return null;
|
|
1213
1214
|
}
|
|
@@ -1258,7 +1259,9 @@ function Video({
|
|
|
1258
1259
|
const [selectedQuality, setSelectedQuality] = useState("auto");
|
|
1259
1260
|
const [audioTracks, setAudioTracks] = useState([]);
|
|
1260
1261
|
const [selectedAudio, setSelectedAudio] = useState(0);
|
|
1261
|
-
const [
|
|
1262
|
+
const [settingsOpen, setSettingsOpen] = useState(false);
|
|
1263
|
+
const [settingsTab, setSettingsTab] = useState("quality");
|
|
1264
|
+
const [playbackRate, setPlaybackRate] = useState(1);
|
|
1262
1265
|
const [subtitleMode, setSubtitleMode] = useState(initialSubtitleMode);
|
|
1263
1266
|
const [activeCue, setActiveCue] = useState(null);
|
|
1264
1267
|
const [storyboardCues, setStoryboardCues] = useState(
|
|
@@ -1270,6 +1273,8 @@ function Video({
|
|
|
1270
1273
|
const [bufferedTime, setBufferedTime] = useState(0);
|
|
1271
1274
|
const [isPlaying, setIsPlaying] = useState(false);
|
|
1272
1275
|
const [hasPlayed, setHasPlayed] = useState(false);
|
|
1276
|
+
const [clickIcon, setClickIcon] = useState(null);
|
|
1277
|
+
const clickIconTimerRef = useRef(null);
|
|
1273
1278
|
const [isLoading, setIsLoading] = useState(true);
|
|
1274
1279
|
const [controlsVisible, setControlsVisible] = useState(true);
|
|
1275
1280
|
const [volume, setVolume] = useState(defaultVolume);
|
|
@@ -1293,6 +1298,7 @@ function Video({
|
|
|
1293
1298
|
const video = videoRef.current;
|
|
1294
1299
|
if (!video) return;
|
|
1295
1300
|
Array.from(video.textTracks).forEach((track) => {
|
|
1301
|
+
if (track.kind === "metadata") return;
|
|
1296
1302
|
track.mode = mode !== "off" && track.language === mode ? "hidden" : "disabled";
|
|
1297
1303
|
});
|
|
1298
1304
|
if (mode === "off") setActiveCue(null);
|
|
@@ -1395,6 +1401,11 @@ function Video({
|
|
|
1395
1401
|
applySubtitleMode(subtitleMode);
|
|
1396
1402
|
if (subtitleMode === "off") setActiveCue(null);
|
|
1397
1403
|
}, [subtitleMode, applySubtitleMode]);
|
|
1404
|
+
useEffect(() => {
|
|
1405
|
+
const video = videoRef.current;
|
|
1406
|
+
if (!video) return;
|
|
1407
|
+
video.playbackRate = playbackRate;
|
|
1408
|
+
}, [playbackRate]);
|
|
1398
1409
|
const subtitleModeRef = useRef(subtitleMode);
|
|
1399
1410
|
useEffect(() => {
|
|
1400
1411
|
subtitleModeRef.current = subtitleMode;
|
|
@@ -1408,7 +1419,7 @@ function Video({
|
|
|
1408
1419
|
setActiveCue(null);
|
|
1409
1420
|
return;
|
|
1410
1421
|
}
|
|
1411
|
-
const track = Array.from(video.textTracks).find((t) => t.language === mode);
|
|
1422
|
+
const track = Array.from(video.textTracks).find((t) => t.language === mode && t.kind !== "metadata");
|
|
1412
1423
|
if (!track || !track.activeCues || track.activeCues.length === 0) {
|
|
1413
1424
|
setActiveCue(null);
|
|
1414
1425
|
return;
|
|
@@ -1418,6 +1429,7 @@ function Video({
|
|
|
1418
1429
|
};
|
|
1419
1430
|
const bindTracks = () => {
|
|
1420
1431
|
Array.from(video.textTracks).forEach((t) => {
|
|
1432
|
+
if (t.kind === "metadata") return;
|
|
1421
1433
|
t.removeEventListener("cuechange", onCueChange);
|
|
1422
1434
|
t.addEventListener("cuechange", onCueChange);
|
|
1423
1435
|
});
|
|
@@ -1430,12 +1442,22 @@ function Video({
|
|
|
1430
1442
|
};
|
|
1431
1443
|
}, []);
|
|
1432
1444
|
useEffect(() => {
|
|
1445
|
+
const video = videoRef.current;
|
|
1433
1446
|
const onFullscreenChange = () => {
|
|
1434
|
-
|
|
1447
|
+
const doc = document;
|
|
1448
|
+
const nativeFullscreen = Boolean(document.fullscreenElement || doc.webkitFullscreenElement);
|
|
1449
|
+
const iosVideoFullscreen = Boolean(video?.webkitDisplayingFullscreen);
|
|
1450
|
+
setIsFullscreen(nativeFullscreen || iosVideoFullscreen);
|
|
1435
1451
|
};
|
|
1436
1452
|
document.addEventListener("fullscreenchange", onFullscreenChange);
|
|
1453
|
+
document.addEventListener("webkitfullscreenchange", onFullscreenChange);
|
|
1454
|
+
video?.addEventListener("webkitbeginfullscreen", onFullscreenChange);
|
|
1455
|
+
video?.addEventListener("webkitendfullscreen", onFullscreenChange);
|
|
1437
1456
|
return () => {
|
|
1438
1457
|
document.removeEventListener("fullscreenchange", onFullscreenChange);
|
|
1458
|
+
document.removeEventListener("webkitfullscreenchange", onFullscreenChange);
|
|
1459
|
+
video?.removeEventListener("webkitbeginfullscreen", onFullscreenChange);
|
|
1460
|
+
video?.removeEventListener("webkitendfullscreen", onFullscreenChange);
|
|
1439
1461
|
};
|
|
1440
1462
|
}, []);
|
|
1441
1463
|
useEffect(() => {
|
|
@@ -1501,7 +1523,7 @@ function Video({
|
|
|
1501
1523
|
setQualities([AUTO_QUALITY]);
|
|
1502
1524
|
setAudioTracks([]);
|
|
1503
1525
|
setSelectedAudio(0);
|
|
1504
|
-
|
|
1526
|
+
setSettingsOpen(false);
|
|
1505
1527
|
video.pause();
|
|
1506
1528
|
video.removeAttribute("src");
|
|
1507
1529
|
video.load();
|
|
@@ -1643,11 +1665,15 @@ function Video({
|
|
|
1643
1665
|
const video = videoRef.current;
|
|
1644
1666
|
if (!video) return;
|
|
1645
1667
|
try {
|
|
1646
|
-
|
|
1668
|
+
const wasPaused = video.paused;
|
|
1669
|
+
if (wasPaused) {
|
|
1647
1670
|
await video.play();
|
|
1648
1671
|
} else {
|
|
1649
1672
|
video.pause();
|
|
1650
1673
|
}
|
|
1674
|
+
if (clickIconTimerRef.current) window.clearTimeout(clickIconTimerRef.current);
|
|
1675
|
+
setClickIcon(wasPaused ? "play" : "pause");
|
|
1676
|
+
clickIconTimerRef.current = window.setTimeout(() => setClickIcon(null), 600);
|
|
1651
1677
|
} catch {
|
|
1652
1678
|
setError("O navegador bloqueou a reprodu\xE7\xE3o autom\xE1tica.");
|
|
1653
1679
|
}
|
|
@@ -1662,20 +1688,51 @@ function Video({
|
|
|
1662
1688
|
}, []);
|
|
1663
1689
|
const toggleFullscreen = useCallback(async () => {
|
|
1664
1690
|
const player = playerRef.current;
|
|
1665
|
-
|
|
1691
|
+
const video = videoRef.current;
|
|
1692
|
+
const doc = document;
|
|
1693
|
+
if (!player && !video) return;
|
|
1666
1694
|
try {
|
|
1667
|
-
|
|
1695
|
+
const nativeFullscreen = Boolean(document.fullscreenElement || doc.webkitFullscreenElement);
|
|
1696
|
+
const iosVideoFullscreen = Boolean(video?.webkitDisplayingFullscreen);
|
|
1697
|
+
if (nativeFullscreen || iosVideoFullscreen) {
|
|
1698
|
+
if (document.fullscreenElement && document.exitFullscreen) {
|
|
1699
|
+
await document.exitFullscreen();
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
if (doc.webkitExitFullscreen) {
|
|
1703
|
+
await doc.webkitExitFullscreen();
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
if (video?.webkitExitFullscreen) {
|
|
1707
|
+
video.webkitExitFullscreen();
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (player?.requestFullscreen) {
|
|
1668
1713
|
await player.requestFullscreen();
|
|
1669
|
-
|
|
1670
|
-
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
if (player?.webkitRequestFullscreen) {
|
|
1717
|
+
await player.webkitRequestFullscreen();
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
if (video?.webkitEnterFullscreen) {
|
|
1721
|
+
video.webkitEnterFullscreen();
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
if (video?.requestFullscreen) {
|
|
1725
|
+
await video.requestFullscreen();
|
|
1726
|
+
return;
|
|
1671
1727
|
}
|
|
1728
|
+
throw new Error("Fullscreen unavailable");
|
|
1672
1729
|
} catch {
|
|
1673
1730
|
setError("N\xE3o foi poss\xEDvel alterar o modo fullscreen.");
|
|
1674
1731
|
}
|
|
1675
1732
|
}, []);
|
|
1676
1733
|
const changeAudio = useCallback((trackId) => {
|
|
1677
1734
|
setSelectedAudio(trackId);
|
|
1678
|
-
|
|
1735
|
+
setSettingsOpen(false);
|
|
1679
1736
|
if (hlsRef.current) {
|
|
1680
1737
|
hlsRef.current.audioTrack = trackId;
|
|
1681
1738
|
}
|
|
@@ -1685,7 +1742,7 @@ function Video({
|
|
|
1685
1742
|
const option = qualities.find((quality) => quality.id === qualityId);
|
|
1686
1743
|
if (!option) return;
|
|
1687
1744
|
setSelectedQuality(qualityId);
|
|
1688
|
-
|
|
1745
|
+
setSettingsOpen(false);
|
|
1689
1746
|
if (option.type === "auto") {
|
|
1690
1747
|
if (hlsRef.current) {
|
|
1691
1748
|
hlsRef.current.currentLevel = -1;
|
|
@@ -1815,7 +1872,7 @@ function Video({
|
|
|
1815
1872
|
className: "relative w-full overflow-hidden rounded-[14px] bg-black shadow-[0_30px_90px_rgba(15,15,15,0.22)] outline-none ring-1 ring-black/5",
|
|
1816
1873
|
style: maxHeight ? { maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight, aspectRatio: "16/9" } : { aspectRatio: "16/9" },
|
|
1817
1874
|
children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ jsxs(
|
|
1819
1876
|
"video",
|
|
1820
1877
|
{
|
|
1821
1878
|
ref: videoRef,
|
|
@@ -1823,17 +1880,27 @@ function Video({
|
|
|
1823
1880
|
playsInline: true,
|
|
1824
1881
|
preload: "metadata",
|
|
1825
1882
|
crossOrigin: "anonymous",
|
|
1826
|
-
children:
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1883
|
+
children: [
|
|
1884
|
+
parsed.subtitles.map((subtitle) => /* @__PURE__ */ jsx(
|
|
1885
|
+
"track",
|
|
1886
|
+
{
|
|
1887
|
+
kind: "subtitles",
|
|
1888
|
+
src: subtitle.src,
|
|
1889
|
+
srcLang: subtitle.srclang,
|
|
1890
|
+
label: subtitle.label,
|
|
1891
|
+
default: subtitle.default
|
|
1892
|
+
},
|
|
1893
|
+
`${activeSource.src}-${subtitle.srclang}`
|
|
1894
|
+
)),
|
|
1895
|
+
parsed.storyboard?.src && /* @__PURE__ */ jsx(
|
|
1896
|
+
"track",
|
|
1897
|
+
{
|
|
1898
|
+
kind: "metadata",
|
|
1899
|
+
label: "thumbnails",
|
|
1900
|
+
src: parsed.storyboard.src
|
|
1901
|
+
}
|
|
1902
|
+
)
|
|
1903
|
+
]
|
|
1837
1904
|
}
|
|
1838
1905
|
),
|
|
1839
1906
|
poster && !hasPlayed && /* @__PURE__ */ jsx(
|
|
@@ -1841,7 +1908,7 @@ function Video({
|
|
|
1841
1908
|
{
|
|
1842
1909
|
src: poster,
|
|
1843
1910
|
"aria-hidden": true,
|
|
1844
|
-
className: "pointer-events-none absolute inset-0 h-full w-full object-
|
|
1911
|
+
className: "pointer-events-none absolute inset-0 h-full w-full object-contain bg-black"
|
|
1845
1912
|
}
|
|
1846
1913
|
),
|
|
1847
1914
|
/* @__PURE__ */ jsx(
|
|
@@ -1879,6 +1946,81 @@ function Video({
|
|
|
1879
1946
|
)
|
|
1880
1947
|
] }),
|
|
1881
1948
|
/* @__PURE__ */ jsxs("footer", { onClick: (e) => e.stopPropagation(), className: "relative z-10 px-3 pb-3 text-white @sm:px-5 @sm:pb-5 @lg:px-9 @lg:pb-8", children: [
|
|
1949
|
+
settingsOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1950
|
+
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-40", onClick: () => setSettingsOpen(false) }),
|
|
1951
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-full left-0 right-0 z-50 mb-2 mx-0 overflow-hidden rounded-xl border border-white/10 bg-black/90 shadow-2xl backdrop-blur-xl", children: [
|
|
1952
|
+
/* @__PURE__ */ jsx("div", { className: "flex border-b border-white/10", children: ["quality", "subtitles", ...audioTracks.length > 1 ? ["audio"] : [], "playback"].map((tab) => /* @__PURE__ */ jsx(
|
|
1953
|
+
"button",
|
|
1954
|
+
{
|
|
1955
|
+
type: "button",
|
|
1956
|
+
onClick: () => setSettingsTab(tab),
|
|
1957
|
+
className: `flex-1 px-3 py-2.5 text-xs font-semibold capitalize transition ${settingsTab === tab ? "text-white border-b-2 border-white -mb-px" : "text-white/50 hover:text-white/80"}`,
|
|
1958
|
+
children: tab
|
|
1959
|
+
},
|
|
1960
|
+
tab
|
|
1961
|
+
)) }),
|
|
1962
|
+
/* @__PURE__ */ jsxs("div", { className: "max-h-48 overflow-y-auto py-1", children: [
|
|
1963
|
+
settingsTab === "quality" && /* @__PURE__ */ jsx(Fragment, { children: [...qualities].reverse().map((quality) => /* @__PURE__ */ jsxs(
|
|
1964
|
+
SettingsItem,
|
|
1965
|
+
{
|
|
1966
|
+
active: selectedQuality === quality.id,
|
|
1967
|
+
onClick: () => changeQuality(quality.id),
|
|
1968
|
+
children: [
|
|
1969
|
+
quality.label,
|
|
1970
|
+
quality.id === "auto" && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[10px] text-white/40", children: "ABR" })
|
|
1971
|
+
]
|
|
1972
|
+
},
|
|
1973
|
+
quality.id
|
|
1974
|
+
)) }),
|
|
1975
|
+
settingsTab === "subtitles" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1976
|
+
/* @__PURE__ */ jsx(
|
|
1977
|
+
SettingsItem,
|
|
1978
|
+
{
|
|
1979
|
+
active: subtitleMode === "off",
|
|
1980
|
+
onClick: () => {
|
|
1981
|
+
setSubtitleMode("off");
|
|
1982
|
+
setSettingsOpen(false);
|
|
1983
|
+
},
|
|
1984
|
+
children: "Off"
|
|
1985
|
+
}
|
|
1986
|
+
),
|
|
1987
|
+
parsed.subtitles.map((subtitle) => /* @__PURE__ */ jsx(
|
|
1988
|
+
SettingsItem,
|
|
1989
|
+
{
|
|
1990
|
+
active: subtitleMode === subtitle.srclang,
|
|
1991
|
+
onClick: () => {
|
|
1992
|
+
setSubtitleMode(subtitle.srclang);
|
|
1993
|
+
setSettingsOpen(false);
|
|
1994
|
+
},
|
|
1995
|
+
children: subtitle.label
|
|
1996
|
+
},
|
|
1997
|
+
subtitle.srclang
|
|
1998
|
+
))
|
|
1999
|
+
] }),
|
|
2000
|
+
settingsTab === "audio" && audioTracks.length > 1 && /* @__PURE__ */ jsx(Fragment, { children: audioTracks.map((track) => /* @__PURE__ */ jsx(
|
|
2001
|
+
SettingsItem,
|
|
2002
|
+
{
|
|
2003
|
+
active: selectedAudio === track.id,
|
|
2004
|
+
onClick: () => changeAudio(track.id),
|
|
2005
|
+
children: track.label
|
|
2006
|
+
},
|
|
2007
|
+
track.id
|
|
2008
|
+
)) }),
|
|
2009
|
+
settingsTab === "playback" && /* @__PURE__ */ jsx(Fragment, { children: PLAYBACK_SPEEDS.map((speed) => /* @__PURE__ */ jsx(
|
|
2010
|
+
SettingsItem,
|
|
2011
|
+
{
|
|
2012
|
+
active: playbackRate === speed,
|
|
2013
|
+
onClick: () => {
|
|
2014
|
+
setPlaybackRate(speed);
|
|
2015
|
+
setSettingsOpen(false);
|
|
2016
|
+
},
|
|
2017
|
+
children: speed === 1 ? "Normal" : `${speed}x`
|
|
2018
|
+
},
|
|
2019
|
+
speed
|
|
2020
|
+
)) })
|
|
2021
|
+
] })
|
|
2022
|
+
] })
|
|
2023
|
+
] }),
|
|
1882
2024
|
/* @__PURE__ */ jsxs(
|
|
1883
2025
|
"div",
|
|
1884
2026
|
{
|
|
@@ -1933,6 +2075,16 @@ function Video({
|
|
|
1933
2075
|
),
|
|
1934
2076
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 @sm:gap-4 @lg:gap-5", children: [
|
|
1935
2077
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 @sm:gap-4 @lg:gap-5", children: [
|
|
2078
|
+
/* @__PURE__ */ jsx(
|
|
2079
|
+
"button",
|
|
2080
|
+
{
|
|
2081
|
+
type: "button",
|
|
2082
|
+
onClick: () => seekRelative(-10),
|
|
2083
|
+
className: "grid size-6 place-items-center text-white transition hover:scale-105 hover:text-white/80 @sm:size-8",
|
|
2084
|
+
"aria-label": "Rewind 10 seconds",
|
|
2085
|
+
children: /* @__PURE__ */ jsx(Rewind, { className: "size-5 @sm:size-7" })
|
|
2086
|
+
}
|
|
2087
|
+
),
|
|
1936
2088
|
/* @__PURE__ */ jsx(
|
|
1937
2089
|
"button",
|
|
1938
2090
|
{
|
|
@@ -1948,7 +2100,7 @@ function Video({
|
|
|
1948
2100
|
{
|
|
1949
2101
|
type: "button",
|
|
1950
2102
|
onClick: () => seekRelative(10),
|
|
1951
|
-
className: "
|
|
2103
|
+
className: "grid size-6 place-items-center text-white transition hover:scale-105 hover:text-white/80 @sm:size-8",
|
|
1952
2104
|
"aria-label": "Forward 10 seconds",
|
|
1953
2105
|
children: /* @__PURE__ */ jsx(FastForward, { className: "size-5 @sm:size-7" })
|
|
1954
2106
|
}
|
|
@@ -1988,91 +2140,19 @@ function Video({
|
|
|
1988
2140
|
}
|
|
1989
2141
|
),
|
|
1990
2142
|
/* @__PURE__ */ jsx("div", { className: "mx-0.5 hidden h-4 w-px bg-white/20 @md:mx-1 @md:block" }),
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
{
|
|
2005
|
-
active: selectedAudio === track.id,
|
|
2006
|
-
onClick: () => changeAudio(track.id),
|
|
2007
|
-
children: track.label
|
|
2008
|
-
},
|
|
2009
|
-
track.id
|
|
2010
|
-
)) })
|
|
2011
|
-
] }),
|
|
2012
|
-
parsed.subtitles.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2013
|
-
/* @__PURE__ */ jsx(
|
|
2014
|
-
"button",
|
|
2015
|
-
{
|
|
2016
|
-
type: "button",
|
|
2017
|
-
onClick: () => setOpenMenu(openMenu === "captions" ? null : "captions"),
|
|
2018
|
-
className: `grid size-6 place-items-center rounded transition hover:text-white/80 @sm:size-8 ${subtitleMode !== "off" || openMenu === "captions" ? "text-white" : "text-white/60"}`,
|
|
2019
|
-
"aria-label": "Captions",
|
|
2020
|
-
children: /* @__PURE__ */ jsx(Captions, { className: "size-4 @sm:size-5" })
|
|
2021
|
-
}
|
|
2022
|
-
),
|
|
2023
|
-
openMenu === "captions" && /* @__PURE__ */ jsxs(PopoverMenu, { onClose: () => setOpenMenu(null), children: [
|
|
2024
|
-
/* @__PURE__ */ jsx(
|
|
2025
|
-
PopoverItem,
|
|
2026
|
-
{
|
|
2027
|
-
active: subtitleMode === "off",
|
|
2028
|
-
onClick: () => {
|
|
2029
|
-
setSubtitleMode("off");
|
|
2030
|
-
setOpenMenu(null);
|
|
2031
|
-
},
|
|
2032
|
-
children: "Off"
|
|
2033
|
-
}
|
|
2034
|
-
),
|
|
2035
|
-
parsed.subtitles.map((subtitle) => /* @__PURE__ */ jsx(
|
|
2036
|
-
PopoverItem,
|
|
2037
|
-
{
|
|
2038
|
-
active: subtitleMode === subtitle.srclang,
|
|
2039
|
-
onClick: () => {
|
|
2040
|
-
setSubtitleMode(subtitle.srclang);
|
|
2041
|
-
setOpenMenu(null);
|
|
2042
|
-
},
|
|
2043
|
-
children: subtitle.label
|
|
2044
|
-
},
|
|
2045
|
-
subtitle.srclang
|
|
2046
|
-
))
|
|
2047
|
-
] })
|
|
2048
|
-
] }),
|
|
2049
|
-
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2050
|
-
/* @__PURE__ */ jsxs(
|
|
2051
|
-
"button",
|
|
2052
|
-
{
|
|
2053
|
-
type: "button",
|
|
2054
|
-
onClick: () => setOpenMenu(openMenu === "quality" ? null : "quality"),
|
|
2055
|
-
className: `flex h-6 items-center gap-1 rounded px-1.5 text-xs font-semibold transition hover:text-white/80 @sm:h-8 @sm:px-2 ${openMenu === "quality" ? "text-white" : "text-white/60"}`,
|
|
2056
|
-
"aria-label": "Quality",
|
|
2057
|
-
children: [
|
|
2058
|
-
/* @__PURE__ */ jsx(Settings, { className: "size-3.5 @sm:size-4" }),
|
|
2059
|
-
/* @__PURE__ */ jsx("span", { className: "hidden @sm:inline", children: qualities.find((q) => q.id === selectedQuality)?.label ?? "Auto" })
|
|
2060
|
-
]
|
|
2061
|
-
}
|
|
2062
|
-
),
|
|
2063
|
-
openMenu === "quality" && /* @__PURE__ */ jsx(PopoverMenu, { onClose: () => setOpenMenu(null), children: [...qualities].reverse().map((quality) => /* @__PURE__ */ jsxs(
|
|
2064
|
-
PopoverItem,
|
|
2065
|
-
{
|
|
2066
|
-
active: selectedQuality === quality.id,
|
|
2067
|
-
onClick: () => changeQuality(quality.id),
|
|
2068
|
-
children: [
|
|
2069
|
-
quality.label,
|
|
2070
|
-
quality.id === "auto" && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[10px] text-white/40", children: "ABR" })
|
|
2071
|
-
]
|
|
2072
|
-
},
|
|
2073
|
-
quality.id
|
|
2074
|
-
)) })
|
|
2075
|
-
] }),
|
|
2143
|
+
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsxs(
|
|
2144
|
+
"button",
|
|
2145
|
+
{
|
|
2146
|
+
type: "button",
|
|
2147
|
+
onClick: () => setSettingsOpen((v) => !v),
|
|
2148
|
+
className: `flex h-6 items-center gap-1 rounded px-1.5 text-xs font-semibold transition hover:text-white/80 @sm:h-8 @sm:px-2 ${settingsOpen ? "text-white" : "text-white/60"}`,
|
|
2149
|
+
"aria-label": "Settings",
|
|
2150
|
+
children: [
|
|
2151
|
+
/* @__PURE__ */ jsx(Settings, { className: "size-3.5 @sm:size-4" }),
|
|
2152
|
+
/* @__PURE__ */ jsx("span", { className: "hidden @sm:inline", children: qualities.find((q) => q.id === selectedQuality)?.label ?? "Auto" })
|
|
2153
|
+
]
|
|
2154
|
+
}
|
|
2155
|
+
) }),
|
|
2076
2156
|
/* @__PURE__ */ jsx(
|
|
2077
2157
|
"button",
|
|
2078
2158
|
{
|
|
@@ -2089,6 +2169,14 @@ function Video({
|
|
|
2089
2169
|
]
|
|
2090
2170
|
}
|
|
2091
2171
|
),
|
|
2172
|
+
/* @__PURE__ */ jsx(
|
|
2173
|
+
"div",
|
|
2174
|
+
{
|
|
2175
|
+
className: "pointer-events-none absolute inset-0 z-50 grid place-items-center",
|
|
2176
|
+
style: { opacity: clickIcon ? 1 : 0, transition: clickIcon ? "opacity 0.08s ease-in" : "opacity 0.45s ease-out" },
|
|
2177
|
+
children: /* @__PURE__ */ jsx("span", { className: "grid size-14 place-items-center rounded-full bg-black/40 text-white backdrop-blur-sm ring-1 ring-white/20 @sm:size-18 @lg:size-22", children: clickIcon === "pause" ? /* @__PURE__ */ jsx(Pause, { className: "size-6 @sm:size-8 @lg:size-10" }) : /* @__PURE__ */ jsx(Play, { className: "ml-1 size-6 @sm:size-8 @lg:size-10" }) })
|
|
2178
|
+
}
|
|
2179
|
+
),
|
|
2092
2180
|
activeCue && /* @__PURE__ */ jsx(
|
|
2093
2181
|
"div",
|
|
2094
2182
|
{
|
|
@@ -2110,13 +2198,7 @@ function Video({
|
|
|
2110
2198
|
);
|
|
2111
2199
|
}
|
|
2112
2200
|
var VideoPlayer = Video;
|
|
2113
|
-
function
|
|
2114
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2115
|
-
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-40", onClick: onClose }),
|
|
2116
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-full right-0 z-50 mb-2 min-w-35 overflow-hidden rounded-xl border border-white/10 bg-black/85 py-1 shadow-2xl backdrop-blur-xl", children })
|
|
2117
|
-
] });
|
|
2118
|
-
}
|
|
2119
|
-
function PopoverItem({
|
|
2201
|
+
function SettingsItem({
|
|
2120
2202
|
children,
|
|
2121
2203
|
active,
|
|
2122
2204
|
onClick
|