Fix app browsing and local file streaming in Apple TV integration (#74112)

This commit is contained in:
Pierre Ståhl 2022-06-28 18:08:31 +02:00 committed by GitHub
parent b9c135870a
commit 54138cda41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -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,
)

View File

@ -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)