fix(playback): stop local video after transferring it away
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
Report playback stopped before clearing the local video state, so the old Blink session does not linger as playing after a transfer.
This commit is contained in:
1 parent
67c69208c4
commit
5b4efd20c0
2 files changed
+23
-6
No files matched your search
@@ -27,11 +27,11 @@ const CastButton = ({
|
||||
size={size}
|
||||
aria-label={item ? "Play on another device" : "Remote control"}
|
||||
onClick={() =>
|
||||
openDialog({
|
||||
...(getTransfer ? getTransfer() : transfer),
|
||||
item: item ?? null,
|
||||
})
|
||||
}
|
||||
openDialog({
|
||||
...(getTransfer ? getTransfer() : transfer),
|
||||
item: item ?? null,
|
||||
})
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">cast</span>
|
||||
</IconButton>
|
||||
|
||||
@@ -102,7 +102,7 @@ const RemoteControlDialog = () => {
|
||||
mediaSourceId: item.MediaSources?.[0]?.Id ?? undefined,
|
||||
});
|
||||
},
|
||||
onSuccess: (_data, session) => {
|
||||
onSuccess: async (_data, session) => {
|
||||
enqueueSnackbar(
|
||||
transfer?.kind === "audio" || transfer?.kind === "video"
|
||||
? `Playback transferred to ${sessionLabel(session)}`
|
||||
@@ -112,6 +112,23 @@ const RemoteControlDialog = () => {
|
||||
if (transfer?.kind === "audio") {
|
||||
stopPlayback();
|
||||
} else if (transfer?.kind === "video") {
|
||||
const playback = usePlaybackStore.getState();
|
||||
const transferredItemId = playback.metadata.item?.Id;
|
||||
if (api && transferredItemId) {
|
||||
try {
|
||||
await getSessionApi(api).reportPlaybackStopped({
|
||||
playbackStopInfo: {
|
||||
Failed: false,
|
||||
ItemId: transferredItemId,
|
||||
MediaSourceId: playback.mediaSource.id,
|
||||
PlaySessionId: playback.playsessionId,
|
||||
PositionTicks: playback.playerState.currentTime,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("Could not report the transferred video as stopped", error);
|
||||
}
|
||||
}
|
||||
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
||||
clearQueue();
|
||||
navigate({ to: "/home" });
|
||||
|
||||
Reference in new issue
Block a user