ommit
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
This commit is contained in:
1 parent
cbb750a413
commit
497b9a2fc5
42 files changed
+945
-354
No files matched your search
+153
-149
@@ -11,7 +11,12 @@ import {
|
||||
Tooltip,
|
||||
} from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute, Link, useNavigate, useRouter } from "@tanstack/react-router";
|
||||
import {
|
||||
createFileRoute,
|
||||
Link,
|
||||
useNavigate,
|
||||
useRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, {
|
||||
useEffect,
|
||||
@@ -22,9 +27,8 @@ import React, {
|
||||
} from "react";
|
||||
import CastButton from "@/components/buttons/castButton";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import LyricsPanel, {
|
||||
getLyricsQueryOptions,
|
||||
} from "@/components/playback/audioPlayer/components/LyricsPanel";
|
||||
import RatingControl from "@/components/buttons/ratingControl";
|
||||
import LyricsPanel from "@/components/playback/audioPlayer/components/LyricsPanel";
|
||||
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
|
||||
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
|
||||
import WindowControls from "@/components/windowControls";
|
||||
@@ -268,8 +272,6 @@ function AudioPlayerRoute() {
|
||||
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
|
||||
enabled: Boolean(item?.Id && api && user?.Id),
|
||||
});
|
||||
const lyrics = useQuery(getLyricsQueryOptions(item, api));
|
||||
const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0;
|
||||
|
||||
// Wall colour derived from the sleeve.
|
||||
const palette = useMemo(() => getCoverPalette(item), [item]);
|
||||
@@ -333,9 +335,7 @@ function AudioPlayerRoute() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={`music-player${panelOpen ? " has-panel" : ""}`}
|
||||
>
|
||||
<div className={`music-player${panelOpen ? " has-panel" : ""}`}>
|
||||
<AnimatePresence initial={false} mode="sync">
|
||||
<motion.div
|
||||
key={item?.Id ?? "no-item"}
|
||||
@@ -371,156 +371,153 @@ function AudioPlayerRoute() {
|
||||
|
||||
<div className="music-player-stage">
|
||||
<div className="music-player-row">
|
||||
<div className="music-player-main">
|
||||
<CoverArt
|
||||
src={imageUrl}
|
||||
alt={item?.Name ?? "Обложка"}
|
||||
/>
|
||||
<div className="music-player-main">
|
||||
<CoverArt src={imageUrl} alt={item?.Name ?? "Обложка"} />
|
||||
|
||||
<div className="music-player-meta">
|
||||
<h1 className="music-player-title">{item?.Name}</h1>
|
||||
<div className="music-player-subtitle">
|
||||
{item?.ArtistItems?.length
|
||||
? item.ArtistItems.map((artist, index) => (
|
||||
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||
{index > 0 && ", "}
|
||||
{artist.Id ? (
|
||||
<Link
|
||||
to="/music/artist/$id"
|
||||
params={{ id: artist.Id }}
|
||||
>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
) : (
|
||||
artist.Name
|
||||
)}
|
||||
</React.Fragment>
|
||||
))
|
||||
: item?.Artists?.join(", ")}
|
||||
{item?.Album && (
|
||||
<>
|
||||
{(item?.ArtistItems?.length || item?.Artists?.length) &&
|
||||
" · "}
|
||||
{item.AlbumId ? (
|
||||
<Link
|
||||
to="/music/album/$id"
|
||||
params={{ id: item.AlbumId }}
|
||||
>
|
||||
{item.Album}
|
||||
</Link>
|
||||
) : (
|
||||
item.Album
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="music-player-seek">
|
||||
<Slider
|
||||
value={Math.min(
|
||||
secToTicks(progress),
|
||||
item?.RunTimeTicks ?? 0,
|
||||
<div className="music-player-meta">
|
||||
<h1 className="music-player-title">{item?.Name}</h1>
|
||||
<div className="music-player-subtitle">
|
||||
{item?.ArtistItems?.length
|
||||
? item.ArtistItems.map((artist, index) => (
|
||||
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||
{index > 0 && ", "}
|
||||
{artist.Id ? (
|
||||
<Link
|
||||
to="/music/artist/$id"
|
||||
params={{ id: artist.Id }}
|
||||
>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
) : (
|
||||
artist.Name
|
||||
)}
|
||||
</React.Fragment>
|
||||
))
|
||||
: item?.Artists?.join(", ")}
|
||||
{item?.Album && (
|
||||
<>
|
||||
{(item?.ArtistItems?.length || item?.Artists?.length) &&
|
||||
" · "}
|
||||
{item.AlbumId ? (
|
||||
<Link
|
||||
to="/music/album/$id"
|
||||
params={{ id: item.AlbumId }}
|
||||
>
|
||||
{item.Album}
|
||||
</Link>
|
||||
) : (
|
||||
item.Album
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
step={1}
|
||||
size="small"
|
||||
aria-label="Перемотка"
|
||||
onChange={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
setProgress(ticksToSec(next));
|
||||
}}
|
||||
onChangeCommitted={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
handleSeekCommit(next);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="music-player-seek">
|
||||
<Slider
|
||||
value={Math.min(
|
||||
secToTicks(progress),
|
||||
item?.RunTimeTicks ?? 0,
|
||||
)}
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
step={1}
|
||||
size="small"
|
||||
aria-label="Перемотка"
|
||||
onChange={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
setProgress(ticksToSec(next));
|
||||
}}
|
||||
onChangeCommitted={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
handleSeekCommit(next);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AnimatePresence initial={false}>
|
||||
{panelOpen && (
|
||||
<motion.aside
|
||||
key="panel"
|
||||
className="music-player-panel"
|
||||
initial={{ x: -240, opacity: 0 }}
|
||||
animate={{ x: 0, opacity: 1 }}
|
||||
exit={{ x: -240, opacity: 0 }}
|
||||
transition={{ duration: 0.32, ease: [0.2, 0, 0, 1] }}
|
||||
>
|
||||
<div className="music-player-panel-inner">
|
||||
{panelTab === "lyrics" ? (
|
||||
<>
|
||||
<div className="music-player-panel-head">
|
||||
<span className="music-player-panel-source">
|
||||
Текст песни
|
||||
</span>
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="Закрыть"
|
||||
onClick={() => setPanelOpen(false)}
|
||||
>
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<div className="music-player-panel-body music-player-panel-lyrics">
|
||||
{hasLyrics ? (
|
||||
<AnimatePresence initial={false}>
|
||||
{panelOpen && (
|
||||
<motion.aside
|
||||
key="panel"
|
||||
className="music-player-panel"
|
||||
initial={{ x: -240, opacity: 0 }}
|
||||
animate={{ x: 0, opacity: 1 }}
|
||||
exit={{ x: -240, opacity: 0 }}
|
||||
transition={{ duration: 0.32, ease: [0.2, 0, 0, 1] }}
|
||||
>
|
||||
<div className="music-player-panel-inner">
|
||||
{panelTab === "lyrics" ? (
|
||||
<>
|
||||
<div className="music-player-panel-head">
|
||||
<span className="music-player-panel-source">
|
||||
Текст песни
|
||||
</span>
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="Закрыть"
|
||||
onClick={() => setPanelOpen(false)}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
close
|
||||
</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<div className="music-player-panel-body music-player-panel-lyrics">
|
||||
<LyricsPanel
|
||||
item={item}
|
||||
api={api}
|
||||
currentTime={progress}
|
||||
onSeek={handleSeekCommit}
|
||||
/>
|
||||
) : (
|
||||
<p className="music-player-panel-empty">
|
||||
Для этого трека нет текста.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="music-player-panel-head">
|
||||
<span className="music-player-panel-source">Очередь</span>
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="Закрыть"
|
||||
onClick={() => setPanelOpen(false)}
|
||||
>
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<div className="music-player-panel-body">
|
||||
{upcoming.length === 0 ? (
|
||||
<p className="music-player-panel-empty">
|
||||
Очередь пуста. Запустите альбом или плейлист,
|
||||
чтобы она наполнилась.
|
||||
</p>
|
||||
) : (
|
||||
<div className="music-player-queue-list">
|
||||
{upcoming.map((track, offset) => (
|
||||
<QueueRow
|
||||
key={track.Id}
|
||||
item={track}
|
||||
index={currentTrack + 1 + offset}
|
||||
isCurrent={false}
|
||||
coverUrl={coverFor(track)}
|
||||
onPlay={(index) =>
|
||||
playItemFromQueue(index, user?.Id, api)
|
||||
}
|
||||
queryKey={["queue-upcoming"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</motion.aside>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="music-player-panel-head">
|
||||
<span className="music-player-panel-source">
|
||||
Очередь
|
||||
</span>
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="Закрыть"
|
||||
onClick={() => setPanelOpen(false)}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
close
|
||||
</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<div className="music-player-panel-body">
|
||||
{upcoming.length === 0 ? (
|
||||
<p className="music-player-panel-empty">
|
||||
Очередь пуста. Запустите альбом или плейлист,
|
||||
чтобы она наполнилась.
|
||||
</p>
|
||||
) : (
|
||||
<div className="music-player-queue-list">
|
||||
{upcoming.map((track, offset) => (
|
||||
<QueueRow
|
||||
key={track.Id}
|
||||
item={track}
|
||||
index={currentTrack + 1 + offset}
|
||||
isCurrent={false}
|
||||
coverUrl={coverFor(track)}
|
||||
onPlay={(index) =>
|
||||
playItemFromQueue(index, user?.Id, api)
|
||||
}
|
||||
queryKey={["queue-upcoming"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</motion.aside>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -533,6 +530,14 @@ function AudioPlayerRoute() {
|
||||
queryKey={["item", item?.Id ?? ""]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<RatingControl
|
||||
itemId={item?.Id}
|
||||
likes={itemDetails.data?.UserData?.Likes ?? item?.UserData?.Likes}
|
||||
queryKey={["item", item?.Id ?? ""]}
|
||||
userId={user?.Id}
|
||||
itemName={item?.Name}
|
||||
compact
|
||||
/>
|
||||
{item && (
|
||||
<CastButton
|
||||
item={item}
|
||||
@@ -672,7 +677,6 @@ function AudioPlayerRoute() {
|
||||
className={
|
||||
panelOpen && panelTab === "lyrics" ? "is-active" : undefined
|
||||
}
|
||||
disabled={!hasLyrics}
|
||||
>
|
||||
<span className="material-symbols-rounded">lyrics</span>
|
||||
</IconButton>
|
||||
|
||||
@@ -88,8 +88,10 @@ function addSubtitleTrackToReactPlayer(
|
||||
const a = track.track;
|
||||
a.mode = "showing";
|
||||
});
|
||||
track.addEventListener("error", (e) => {
|
||||
console.error("Error loading subtitle track", e);
|
||||
track.addEventListener("error", () => {
|
||||
// Some servers advertise subtitle streams that cannot be delivered
|
||||
// as a text track; the video still plays and JASSUB handles image
|
||||
// subtitles separately.
|
||||
});
|
||||
|
||||
videoElem.appendChild(track);
|
||||
@@ -99,7 +101,7 @@ function addSubtitleTrackToReactPlayer(
|
||||
}
|
||||
}
|
||||
|
||||
export function VideoPlayer() {
|
||||
function VideoPlayer() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
const { history } = useRouter();
|
||||
@@ -357,8 +359,6 @@ export function VideoPlayer() {
|
||||
});
|
||||
}
|
||||
|
||||
console.log(mediaSource.subtitle);
|
||||
|
||||
registerPlayerActions({
|
||||
seekTo: (seconds: number) => {
|
||||
// A user seek wins over the pending transfer/resume target.
|
||||
@@ -639,9 +639,7 @@ export function VideoPlayer() {
|
||||
wasmUrl,
|
||||
modernWasmUrl,
|
||||
});
|
||||
jassubRenderer.ready.then(() => {
|
||||
console.log("JASSUB subtitle renderer is ready");
|
||||
});
|
||||
jassubRenderer.ready.then(() => undefined);
|
||||
} else if (
|
||||
mediaSource.subtitle.format === "subrip" ||
|
||||
mediaSource.subtitle.format === "vtt"
|
||||
|
||||
Reference in new issue
Block a user