Snapcast: Fixes for hard switching of group leaders (#3209)
authorMischa Siekmann <45062894+gnumpi@users.noreply.github.com>
Sat, 21 Feb 2026 23:26:48 +0000 (00:26 +0100)
committerGitHub <noreply@github.com>
Sat, 21 Feb 2026 23:26:48 +0000 (00:26 +0100)
music_assistant/providers/snapcast/player.py

index a92f7f14f9173175c1e4fb961f64860a5e42f45c..893c7f573ee224d400721e45bbb8edf861e0d955 100644 (file)
@@ -201,6 +201,9 @@ class SnapCastPlayer(Player):
 
     async def stop(self) -> None:
         """Send STOP command to given player."""
+        player_group = await self.snap_provider.ensure_player_owned_group(self.player_id)
+        assert player_group is not None  # for type checking
+        await player_group.set_stream("default")
         if ma_stream := self.active_snap_ma_stream:
             ma_stream.request_stop_stream()
             return
@@ -240,6 +243,7 @@ class SnapCastPlayer(Player):
         ]
 
         curr_stream_id = player_group.stream
+        sync_group_player: Player | None = None
         if curr_ma_stream := self.snap_provider.get_snap_ma_stream(curr_stream_id):
             media = curr_ma_stream.media
             if media.media_type == MediaType.PLUGIN_SOURCE: