For the LgWebOSMediaPlayerEntity official integration add support on the LgWebOSMediaPlayerEntity.async_play_media to play remote audio and video. It seems something pretty easy and supported by aiowebostv client:
@cmd
async def async_play_media(
self, media_type: MediaType | str, media_id: str, **kwargs: Any
) -> None:
"""Play a piece of media."""
_LOGGER.debug("Call play media type <%s>, Id <%s>", media_type, media_id)
if media_type == MediaType.VIDEO or media_type == MediaType.MUSIC:
if (source_dict := self._source_list.get("Media Player")) is None:
_LOGGER.warning(
"Source 'Media Player' not found for %s",
self._friendly_name_internal(),
)
return
await self._client.launch_app_with_params(
source_dict["id"],
{
"payload": [
{
"fullPath": media_id,
"mediaType": media_type,
"deviceType": "DMR",
"fileName": "track",
}
]
},
)
elif media_type == MediaType.CHANNEL:
_LOGGER.debug("Searching channel")
partial_match_channel_id = None
perfect_match_channel_id = None
for channel in self._client.channels:
if media_id == channel["channelNumber"]:
perfect_match_channel_id = channel["channelId"]
continue
if media_id.lower() == channel["channelName"].lower():
perfect_match_channel_id = channel["channelId"]
continue
if media_id.lower() in channel["channelName"].lower():
partial_match_channel_id = channel["channelId"]
if perfect_match_channel_id is not None:
_LOGGER.info(
"Switching to channel <%s> with perfect match",
perfect_match_channel_id,
)
await self._client.set_channel(perfect_match_channel_id)
elif partial_match_channel_id is not None:
_LOGGER.info(
"Switching to channel <%s> with partial match",
partial_match_channel_id,
)
await self._client.set_channel(partial_match_channel_id)