queue.index_in_buffer = index
queue.flow_mode_stream_log = []
prefer_flow_mode = await self.mass.config.get_player_config_value(queue_id, CONF_FLOW_MODE)
+ target_player = self.mass.players.get(queue_id)
+ enqueue_supported = PlayerFeature.ENQUEUE in target_player.supported_features
queue.next_item_id_enqueued = None
# always update session id when we start a new playback session
queue.session_id = shortuuid.random(length=8)
# all attempts to find a playable item failed
raise MediaNotFoundError("No playable item found to start playback")
- flow_mode = prefer_flow_mode and queue_item.media_type not in (
+ flow_mode = (
+ prefer_flow_mode or not enqueue_supported
+ ) and queue_item.media_type not in (
# don't use flow mode for duration-less streams
MediaType.RADIO,
MediaType.PLUGIN_SOURCE,
SUPPORTED_FEATURES = {
PlayerFeature.PAUSE,
- PlayerFeature.NEXT_PREVIOUS,
PlayerFeature.SEEK,
PlayerFeature.SELECT_SOURCE,
- PlayerFeature.SELECT_SOURCE,
- PlayerFeature.ENQUEUE,
PlayerFeature.SET_MEMBERS,
PlayerFeature.GAPLESS_PLAYBACK,
PlayerFeature.GAPLESS_DIFFERENT_SAMPLERATE,
_supported_features.add(PlayerFeature.VOLUME_MUTE)
if not self.get_linked_airplay_player(False):
_supported_features.add(PlayerFeature.NEXT_PREVIOUS)
+ if not self.get_linked_airplay_player(True):
+ _supported_features.add(PlayerFeature.ENQUEUE)
self._attr_supported_features = _supported_features
self._attr_name = (
# edge case: we switched from airplay mode to sonos mode (or vice versa)
# we need to make sure that playback gets stopped on the airplay player
await airplay_player.stop()
+ # We also need to run setup again on the Sonos player to ensure the supported
+ # features are updated.
+ await sonos_player.setup()
async def _setup_player(self, player_id: str, name: str, info: AsyncServiceInfo) -> None:
"""Handle setup of a new player that is discovered using mdns."""