fix(realtime): report playback stopped after a remote Stop
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
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.
This commit is contained in:
1 parent
e89932fc7d
commit
5784036eb1
1 file changed
+22
@@ -110,11 +110,33 @@ const RealtimeBridge = () => {
|
|||||||
}
|
}
|
||||||
if (command === PlaystateCommand.Stop) {
|
if (command === PlaystateCommand.Stop) {
|
||||||
const local = getLocalPlayback();
|
const local = getLocalPlayback();
|
||||||
|
const playback = usePlaybackStore.getState();
|
||||||
|
const stoppedItemId = playback.metadata.item?.Id;
|
||||||
|
const stoppedMediaSourceId = playback.mediaSource.id;
|
||||||
|
const stoppedPlaySessionId = playback.playsessionId;
|
||||||
stopLocalPlayback();
|
stopLocalPlayback();
|
||||||
if (local.kind === "video") {
|
if (local.kind === "video") {
|
||||||
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
||||||
clearQueue();
|
clearQueue();
|
||||||
navigate({ to: "/home" });
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user