Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix change track, while playing to AirPlay receivers issue 594 #609

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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