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; }