From 788b4bcbd29cbdad9afa8f5e1cc5bb57fa40f831 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 8 Sep 2024 16:15:33 +0300 Subject: [PATCH] wip --- providers/PlaybackProvider.tsx | 22 ++++++++++++++-------- types/syncplay.ts | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/providers/PlaybackProvider.tsx b/providers/PlaybackProvider.tsx index c9765948..22fa41c5 100644 --- a/providers/PlaybackProvider.tsx +++ b/providers/PlaybackProvider.tsx @@ -343,6 +343,12 @@ export const PlaybackProvider: React.FC<{ children: ReactNode }> = ({ // TODO: ?? } else if (json.MessageType === "ForceKeepAlive") { // TODO: ?? + } else if (json.MessageType === "SyncPlayCommand") { + console.log("SyncPlayCommand ~", command); + if (command === "Stop") { + console.log("Command ~ Stop"); + stopPlayback(); + } } else if (json.MessageType === "SyncPlayGroupUpdate") { if (!api) return; @@ -379,14 +385,14 @@ export const PlaybackProvider: React.FC<{ children: ReactNode }> = ({ pauseVideo(); } - // getSyncPlayApi(api).syncPlayReady({ - // readyRequestDto: { - // IsPlaying: data.IsPlaying, - // PositionTicks: data.StartPositionTicks, - // PlaylistItemId: currentlyPlaying?.item.Id, - // When: new Date().toISOString(), - // }, - // }); + getSyncPlayApi(api).syncPlayReady({ + readyRequestDto: { + IsPlaying: data.IsPlaying, + PositionTicks: data.StartPositionTicks, + PlaylistItemId: currentlyPlaying?.item.Id, + When: new Date().toISOString(), + }, + }); return; } diff --git a/types/syncplay.ts b/types/syncplay.ts index 21227819..54c9b11e 100644 --- a/types/syncplay.ts +++ b/types/syncplay.ts @@ -32,8 +32,8 @@ export type SyncPlayCommandData = { }; export type StateUpdateData = { + State: "Waiting" | "Playing" | "Paused"; Reason: "Pause" | "Unpause"; - State: "Waiting" | "Playing"; }; export type GroupJoinedData = {