From 54138cda418de49e824644824f0b124f3a85b3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20St=C3=A5hl?= Date: Tue, 28 Jun 2022 18:08:31 +0200 Subject: [PATCH] Fix app browsing and local file streaming in Apple TV integration (#74112) --- homeassistant/components/apple_tv/browse_media.py | 4 ++-- homeassistant/components/apple_tv/media_player.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/apple_tv/browse_media.py b/homeassistant/components/apple_tv/browse_media.py index 8d0a94ca858e..0673c9923fb5 100644 --- a/homeassistant/components/apple_tv/browse_media.py +++ b/homeassistant/components/apple_tv/browse_media.py @@ -21,8 +21,8 @@ def build_app_list(app_list): media_content_id="apps", media_content_type=MEDIA_TYPE_APPS, title="Apps", - can_play=True, - can_expand=False, + can_play=False, + can_expand=True, children=[item_payload(item) for item in app_list], children_media_class=MEDIA_CLASS_APP, ) diff --git a/homeassistant/components/apple_tv/media_player.py b/homeassistant/components/apple_tv/media_player.py index 30a397d953ce..362a09fb5fc9 100644 --- a/homeassistant/components/apple_tv/media_player.py +++ b/homeassistant/components/apple_tv/media_player.py @@ -282,22 +282,20 @@ class AppleTvMediaPlayer(AppleTVEntity, MediaPlayerEntity): # RAOP. Otherwise try to play it with regular AirPlay. if media_type == MEDIA_TYPE_APP: await self.atv.apps.launch_app(media_id) + return if media_source.is_media_source_id(media_id): play_item = await media_source.async_resolve_media( self.hass, media_id, self.entity_id ) - media_id = play_item.url + media_id = async_process_play_media_url(self.hass, play_item.url) media_type = MEDIA_TYPE_MUSIC - media_id = async_process_play_media_url(self.hass, media_id) - if self._is_feature_available(FeatureName.StreamFile) and ( media_type == MEDIA_TYPE_MUSIC or await is_streamable(media_id) ): _LOGGER.debug("Streaming %s via RAOP", media_id) await self.atv.stream.stream_file(media_id) - elif self._is_feature_available(FeatureName.PlayUrl): _LOGGER.debug("Playing %s via AirPlay", media_id) await self.atv.stream.play_url(media_id)