feat: localize UI and improve playback
Continuous Integration / build_web (push) Failing after 1s
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 1s
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
- translate the interface into Russian - add picture-in-picture and video fit modes - derive skip segments from Jellyfin chapter markers - align player navigation and add a window drag region - keep audio playback alive across routes
This commit is contained in:
1 parent
5784036eb1
commit
d9bce4de04
100 files changed
+1364
-706
No files matched your search
@@ -47,9 +47,9 @@ export const Route = createFileRoute("/_api/player/audio")({
|
||||
});
|
||||
|
||||
const repeatLabels: Record<RepeatMode, string> = {
|
||||
off: "Repeat off",
|
||||
all: "Repeat all",
|
||||
one: "Repeat one",
|
||||
off: "Повтор выкл.",
|
||||
all: "Повтор всех",
|
||||
one: "Повтор одного",
|
||||
};
|
||||
|
||||
/** Artists (linked) and album (linked) for the current track. */
|
||||
@@ -186,7 +186,7 @@ function AudioPlayerRoute() {
|
||||
<section className="audio-now-playing" key={item?.Id}>
|
||||
<div className="audio-now-playing-art">
|
||||
{imageUrl ? (
|
||||
<img alt={item?.Name ?? "Album art"} src={imageUrl} />
|
||||
<img alt={item?.Name ?? "Обложка"} src={imageUrl} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">music_note</span>
|
||||
)}
|
||||
@@ -234,12 +234,12 @@ function AudioPlayerRoute() {
|
||||
/>
|
||||
|
||||
<div className="audio-now-playing-transport">
|
||||
<Tooltip title="Shuffle upcoming">
|
||||
<Tooltip title="Перемешать следующие">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={shuffleUpcoming}
|
||||
disabled={!hasUpcoming}
|
||||
aria-label="Shuffle upcoming"
|
||||
aria-label="Перемешать следующие"
|
||||
>
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
@@ -274,7 +274,7 @@ function AudioPlayerRoute() {
|
||||
</div>
|
||||
<IconButton
|
||||
onClick={(e) => setMenuAnchor(e.currentTarget)}
|
||||
aria-label="More options"
|
||||
aria-label="Ещё"
|
||||
>
|
||||
<span className="material-symbols-rounded">more_horiz</span>
|
||||
</IconButton>
|
||||
@@ -300,7 +300,7 @@ function AudioPlayerRoute() {
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">album</span>
|
||||
</ListItemIcon>
|
||||
Go to album
|
||||
Перейти к альбому
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
disabled={!artistId}
|
||||
@@ -317,7 +317,7 @@ function AudioPlayerRoute() {
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">person</span>
|
||||
</ListItemIcon>
|
||||
Go to artist
|
||||
Перейти к исполнителю
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
@@ -328,7 +328,7 @@ function AudioPlayerRoute() {
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">query_stats</span>
|
||||
</ListItemIcon>
|
||||
Stats for nerds
|
||||
Статистика
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</div>
|
||||
@@ -336,7 +336,7 @@ function AudioPlayerRoute() {
|
||||
|
||||
<aside
|
||||
className={`audio-side ${hasLyrics ? "has-lyrics" : ""}`}
|
||||
aria-label="Lyrics and queue"
|
||||
aria-label="Текст и очередь"
|
||||
>
|
||||
{hasLyrics && (
|
||||
<div className="audio-side-lyrics">
|
||||
@@ -360,7 +360,7 @@ function AudioPlayerRoute() {
|
||||
maxWidth="sm"
|
||||
fullWidth
|
||||
>
|
||||
<DialogTitle>Stats for nerds</DialogTitle>
|
||||
<DialogTitle>Статистика</DialogTitle>
|
||||
<DialogContent>
|
||||
<StatsPanel item={item} audioRef={audioPlayerRef} />
|
||||
</DialogContent>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import React, { useCallback, useEffect, useRef } from "react";
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import ReactPlayer from "react-player";
|
||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import { playItemFromQueue, usePlaybackStore } from "@/utils/store/playback";
|
||||
@@ -27,7 +27,12 @@ import StatsForNerds from "@/components/playback/videoPlayer/StatsForNerds";
|
||||
import UpNextFlyout from "@/components/playback/videoPlayer/upNextFlyout";
|
||||
import VolumeChangeOverlay from "@/components/playback/videoPlayer/VolumeChangeOverlay";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { getAutoSkipSegments } from "@/utils/storage/player";
|
||||
import {
|
||||
getAutoSkipSegments,
|
||||
getVideoFitMode,
|
||||
setVideoFitMode,
|
||||
} from "@/utils/storage/player";
|
||||
import type { VideoFitMode } from "@/utils/types/videoFitMode";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import {
|
||||
@@ -71,7 +76,7 @@ function addSubtitleTrackToReactPlayer(
|
||||
track.src = `${baseUrl}${subtitleTracks.url}${urlParams}`;
|
||||
track.kind = "subtitles";
|
||||
track.srclang = reqSubTrack.Language ?? "en";
|
||||
track.label = reqSubTrack.DisplayTitle ?? "Subtitle";
|
||||
track.label = reqSubTrack.DisplayTitle ?? "Субтитры";
|
||||
track.default = true;
|
||||
track.id = subtitleTracks.url;
|
||||
|
||||
@@ -184,8 +189,31 @@ export function VideoPlayer() {
|
||||
]);
|
||||
|
||||
const [error, setError] = React.useState<any>(null);
|
||||
const [fitMode, setFitMode] = useState<VideoFitMode>("fit");
|
||||
const autoSkippedSegmentRef = useRef<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
getVideoFitMode().then(setFitMode);
|
||||
}, []);
|
||||
|
||||
const handleFitModeChange = useCallback((mode: VideoFitMode) => {
|
||||
setFitMode(mode);
|
||||
void setVideoFitMode(mode);
|
||||
}, []);
|
||||
|
||||
const cycleFitMode = useCallback(() => {
|
||||
setFitMode((current) => {
|
||||
const next =
|
||||
current === "fit"
|
||||
? "fill"
|
||||
: current === "fill"
|
||||
? "stretch"
|
||||
: "fit";
|
||||
void setVideoFitMode(next);
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
|
||||
// Deep links, transfers and resume all set a start position. Do not rely
|
||||
// on a single `onReady` callback (HLS wrappers can fire it late or reset
|
||||
// the media afterwards), keep enforcing it until the player settles.
|
||||
@@ -537,6 +565,10 @@ export function VideoPlayer() {
|
||||
case "m":
|
||||
toggleIsPlayerMuted();
|
||||
break;
|
||||
case "Z":
|
||||
case "z":
|
||||
cycleFitMode();
|
||||
break;
|
||||
case "F7":
|
||||
playItemFromQueue("previous", user?.Id, api);
|
||||
break;
|
||||
@@ -547,7 +579,7 @@ export function VideoPlayer() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}, [cycleFitMode]);
|
||||
|
||||
useEffect(() => {
|
||||
// attach the event listener
|
||||
@@ -732,10 +764,11 @@ export function VideoPlayer() {
|
||||
|
||||
return (
|
||||
<div
|
||||
className="video-player"
|
||||
className={`video-player video-fit-${fitMode}`}
|
||||
onMouseMove={handleMouseMove}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
>
|
||||
<div className="video-player-drag-region" data-tauri-drag-region />
|
||||
<LoadingIndicator />
|
||||
<ErrorDisplay
|
||||
error={error}
|
||||
@@ -755,6 +788,8 @@ export function VideoPlayer() {
|
||||
// isVisible={areControlsVisible}
|
||||
onHover={handleMouseMove}
|
||||
onLeave={handleMouseLeave}
|
||||
fitMode={fitMode}
|
||||
onFitModeChange={handleFitModeChange}
|
||||
/>
|
||||
<SkipSegmentButton />
|
||||
<VolumeChangeOverlay />
|
||||
|
||||
@@ -63,7 +63,7 @@ function PhotosPlayer() {
|
||||
height: "100%",
|
||||
borderRadius: "2px",
|
||||
}}
|
||||
alt="Item"
|
||||
alt="Изображение"
|
||||
/>
|
||||
</div>
|
||||
)),
|
||||
@@ -108,7 +108,7 @@ function PhotosPlayer() {
|
||||
`${api?.basePath}/Items/${currentPhoto?.Id}/Download?ApiKey=${api?.accessToken}`,
|
||||
pathToSave,
|
||||
);
|
||||
enqueueSnackbar("Image download queued.", { variant: "info" });
|
||||
enqueueSnackbar("Загрузка изображения добавлена в очередь.", { variant: "info" });
|
||||
}
|
||||
}, [currentIndex]);
|
||||
|
||||
@@ -125,7 +125,7 @@ function PhotosPlayer() {
|
||||
? `${api?.basePath}/Items/${currentPhoto.Id}/Download?ApiKey=${api?.accessToken}`
|
||||
: brokenImage
|
||||
}
|
||||
alt="Item"
|
||||
alt="Изображение"
|
||||
transition={{ duration: 0.1 }}
|
||||
className="photos-currentPhoto"
|
||||
/>
|
||||
@@ -152,7 +152,7 @@ function PhotosPlayer() {
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">download</span>
|
||||
</ListItemIcon>
|
||||
<ListItemText>Download</ListItemText>
|
||||
<ListItemText>Скачать</ListItemText>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<div className="photos-overlay">
|
||||
|
||||
Reference in new issue
Block a user