feat(playback): keep transfer position and sync devices
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

Transfers now start the current item first in the queue and send a corrective Seek for clients that ignore StartPositionTicks. Adds a Sync playback mode that keeps other sessions playing the same item aligned with the active device.
This commit is contained in:
1xDed committed 2026-11-28 00:31:03 +03:00
1 parent df392eb647
commit 4bdd0139bf
8 files changed
+461 -19

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { create } from "zustand";
export type SyncMaster = {
/** Item that all devices should be playing together. */
itemId: string;
/** Remote session acting as the clock; null means this device. */
sessionId: string | null;
};
type SyncPlaybackState = {
enabled: boolean;
master: SyncMaster | null;
start: (master: SyncMaster) => void;
stop: () => void;
};
/**
* Approximate multi-device sync: the master position is periodically pushed
* to every other controllable session playing the same item.
*/
const useSyncPlayback = create<SyncPlaybackState>((set) => ({
enabled: false,
master: null,
start: (master) => set({ enabled: true, master }),
stop: () => set({ enabled: false, master: null }),
}));
export default useSyncPlayback;