Youtube Music - Media Browser

Thank you very much, Kolja, for this great addon. Even as a beginner I managed it. What I can’t get right, though, are the dropdown menus with input_select. I would like to have two dropdown menus, one to select a playlist, and the other to select the speaker.

Can someone please give me a quick clue? I have never worked with ‘input_select’ before. When I insert it in the UI, I read “entity not available: input_select.ytube_music_player_speakers”. Do I need to create the dropdown menu itself in another place first?

Thanks a lot.

Exactly … please copy the content of this file (ytube_music_player/package/default.yaml at 7b87c89385d1fe7b36c8f806274b729bf40640e9 · KoljaWindeler/ytube_music_player · GitHub) to your configuration.yaml

Edit: this (ytube_music_player/package/full_control.yaml at 7b87c89385d1fe7b36c8f806274b729bf40640e9 · KoljaWindeler/ytube_music_player · GitHub) would give you even more control

Edit2: I’d still recommend to use the Mini-Media-Player with some shortcuts … But i guess that’s personal opinion

Jkw

2 Likes

Great, thanks for the tip. Now it works.

One more question: While the player is playing something, I can’t change the playlist from the dropdown menu, is that right? I first have to switch it off and on again so that it plays the newly selected playlist.

I’m only surprised because I can switch input_select.ytube_music_player_speakers while it’s already playing.

By the way, I already use the mini media player. Only without shortcuts, I prefer dropdown lists.

1 Like

Correct, as of now the player keeps playing the previously selected playlist. The “switch player while playing” is an extra feature that I’ve added to “take my music with me” …

I’ll consider to add direct playlist changing
Jkw

1 Like

I have a single Sonos speaker, got it to work with the proxy, however, it plays the same song over and over again unless I close it and reselect a playlist. Then I tested it on all of my speakers and noticed the exact same behavior, even when initiating the next track. Any ideas?

Amazing work overall! I was saddened when the google music player depreciated, this project has exceeded my expectations in every way!

Hi, have you checked the repeat settings ?
If your repeat is set to ‘one’ then this is kind of the expected behavior …
Either call the media_player.repeat_set command or (even before that) check the attributes of the player
JKW

I have checked the repeat settings, to test, proceeded to call the service:

It executed successfully, repeat is off:

Then, the player was stuck in a paused state and doesn’t play the rest of the playlist. I had implemented the suggested automation, too:

Not entirely sure if it had anything to do with my problems this whole time, I had also deployed MPD automation too because I was testing and forgot I had it enabled for the same player… I disabled it and now it seems to be working as expected. Thnx for the support, sent you 3 coffees!

1 Like

Thanks
And yes, if you send both commands only the last mode will stick … glad that it’s working for you now and thanks again for the beers
Jkw

Further testing on Non-Sonos speakers with the yaml player, same behavior I had described before. However, as long as I have a work around, I’m satisfied, the config flow player works perfectly on the rest of the speakers. I can do additional testing, let me know.

What do you mean by “yaml player”?
The Google family (chromecast / mini ) should work without workarounds. That’s what I use for testing.

It’s actually very annoying that all player in Homeassistent behavior differently and that we have to fix that :wink:

Sorry for not being clear. I had already added the ytube player through config flow resulting in the media_player.ytube_music_player entity. However, in response to the ‘Illegal MIME-Type’ error while trying to stream to the Sonos speaker, then added the proxy config like so:

  - platform: ytube_music_player
    speakers:
      - media_player.gym
    proxy_path: "/config/www"
    proxy_url: "https://mysite.duckdns.org/local/"

Consequently, this generated another entity: media_player.ytube_music_player_yaml

The proxy works now as intended with the Sonos speaker using, media_player.ytube_music_player_yaml but the other speakers(mostly chromecast) replay the same song over and over, even as the file /local/ytube_proxy.mp4 changes with the appropriate song, I’ve manually accessed the file on a browser to confirm.

The entity media_player.ytube_music_player successfully streams music to all the speakers as expected, except the lone Sonos speaker as aforementioned.

Wow that’s an interesting combination.
Two further questions: what automation are you using? Because the “pause_is_idle” stuff should only work with the config_flow player. And why didn’t you create a proxy player via config flow?

Edit: oh and why do you use a duckdns? Isn’t your Homeassistent on the same network as sonos and chromecast?

I did create the proxy player via config_flow initially but decided to try YAML to see if it made a difference and it doesn’t. The same behavior is exhibited where the google mini keeps repeating the first song served. For further context, the cover art and song on the player does change as normal with each sequential song on the playlist. The song will not change unless the player is closed and relaunched.

I have the Sonos and Minis on a separate VLAN, created firewall rules to get the Proxy to work to communicate with home assistant ip and port.

I’ve now commented out all of the YAML and reinstalled the integration and can still reproduce the song repeating issue. This time I created another config_flow player without the proxy and have achieved the same workaround I did before and I’m happy with that!

DAMN … you are right … I’m almost 100% sure that it was working with the proxy and google devices … but I can now reproduce the same behavior … the file is changing but the player keeps playing the same song … I’d agree … that must be some sort of buffering …

Edit:
please try https://github.com/KoljaWindeler/ytube_music_player/releases/tag/20210225

edit2:
just to give some background info: I’m using an alternating ID now, so the proxy filename will switch between 0_ytube_proxy.mp4 and 1_ytube_proxy.mp4 it looks like the chromecast is now not longer buffering anything

This has been such a great custom component!

I did have a problem if anyone had any thoughts. I had set the default to one Google Home Speaker (media_player.speaker1) using the Configuration -> Integration setup.

If I want to play a playlist to another Google Home speaker (media_player.speaker2) I had just used the mini media card to play that same playlist to another speaker. However, when I click the button, it still seems to play on the original default speaker. Am I missing something obvious?

    type: 'custom:mini-media-player'
    entity: media_player.ytube_music_player
    shortcuts:
      columns: 2
      buttons:
        - source: media_player.speaker1
          type: playlist
          id: playlist_id
        - source: media_player.speaker2
          type: playlist
          id: playlist_id

Thanks :heart_eyes:
Changing the player via Mini-Media-Player only work if you use “type: source, id: mediaplayer.speaker2”
You can’t combine playlist and speaker that way.
Workaround 1: 3 buttons, two for the player one for the playlist
Workaround 2: create a script and link that into the shortcut
Jkw

1 Like

That makes sense! Thank you so much

Hello and congrats for this great add-on.
Could you please clear something out for me?

Although i set it up correctly (at least i get my playlists in the UI), i cannot get it to output sound.
Which speakers are compatible with this?
Only what is supported by home assistant cast or chromecasts?

I have the following devices:

  • A latest webos LG tv where i can cast youtube from my phone
  • A denon receiver that supports airplay and supports spotify connect.
  • Entities from alexa_media_player
  • I also have a firestick where Kodi is installed.

Are any of these compatible?

Thank you :slight_smile:

Hi, this component will use the “play_media” service of any home_assistant media_player and send the decoded youtube url to the player.

  • some work perfectly (chromecast / google mini)
  • some need fixes (mpd) due to incoherent states (some player change to “idle” at the end of a track, some to “off”, others to “paused”)
  • some need a proxy (sonos) (because they have to have a suffix in the filename)
  • some player don’t support the “play_media” service with mp4 url (alex / firetv)

if you can play a mp3/4 stream with your tv or denon it might work …
JKW

Hey, thanks for your answer.
Unfortunately, the two fist devices of my list dont work (tv and denon). Or perhaps i have something set up incorrectly.

Does this means it decodes the video to mp3 and sends it over as a file to the player? or just the url for the player to stream it directly?
Can i select between mp3/mp4? (music/video)

What’s that? :smiley:

Ill have to set up alexa media player again and try it.
Also, to use kodi, i need to add it as an integration and just stream to it? Or is there some settings on kodi-side i should take care of?

Lastly, i had a hard time understanding that i need to import your package files into my configuration in order for the dropdowns and source selection to work. Maybe you could make it clearer in the instructions? (just a friendly suggestion :smiley:)