Disable Spotify controls when no active session (#96914)

This commit is contained in:
Joost Lekkerkerker
2023-07-23 10:59:29 +02:00
committed by GitHub
parent d4cdb0453f
commit 2365e4c159

View File

@@ -139,11 +139,11 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
@property @property
def supported_features(self) -> MediaPlayerEntityFeature: def supported_features(self) -> MediaPlayerEntityFeature:
"""Return the supported features.""" """Return the supported features."""
if self._restricted_device: if self.data.current_user["product"] != "premium":
return MediaPlayerEntityFeature(0)
if self._restricted_device or not self._currently_playing:
return MediaPlayerEntityFeature.SELECT_SOURCE return MediaPlayerEntityFeature.SELECT_SOURCE
if self.data.current_user["product"] == "premium": return SUPPORT_SPOTIFY
return SUPPORT_SPOTIFY
return MediaPlayerEntityFeature(0)
@property @property
def state(self) -> MediaPlayerState: def state(self) -> MediaPlayerState: