From 5784036eb1eba4d61f9c5b3d8e7897b8b0f91fc6 Mon Sep 17 00:00:00 2001 From: 1xDed Date: Sun, 29 Nov 2026 08:47:13 +0300 Subject: [PATCH] fix(realtime): report playback stopped after a remote Stop A remote Stop paused and reset the local player but left the server session showing a stale NowPlayingItem. Report PlaybackStopped with the last item, source, play session and position. --- src/components/realtime/index.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/components/realtime/index.tsx b/src/components/realtime/index.tsx index 0ef27cf..581c6f8 100644 --- a/src/components/realtime/index.tsx +++ b/src/components/realtime/index.tsx @@ -110,11 +110,33 @@ const RealtimeBridge = () => { } if (command === PlaystateCommand.Stop) { const local = getLocalPlayback(); + const playback = usePlaybackStore.getState(); + const stoppedItemId = playback.metadata.item?.Id; + const stoppedMediaSourceId = playback.mediaSource.id; + const stoppedPlaySessionId = playback.playsessionId; stopLocalPlayback(); if (local.kind === "video") { usePlaybackStore.setState(usePlaybackStore.getInitialState()); clearQueue(); navigate({ to: "/home" }); + if (stoppedItemId) { + getSessionApi(api) + .reportPlaybackStopped({ + playbackStopInfo: { + Failed: false, + ItemId: stoppedItemId, + MediaSourceId: stoppedMediaSourceId, + PlaySessionId: stoppedPlaySessionId, + PositionTicks: local.positionTicks, + }, + }) + .catch((error) => { + console.warn( + "Could not report the remotely stopped playback", + error, + ); + }); + } } return; }