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
@@ -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 />
|
||||
|
||||
Reference in new issue
Block a user