feat: cross-platform titlebar, video transfers and client cleanup
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
Adds frameless-window controls for Windows/Linux (native traffic lights on macOS), keeps transfers at the current position for video, lets the video player use the same sync/device controls as the media bar, and removes dead code plus assorted UI/perf issues.
This commit is contained in:
1 parent
4bdd0139bf
commit
6675a55957
26 files changed
+561
-316
No files matched your search
@@ -84,6 +84,7 @@ const PlaybackSync = () => {
|
||||
|
||||
const tick = async () => {
|
||||
if (busy || cancelled) return;
|
||||
if (document.visibilityState !== "visible") return;
|
||||
busy = true;
|
||||
try {
|
||||
const sessions = (await sessionApi.getSessions()).data;
|
||||
|
||||
@@ -98,7 +98,11 @@ const AudioPlayer = () => {
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!api && !!user?.Id,
|
||||
refetchInterval: 3000,
|
||||
// Do not keep polling the server while the window is hidden.
|
||||
refetchInterval: () =>
|
||||
document.visibilityState === "visible" ? 3000 : false,
|
||||
refetchIntervalInBackground: false,
|
||||
staleTime: 1500,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -188,11 +192,13 @@ const AudioPlayer = () => {
|
||||
// Layout hooks (home hero rail) reserve space for the bar. Use explicit
|
||||
// visibility rather than the DOM: during the exit animation the element is
|
||||
// still mounted but already off-screen.
|
||||
const isFullPlayer =
|
||||
location.pathname === "/player" || location.pathname === "/player/audio";
|
||||
useEffect(() => {
|
||||
const visible = barVisible && location.pathname !== "/player/audio";
|
||||
const visible = barVisible && !isFullPlayer;
|
||||
document.body.classList.toggle("has-player-bar", visible);
|
||||
return () => document.body.classList.remove("has-player-bar");
|
||||
}, [barVisible, location.pathname]);
|
||||
}, [barVisible, isFullPlayer]);
|
||||
|
||||
// Sync local audio element.
|
||||
useEffect(() => {
|
||||
@@ -523,7 +529,7 @@ const AudioPlayer = () => {
|
||||
});
|
||||
};
|
||||
|
||||
if (!barVisible || location.pathname === "/player/audio") {
|
||||
if (!barVisible || isFullPlayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import { IconButton, Slider, Typography } from "@mui/material";
|
||||
import { IconButton, Slider, Tooltip, Typography } from "@mui/material";
|
||||
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, {
|
||||
@@ -18,6 +18,7 @@ import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider";
|
||||
import { secToTicks } from "@/utils/date/time";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { usePlaybackStore } from "@/utils/store/playback";
|
||||
import useSyncPlayback from "@/utils/store/syncPlayback";
|
||||
import CaptionsButton from "./buttons/CaptionsButton";
|
||||
import ChaptersListButton from "./buttons/ChaptersListButton";
|
||||
import ForwardButton from "./buttons/ForwardButton";
|
||||
@@ -54,6 +55,18 @@ const VideoPlayerControls = ({
|
||||
const playerOSDRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const api = useApiInContext((state) => state.api);
|
||||
const syncEnabled = useSyncPlayback((state) => state.enabled);
|
||||
const syncMaster = useSyncPlayback((state) => state.master);
|
||||
const startSync = useSyncPlayback((state) => state.start);
|
||||
const stopSync = useSyncPlayback((state) => state.stop);
|
||||
const syncThisVideo = syncEnabled && syncMaster?.sessionId === null;
|
||||
const toggleSync = () => {
|
||||
if (syncThisVideo) {
|
||||
stopSync();
|
||||
return;
|
||||
}
|
||||
if (itemId) startSync({ itemId, sessionId: null });
|
||||
};
|
||||
const {
|
||||
mediaSourceId,
|
||||
itemId,
|
||||
@@ -120,7 +133,9 @@ const VideoPlayerControls = ({
|
||||
};
|
||||
}, [increaseVolumeByStep, decreaseVolumeByStep]);
|
||||
|
||||
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout | null>(null);
|
||||
const [clickTimeout, setClickTimeout] = useState<ReturnType<
|
||||
typeof setTimeout
|
||||
> | null>(null);
|
||||
const [showVolumeControl, setShowVolumeControl] = useState(false);
|
||||
|
||||
const [settingsMenuRef, setSettingsMenuRef] =
|
||||
@@ -319,6 +334,21 @@ const VideoPlayerControls = ({
|
||||
startIndex: useQueue.getState().currentItemIndex,
|
||||
})}
|
||||
/>
|
||||
<Tooltip
|
||||
title={syncThisVideo ? "Stop device sync" : "Sync playback"}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="Sync playback"
|
||||
onClick={toggleSync}
|
||||
sx={
|
||||
syncThisVideo
|
||||
? { color: "var(--mui-palette-primary-main)" }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">sync</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<QueueButton />
|
||||
|
||||
<ChaptersListButton />
|
||||
|
||||
Reference in new issue
Block a user