Youtube Music - Media Browser

I don’t think so

Allright so i have tested a bit and i have found the following.

By adding the two lines proxy_path and proxy_url a ytube_proxy.mp4 file gets stored in the www folder. As soon as you try to play it with Sonos it tries to play it, but it looks like it’s having a hard time to connect to either the local ip address or the hostname of my home assistant instance. When i try to play it via the browser the mp4 file plays fine.

I have also tried to adjust the proxy_url to x-rincon-mp3radio://ha_ip:8123/local but that also does not work.

I have to say that i normally connect via hostname so my internal ha ip is not reachable by http. It is reachable via https://ip:8123 but that gives a cert error ofcourse.

After that i disabled the hostname/ssl/external login stuff from my configuration.yaml so i was able to test via http://localipofha:8123/local/ytube_proxy.mp4.

config via developer tools --> services:

entity_id: media_player.sonos_woonkamer
media_content_id: http://192.168.1.120:8123/local/ytube_proxy.mp4
media_content_type: music

This works.

Now i added the config to configuration.yaml

media_player:
  - platform: ytube_music_player
    speakers:
      - sonos_woonkamer
    proxy_path: "/config/www"
    proxy_url: "http://192.168.1.120:8123/local"

After that i have tested via your integration/media_browser, and that works too. The tracks play on my Sonos, great news!

The downside: it only works when i have my external_url and ssl disabled. This is not a workable situation… have to dig into that a bit more to see if i can use external_url and http://internal_ip:8123 at the same time…

All i can say: great work on your side so far Kolja!

1 Like

Just to add another option: you could install a super easy Webserver that serves a dedicated folder somewhere like /tmp/ via a dedicated port like 8080 that’s only serving the file. …

The integration can store wherever (I think) and forward whatever link :wink:

do you know if there is a add-on for home assistant to do that?

Nope, at least not after searching for two minutes.
Hmm in theory it would be possible to add Webserver functionality to the integration … But that seams a bit to much for sonos support don’t you think?

Edit: why not adding a super simple Webserver? How do you run Hass? If you run it via docker then it would only be one command to add a second container the contains the Webserver

Edit2: e.g. (untested)
docker run -d --name my-apache-app -p 8080:80 -v “/path/to/your/www/folder”:/usr/local/apache2/htdocs/ httpd:2.4

Or

docker run --name some-nginx -p 8080:80 -v /path/to/www:/usr/share/nginx/html:ro -d nginx

A little off topic here, I know. But I’m still hoping gmusic-proxy will migrate to YouTube Music at some point. There has been little discussion, but it’s at least being considered.

I cannot decide if that’s too much or no. I’m nowhere near a developer. For Sonos and music in general there is no nice and good looking solution that links both together. I think with this we are really close of having something that does.

Honestly: I’d really prefer to off-load the Webserver to a dedicated service like a docker container … otherwise we’ll into issues with the server and can’t focus on the core features of the integration.

I understand that your setup with ssl etc won’t work out-of-the-box but for many simple setups it will. So … Special setup - special solution :wink:

I don´t have a premium account and are able to use this integration without issue!

Good day. i use this great addon on raspberry pi + os home assistant + addon MPD. after each track the player turns off. Can you please help me to solve this problem. thank you.

Hi, please create a ticket https://github.com/KoljaWindeler/ytube_music_player/issues
Please enable debug output and attach a typical log so we can have a look
Kolja

Sorry i never did that. Can you help me. What exactly do i need to add to a ticket?

Found your ticket, great job

1 Like

New release to add lots of new functions, but also a braking change (as mentioned earlier)

@Nemesis24: Go ahead and test interruptions! 2nd example of https://github.com/KoljaWindeler/ytube_music_player/blob/main/README.md#automations

@sleeepy2: You can now rate tracks, have a look at the 2nd part of https://github.com/KoljaWindeler/ytube_music_player/blob/main/README.md#services
My rate button with instant feedback

          - type: 'custom:button-card'
            state:
              - operator: template
                value: >
                  [[[ return
                  states['media_player.ytube_music_player_cf'].attributes.likeStatus
                  == "LIKE"]]]
                icon: 'mdi:thumb-up'
              - operator: default
                icon: 'mdi:thumb-up-outline'
                value: false
            tap_action:
              action: call-service
              service: ytube_music_player.call_method
              service_data:
                entity_id: media_player.ytube_music_player_cf
                command: rate_track
                parameters: thumb_toggle_up_middle

As always: Feedback is very welcome!

PS: I didn’t try yet, but having the “like” button as shortcut of the mini-media-player would be way nicer … should be possible with https://github.com/kalkih/mini-media-player/issues/471

4 Likes

Thank you very much !!!
All is ok for me !!
this is awesome !!

1 Like

The new release is working GREAT, but i still do not understand the use in your package yaml of the other two media_players entries as i see all is controlled by the media_player.ytube_music_player inside the mini-media-player custom component.
Can you explain better what is the use of them?

EDIT: I found this little issue when playing uploaded album:

Hi, there is no real use … those are just my media_players that I use for testing.

I’ve left them in the file so user can understand how the screenshot was generated.
You can either adapt it for your setup or remove it completely.

Also the other details like the media_id are really just meant to show the extra attributes, I don’t show those values in my daily setup. Those are meant to help others how to get the media_type and _id e.g. to create shortcuts or for automations…

PS:

:heart_eyes::heart_eyes::heart_eyes:

3 Likes

Awesome, thanks very much.
Working great.

1 Like

Hi,

I have just exhibited an issue. I use the kitchen google speaker with a zigbee button as a doorbell, but when it gets pressed the speaker starts playing the last playlist, this also happens when I send a TTS message to it.
Any others have this issue?

Cheers
Brent

1 Like

look here play a ding dong mp3 file https://github.com/KoljaWindeler/ytube_music_player#automations