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,21 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type QuickConnectApprovalState = {
|
||||
open: boolean;
|
||||
code: string;
|
||||
openQuickConnectApproval: (code?: string) => void;
|
||||
closeQuickConnectApproval: () => void;
|
||||
setCode: (code: string) => void;
|
||||
};
|
||||
|
||||
export const useQuickConnectApprovalStore = create<QuickConnectApprovalState>(
|
||||
(set) => ({
|
||||
open: false,
|
||||
code: "",
|
||||
openQuickConnectApproval: (code = "") => set({ open: true, code }),
|
||||
closeQuickConnectApproval: () => set({ open: false, code: "" }),
|
||||
setCode: (code) => set({ code }),
|
||||
}),
|
||||
);
|
||||
|
||||
export default useQuickConnectApprovalStore;
|
||||
@@ -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;
|
||||
@@ -0,0 +1,19 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type ShareState = {
|
||||
open: boolean;
|
||||
link: string;
|
||||
title: string;
|
||||
openShareDialog: (link: string, title?: string) => void;
|
||||
closeShareDialog: () => void;
|
||||
};
|
||||
|
||||
export const useShareStore = create<ShareState>((set) => ({
|
||||
open: false,
|
||||
link: "",
|
||||
title: "",
|
||||
openShareDialog: (link, title = "Share") => set({ open: true, link, title }),
|
||||
closeShareDialog: () => set({ open: false, link: "", title: "" }),
|
||||
}));
|
||||
|
||||
export default useShareStore;
|
||||
@@ -0,0 +1,52 @@
|
||||
import type {
|
||||
GroupInfoDto,
|
||||
PlayQueueUpdate,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { create } from "zustand";
|
||||
|
||||
type SyncPlayState = {
|
||||
open: boolean;
|
||||
group: GroupInfoDto | null;
|
||||
groups: GroupInfoDto[];
|
||||
queue: PlayQueueUpdate | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
/** Navigation requested by a remote group start. */
|
||||
pendingNavigation: "video" | "audio" | null;
|
||||
setOpen: (open: boolean) => void;
|
||||
setGroup: (group: GroupInfoDto | null) => void;
|
||||
setGroups: (groups: GroupInfoDto[]) => void;
|
||||
setQueue: (queue: PlayQueueUpdate | null) => void;
|
||||
setLoading: (loading: boolean) => void;
|
||||
setError: (error: string | null) => void;
|
||||
setPendingNavigation: (kind: "video" | "audio" | null) => void;
|
||||
reset: () => void;
|
||||
};
|
||||
|
||||
const initialState = {
|
||||
open: false,
|
||||
group: null as GroupInfoDto | null,
|
||||
groups: [] as GroupInfoDto[],
|
||||
queue: null as PlayQueueUpdate | null,
|
||||
loading: false,
|
||||
error: null as string | null,
|
||||
pendingNavigation: null as "video" | "audio" | null,
|
||||
};
|
||||
|
||||
export const useSyncPlayStore = create<SyncPlayState>((set) => ({
|
||||
...initialState,
|
||||
setOpen: (open) => set({ open }),
|
||||
setGroup: (group) => set({ group }),
|
||||
setGroups: (groups) => set({ groups }),
|
||||
setQueue: (queue) => set({ queue }),
|
||||
setLoading: (loading) => set({ loading }),
|
||||
setError: (error) => set({ error }),
|
||||
setPendingNavigation: (pendingNavigation) => set({ pendingNavigation }),
|
||||
reset: () =>
|
||||
set((state) => ({
|
||||
...initialState,
|
||||
open: state.open,
|
||||
})),
|
||||
}));
|
||||
|
||||
export default useSyncPlayStore;
|
||||
Reference in new issue
Block a user