mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Improve play media support in LinkPlay (#125205)
Improve play media support in linkplay
This commit is contained in:
parent
f3e2c51774
commit
af0a6d2820
@ -20,6 +20,9 @@ from homeassistant.components.media_player import (
|
|||||||
MediaType,
|
MediaType,
|
||||||
RepeatMode,
|
RepeatMode,
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.media_player.browse_media import (
|
||||||
|
async_process_play_media_url,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
@ -238,10 +241,14 @@ class LinkPlayMediaPlayerEntity(MediaPlayerEntity):
|
|||||||
self, media_type: MediaType | str, media_id: str, **kwargs: Any
|
self, media_type: MediaType | str, media_id: str, **kwargs: Any
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Play a piece of media."""
|
"""Play a piece of media."""
|
||||||
media = await media_source.async_resolve_media(
|
if media_source.is_media_source_id(media_id):
|
||||||
|
play_item = await media_source.async_resolve_media(
|
||||||
self.hass, media_id, self.entity_id
|
self.hass, media_id, self.entity_id
|
||||||
)
|
)
|
||||||
await self._bridge.player.play(media.url)
|
media_id = play_item.url
|
||||||
|
|
||||||
|
url = async_process_play_media_url(self.hass, media_id)
|
||||||
|
await self._bridge.player.play(url)
|
||||||
|
|
||||||
def _update_properties(self) -> None:
|
def _update_properties(self) -> None:
|
||||||
"""Update the properties of the media player."""
|
"""Update the properties of the media player."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user