mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Always set pause feature on Music Assistant mediaplayers (#141686)
This commit is contained in:
parent
3e0eb5ab2c
commit
405cbd6a00
@ -94,6 +94,12 @@ SUPPORTED_FEATURES_BASE = (
|
||||
| MediaPlayerEntityFeature.MEDIA_ENQUEUE
|
||||
| MediaPlayerEntityFeature.MEDIA_ANNOUNCE
|
||||
| MediaPlayerEntityFeature.SEEK
|
||||
# we always add pause support,
|
||||
# regardless if the underlying player actually natively supports pause
|
||||
# because the MA behavior is to internally handle pause with stop
|
||||
# (and a resume position) and we'd like to keep the UX consistent
|
||||
# background info: https://github.com/home-assistant/core/issues/140118
|
||||
| MediaPlayerEntityFeature.PAUSE
|
||||
)
|
||||
|
||||
QUEUE_OPTION_MAP = {
|
||||
@ -697,8 +703,6 @@ class MusicAssistantPlayer(MusicAssistantEntity, MediaPlayerEntity):
|
||||
supported_features = SUPPORTED_FEATURES_BASE
|
||||
if PlayerFeature.SET_MEMBERS in self.player.supported_features:
|
||||
supported_features |= MediaPlayerEntityFeature.GROUPING
|
||||
if PlayerFeature.PAUSE in self.player.supported_features:
|
||||
supported_features |= MediaPlayerEntityFeature.PAUSE
|
||||
if self.player.mute_control != PLAYER_CONTROL_NONE:
|
||||
supported_features |= MediaPlayerEntityFeature.VOLUME_MUTE
|
||||
if self.player.volume_control != PLAYER_CONTROL_NONE:
|
||||
|
@ -694,19 +694,6 @@ async def test_media_player_supported_features(
|
||||
assert state
|
||||
assert state.attributes["supported_features"] == expected_features
|
||||
|
||||
# remove pause capability from player, trigger subscription callback
|
||||
# and check if the supported features got updated
|
||||
music_assistant_client.players._players[mass_player_id].supported_features.remove(
|
||||
PlayerFeature.PAUSE
|
||||
)
|
||||
await trigger_subscription_callback(
|
||||
hass, music_assistant_client, EventType.PLAYER_CONFIG_UPDATED, mass_player_id
|
||||
)
|
||||
expected_features &= ~MediaPlayerEntityFeature.PAUSE
|
||||
state = hass.states.get(entity_id)
|
||||
assert state
|
||||
assert state.attributes["supported_features"] == expected_features
|
||||
|
||||
# remove grouping capability from player, trigger subscription callback
|
||||
# and check if the supported features got updated
|
||||
music_assistant_client.players._players[mass_player_id].supported_features.remove(
|
||||
|
Loading…
x
Reference in New Issue
Block a user