feat: add cross-device playback and remote control
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
- native SyncPlay groups with shared queues, ready/buffering and local pause/seek reporting - follow-me prompt that transfers another session's playback to this device - auto-skip intros/recaps and skip-credits for final items - blink:// deep links with timestamped scene sharing via QR - Quick Connect approval and QR onboarding from a phone - Rust WebSocket client with Authorization header for Jellyfin 12, capabilities advertising, live sessions and remote commands
This commit is contained in:
1 parent
cb5ee9b672
commit
5746bf35a5
39 files changed
+3235
-18
No files matched your search
@@ -3,6 +3,7 @@ import { AnimatePresence, motion } from "motion/react";
|
||||
import React from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { usePlaybackStore } from "@/utils/store/playback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
|
||||
const SkipSegmentButton = () => {
|
||||
const {
|
||||
@@ -25,11 +26,16 @@ const SkipSegmentButton = () => {
|
||||
})),
|
||||
);
|
||||
|
||||
const hasNextItem = useQueue((state) =>
|
||||
Boolean(state.tracks?.[state.currentItemIndex + 1]),
|
||||
);
|
||||
const segmentType = mediaSegments?.Items?.[currentSegmentIndex]?.Type;
|
||||
const shouldShow =
|
||||
mediaSegments?.Items?.length &&
|
||||
currentSegmentIndex >= 0 &&
|
||||
activeSegmentId &&
|
||||
mediaSegments?.Items?.[currentSegmentIndex].Type !== "Outro";
|
||||
(segmentType !== "Outro" || !hasNextItem);
|
||||
const label = segmentType === "Outro" ? "Skip credits" : `Skip ${segmentType}`;
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
@@ -81,7 +87,7 @@ const SkipSegmentButton = () => {
|
||||
},
|
||||
}}
|
||||
>
|
||||
Skip {mediaSegments?.Items?.[currentSegmentIndex].Type}
|
||||
{label}
|
||||
</Button>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
@@ -15,8 +15,11 @@ import PlayNextButton from "@/components/buttons/playNextButton";
|
||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueButton from "@/components/buttons/queueButton";
|
||||
import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider";
|
||||
import { secToTicks } from "@/utils/date/time";
|
||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import { buildPlayDeepLink } from "@/utils/deepLinks";
|
||||
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useShareStore } from "@/utils/store/share";
|
||||
import { usePlaybackStore } from "@/utils/store/playback";
|
||||
import useSyncPlayback from "@/utils/store/syncPlayback";
|
||||
import CaptionsButton from "./buttons/CaptionsButton";
|
||||
@@ -87,6 +90,7 @@ const VideoPlayerControls = ({
|
||||
decreaseVolumeByStep,
|
||||
getCurrentTime,
|
||||
isUserHovering,
|
||||
currentTime,
|
||||
} = usePlaybackStore(
|
||||
useShallow((state) => ({
|
||||
mediaSourceId: state.mediaSource.id,
|
||||
@@ -110,6 +114,7 @@ const VideoPlayerControls = ({
|
||||
decreaseVolumeByStep: state.decreaseVolumeByStep,
|
||||
getCurrentTime: state.getCurrentTime,
|
||||
isUserHovering: state.playerState.isUserHovering,
|
||||
currentTime: state.playerState.currentTime,
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -232,6 +237,30 @@ const VideoPlayerControls = ({
|
||||
>
|
||||
<span className="material-symbols-rounded">arrow_back</span>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
useShareStore
|
||||
.getState()
|
||||
.openShareDialog(
|
||||
buildPlayDeepLink(
|
||||
itemId ?? "",
|
||||
currentTime > 0 ? ticksToSec(currentTime) : getCurrentTime(),
|
||||
),
|
||||
"Share this scene",
|
||||
)
|
||||
}
|
||||
aria-label="Share scene"
|
||||
title="Share scene"
|
||||
>
|
||||
<span className="material-symbols-rounded">share</span>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={openSyncPlayDialog}
|
||||
aria-label="Watch together"
|
||||
title="Watch together"
|
||||
>
|
||||
<span className="material-symbols-rounded">groups</span>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={(e) => setSettingsMenuRef(e.currentTarget)}
|
||||
aria-label="Player settings"
|
||||
|
||||
@@ -10,10 +10,16 @@ import { toNumber } from "lodash";
|
||||
import React, {
|
||||
type ChangeEventHandler,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
useTransition,
|
||||
} from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import {
|
||||
getAutoSkipSegments,
|
||||
setAutoSkipSegments,
|
||||
} from "@/utils/storage/player";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import {
|
||||
changeAudioTrack,
|
||||
@@ -67,6 +73,25 @@ const VideoPlayerSettingsMenu = ({
|
||||
if (itemId) startSync({ itemId, sessionId: null });
|
||||
};
|
||||
|
||||
const [autoSkip, setAutoSkip] = useState(false);
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
getAutoSkipSegments().then((enabled) => {
|
||||
if (!cancelled) setAutoSkip(enabled);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
const toggleAutoSkip = () => {
|
||||
setAutoSkip((enabled) => {
|
||||
const next = !enabled;
|
||||
setAutoSkipSegments(next);
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const [subtitleIsChanging, startSubtitleChange] = useTransition();
|
||||
const handleSubtitleChange: ChangeEventHandler<
|
||||
HTMLInputElement | HTMLTextAreaElement
|
||||
@@ -188,6 +213,20 @@ const VideoPlayerSettingsMenu = ({
|
||||
onChange={toggleSync}
|
||||
/>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={toggleAutoSkip}>
|
||||
<Typography
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
}}
|
||||
>
|
||||
Auto-skip intro & recap
|
||||
</Typography>
|
||||
<Switch
|
||||
checked={autoSkip}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
onChange={toggleAutoSkip}
|
||||
/>
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Popover>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user