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

Use MediaplayerEntityFeature and MediaType enums #672

Merged
merged 2 commits into from
Jul 31, 2024
Merged
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
8 changes: 3 additions & 5 deletions custom_components/browser_mod/media_player.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from homeassistant.components import media_source
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player import (
MediaPlayerEntity,
MediaPlayerEntityFeature,
MediaType,
)
from homeassistant.components.media_player.browse_media import (
async_process_play_media_url,
)
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_URL,
)
from homeassistant.const import (
STATE_UNAVAILABLE,
STATE_PAUSED,
Expand Down Expand Up @@ -113,7 +111,7 @@ async def async_play_media(self, media_type, media_id, **kwargs):
media_type = play_item.mime_type
media_id = play_item.url
media_id = async_process_play_media_url(self.hass, media_id)
if media_type in (MEDIA_TYPE_URL, MEDIA_TYPE_MUSIC):
if media_type in (MediaType.URL, MediaType.MUSIC):
media_id = async_process_play_media_url(self.hass, media_id)
await self.browser.send(
"player-play", media_content_id=media_id, media_type=media_type, **kwargs
Expand Down
Loading