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
@@ -0,0 +1,48 @@
|
||||
import type {
|
||||
GroupUpdate,
|
||||
SendCommand,
|
||||
SessionInfoDto,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { create } from "zustand";
|
||||
|
||||
type Timed<T> = {
|
||||
value: T;
|
||||
at: number;
|
||||
};
|
||||
|
||||
type RealtimeState = {
|
||||
/** Latest session snapshot pushed by the server. */
|
||||
sessions: SessionInfoDto[];
|
||||
connected: boolean;
|
||||
lastMessageAt: number;
|
||||
lastGroupUpdate: Timed<GroupUpdate> | null;
|
||||
lastSyncCommand: Timed<SendCommand> | null;
|
||||
setConnected: (connected: boolean) => void;
|
||||
setSessions: (sessions: SessionInfoDto[]) => void;
|
||||
markMessage: () => void;
|
||||
setGroupUpdate: (update: GroupUpdate) => void;
|
||||
setSyncCommand: (command: SendCommand) => void;
|
||||
reset: () => void;
|
||||
};
|
||||
|
||||
const initialState = {
|
||||
sessions: [] as SessionInfoDto[],
|
||||
connected: false,
|
||||
lastMessageAt: 0,
|
||||
lastGroupUpdate: null as Timed<GroupUpdate> | null,
|
||||
lastSyncCommand: null as Timed<SendCommand> | null,
|
||||
};
|
||||
|
||||
export const useRealtimeStore = create<RealtimeState>((set) => ({
|
||||
...initialState,
|
||||
setConnected: (connected) => set({ connected }),
|
||||
setSessions: (sessions) => set({ sessions, lastMessageAt: Date.now() }),
|
||||
markMessage: () => set({ lastMessageAt: Date.now() }),
|
||||
setGroupUpdate: (value) =>
|
||||
set({ lastGroupUpdate: { value, at: Date.now() } }),
|
||||
setSyncCommand: (value) =>
|
||||
set({ lastSyncCommand: { value, at: Date.now() } }),
|
||||
reset: () => set(initialState),
|
||||
}));
|
||||
|
||||
export default useRealtimeStore;
|
||||
Reference in new issue
Block a user