Skip to content

Commit

Permalink
Merge pull request #609 from dmr1987/master
Browse files Browse the repository at this point in the history
Fix change track, while playing to AirPlay receivers issue 594
  • Loading branch information
AlexxIT authored Jan 18, 2025
2 parents d06baed + 9b2d057 commit 838b0d0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions custom_components/yandex_station/core/yandex_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,19 @@ async def sync_play_media(self, player_state: dict):

source = self.sync_sources[self._attr_source]

#For AirPlay receivers is not possible to change media_content_id, while streaming to device is in progress
#So we need to send media_stop command to media_player instance
#And after streaming is stopped we can send to device new media_content_id
#If we don't do this we got error "already streaming to device"
#Error provided by pyatv component https://github.com/postlund/pyatv
#https://github.com/postlund/pyatv/blob/master/pyatv/protocols/raop/__init__.py at line 132
data_stop = {
"entity_id": source["entity_id"],
}
await self.hass.services.async_call("media_player", "media_stop", data_stop)
#After command is sended, we need to wait while receiver accept command and stop streaming
await asyncio.sleep(1)

try:
info = await get_file_info(
self.quasar.session,
Expand Down

0 comments on commit 838b0d0

Please sign in to comment.