Skip to content

Commit

Permalink
Fix change track, while playing to AirPlay receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
repa committed Jan 8, 2025
1 parent 92ba78a commit 9b2d057
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 @@ -984,6 +984,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 9b2d057

Please # to comment.