Youtube Music - Media Browser

Ok.
Thanks for Your reply.

Hello,

Is there a way to advance tracks using voice commands with google assistant? I have this media player exposed to Google using the google assistant integration but canā€™t seem to figure out the right combination of words to control the YouTube Music media player.

Is there a way to link a friendly_name to the entity? Iā€™m thinking my name of ytube_music_player.media_player might be the problem and donā€™t want to change the entity name with it being associated with so many scripts and automations.

Thanks!

C

Hmm doesnā€™t seem like Homeassistent is exposing the ā€œnextā€ function to Google ā€¦ Iā€™ve shared and sync my player to Google. Sadly I donā€™t see a option to advance to the next track ā€¦ Iā€™ll dig around a bit more

Edit: correction script not automation

Maybe not ideal, but you can create an automation script that simple calls the service to advance next track

sequence:
  - service: media_player.media_next_track
    target:
      entity_id: media_player.ytube_music_player
mode: single
alias: next track

Then to use in google, youā€™d turn on the automation script

For example, if you named the automation script ā€œNext Trackā€ you would say " hey google, turn on next track"

3 Likes

Thatā€™s a good workaround, thanks.

1 Like

Hey everyone, I need your help to understand how this integration is being used:

Question 1:

a) I used to select my music via the drop down list and started the playback by turning on the player

but then I found the mini-media-player with the shortcuts functionality and since then i only play music by

b) calling the media_player.play_media service (via those shortcuts in the mini-media-player buttons) to directly start my playlists or mostly channels. If I want a UI to select whats being played I usually use the media_browser

What kind of user are you?

Background: The need to have those dropdowns seems to be rather confusing for beginners. Those have to be added manually (yaml) ā€¦ also the maintenance of that code section take some work and I wonder if that functionality is used at all. Iā€™m considering to remove it if nobody uses this

Question 2:

Currently the integration exposes quite a lot information via attributes:
volume_level, is_volume_muted, media_content_type, media_duration, media_position, media_position_updated_at, media_title, media_artist, media_album_name, shuffle, repeat, entity_picture_local, _player_state, likeStatus, current_playlist_title, videoId, lyrics, _media_type, _media_id, current_track, _player_id, playlists, total_tracks, tracks, friendly_name, icon, entity_picture, supported_features

A few of them are very long, in particular: lyrics, playlists, tracks.
Iā€™m wondering if those are used by anyone of if they just overload the state - overview page.
Iā€™m considering to a) add a sensor that is disabled by default and move all attributes over to this sensor. so you can decide to see it or not. b) add a switch to the configuration process the show/hide those attributes. This is relevant because there are wishes to add even more attributes which would further reduce the cleanliness Getting ytube_music_player.search results from automation level Ā· Issue #124 Ā· KoljaWindeler/ytube_music_player Ā· GitHub

Whatā€™s your opinion on this?

Question 3:
what else are you missing? Is there any functionality that could be added ?

Thanks :smiley:

Hi Kolja,

Q1 - I use option A, or I go into the Media Browser and select something in there (however I havenā€™t played around with that enough to work out how to start a ā€˜radioā€™ based on the first some selected).

UNRELATED TO THE POLL: Is there a way to search the YouTube Music for a song and start a ā€˜radioā€™ from that, not a song in my uploads?

Q2 - I donā€™t see a problem with having lots of attributes, I mean who spends that much time looking at this particular item in the States dev panel? Iā€™d say keep it as-is.

Q3 - So far you have done an amazing job. I havenā€™t had the time to fully take advantage of it (hence my question above about the ā€˜radioā€™ mode) Canā€™t think of anything else that it needs.

1 Like

just to quickly answer your question: I guess the fastest way is to start playing something ā€¦ e.g. by searching for a song / select a playlist ā€¦ and the go back to the media_browser and click ā€œradio of ā€¦ā€ that will generate a radio based on the current track.

else: you can call play_media with type: ā€˜vid_channelā€™ and the video_id which will to the same ā€¦

1 Like

Thanks. I just watched the video from the FAQ to see how itā€™s done.

I guess then an answer for Q3 could be: A way to have a search box in a card which gives results and then allows us to select a song rather than going via dev tools & media browser.

I donā€™t see this anywhereā€¦? I guess I need something playing first?

yes, once you play something the button should be there ā€¦
about the search box: yes! really yes! but Iā€™m really not a UI guy :smiley:
Although the integration would have to change as well to show the search results as attribute ā€¦ but Iā€™d be happy to change that if anyone would build a card for it!!

Sorted. Thank you!

That would definitely be cool. Unfortunately Iā€™m more of a hardware guy so canā€™t help much at all :frowning_face:

Q1: I mostly use the shortcuts mainly for the automatic playlists (Super, Mix1-5, Discover, ā€¦). But the dropdown is also helpful to select one of my own playlists. Therefore it would be a pity if the dropdown would not exist anymore.

Q2: I donā€™t mind the long attributes. I would not remove them. They help to keep track of what exactly is being played.

Q3: I donā€™t miss much. If the API allows it, playlist management would be nice. So for example adding a track to a playlist. At the moment I always have to go to the YTM website, find the current track manually and add it to a playlist.

1 Like

Q3:

service: ytube_music_player.add_to_playlist

without song_id and playlist_id it will simply add the current playing song to the current playlist it was started with ā€¦ this of course only makes sense if you start playback in channel mode, otherwise the sone will naturally be part of you playlist ā€¦ if you start a channel of your liked music the song will be liked instead of add to the playlist (sort of the same)

Ah, OK, I didnā€™t know this service yet. So, for example, if Iā€™m playing the Super Mix and want to add a track to a specific playlist, Iā€™d need a dropdown to select the playlist and a button to add the current track to the selected playlist. Iā€™ll try that.

may be the better idea would be to have 3 or more buttons for 3 or more target playlists.
each would call the service with just the playlist_id set ā€¦

e.g.

alias: add to carlos list
sequence:
  - service: ytube_music_player.add_to_playlist
    data:
      entity_id: media_player.ytube_music_player
      playlist_id: PLZvjm51R8SGsN1O-T9ecenED5zBB8qL0k
mode: single

simply start a playlist via the media_browser to figure out the playlist id (itā€™ll be shown in the attributes)

That would be too many buttons (17 at the moment). Also, I would have to create a new button every time I create a new playlist. A dropdown + one button is much clearer.

true, but i wonder how that script would look like ā€¦ youā€™d have to have all the playlist_ids in the dropdown and somehow remember what ID is what playlist. + you have to get the value from the dropdown into your service call (ok thatā€™s possible)

Haha, me too :grin: Iā€™ll try that later, right now I have to work a bit.

Q1 - I use option a). This is primarily because I have 25 playlists and didnā€™t want 25 buttons on the interface. However I am ok with moving to a different interface now that I have a better understanding of how to set it up. It was pretty confusing in the beginning so I understand why youā€™d want to change it. Especially if it means you can move the search results out of the media browser, I never go into the media player itself.

Q2 - I use the the playlists and tracks drop down the most. The tracks is good to have when creating a radio station. The lyrics is just an added bonus that I rarely expand. I have the tracks and lyrics as conditional - collapsable cards, so itā€™s not like they are taking up much space when they are there.

Q3 - Being able to pull the search results out of the media browser to be displayed in a card would be number one. Cause as I mentioned earlier I never actually go into the media browser (see screenshot, itā€™s a vertical mobile setup)

Second would be to be able to select speakers to start playing that arenā€™t part of the currently playing group. This is probably more of a problem with how google handles itā€™s groups as I think it can be done with Sonos speakers. I have a handful of different groups defined in Google (All, Upstairs, Downstairs, etc.) and would be nice to be able to select a speaker not part of the current playing group to start playing.

1 Like

Thanks for the feedback. I guess getting the search results as attributes will be the next thing to work on. But Iā€™ll follow the path of a separate sensor that CAN be activated which will provide all the extra stuff like lyrics, tracks and the search_result.

That would build the foundation for a Lovelace card displaying the results.
It would also mean that you (and others) would need some minor changes in your Lovelace UI. Basically grab, e.b. lyric from that sensor instead of the media_player.

I donā€™t really understand your group problem. I usually start playing on my Home-Office speaker and sometimes change to my ā€œbasement groupā€ which contains also the Home-Office speaker. Isnā€™t this what you want?

Jkw