-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Use media selector for media_player.play_media #26559
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
Conversation
Core PR is approved. Frontend/design/product should verify the change is wanted. |
@@ -207,7 +221,8 @@ export class HaMediaSelector extends LitElement { | |||
private _pickMedia() { | |||
showMediaBrowserDialog(this, { | |||
action: "pick", | |||
entityId: this.value?.entity_id, | |||
entityId: | |||
this.value?.entity_id || ensureArray(this.context?.filter_entity)?.[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it weird we only take the first entity id here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, though I'm not sure what is the alternative?
I would hope if you're doing play_media with multiple entities in a single service call, they probably would all support the same content?
If it must change, I guess you can fallback to manual entry if there are multiple entities, though that feels like maybe an over-reaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usecase I can think of is that you select an area as target, and then a random media player of that area will be the first entity. So it will base the available content on that entity... which is weird maybe. But selecting an area with multiple different type of media players as target is weird anyway probably 🤷♂️.
Not sure if I would expect to show only content available for all selected entities, or content available for any of the entities...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have if the context has multiple entities, a dropdown listing those entities, and you pick one entity from the dropdown, and that is used for the media?
Most of the code for that should already be there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
"media_content_type": "Media content type" | ||
"media_content_type": "Media content type", | ||
"media_content_id_detail": "The ID of the content to play. Platform dependent.", | ||
"media_content_type_detail": "The type of the content to play, such as image, music, tv show, video, episode, channel, or playlist." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick here: It should be "TV show" as we generally capitalize abbreviations.
(Lokalise flagged this making me aware of it)
Fix included in #26745
Proposed change
Frontend for home-assistant/core#150721
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: