great…i´m on it!!
thanks
Took a little while … but here it is. Let me know how it works for you.
To be honest: It doesn’t work all too well on my laptop (5+ years old).
I’d say that the media_browser loads ALL Images at once and the scroll performance isn’t great when the results contains >>100 entries. I’ve done some benchmarking: ~40sec to list all artists. The request at Ytube takes ~5sec, so 35sec to load/display the images. Also tested on my Pixel 4a5g, the list shows up after ~9sec but the scrolling is still far away from smooth. I don’t see a way how to improve this from inside this component as this is an issue with the media_browser in general. Just thought I’d let you know.
JKW
Still very happy with this development. thx again!
I would like to cast two or three playlists on two or three cast devices at the same time. So do i have to create as many ytube media players as i want to run parallel playlists? Is this even possible or is there another - better - way?
Exactly what I do … I have three players and play quite often different music on different players. Kids playroom, office and living room.
I’ve always used the same cookie and the same filename as all of that is running on my account.
Jkw
works pretty flawless on my setup (Phone: Oneplus 3t | Home Assistant: Rpi 4). In terms of loading time its not slower than before. 10 sec to load nearly 300 Artists and the scrolling is smooth without issue. great Job!!!
Ok, maybe I’m just not seeing it (new to YouTube Music, testing it out to see if I can move off Spotify and having to use LogitechMediaServer to use it with HASS), but is it possible to cast an individual song from YouTube Music? I’ve tried various combinations of the URL/just the ID using the media_player.play_media
service but I keep getting “Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address”
What am I missing?
Look in the Media Browser. This should be what you want.
I’ve seen this advice in here but I don’t follow what you mean. I want to be able to automate playing certain songs, not just be able to play a song from the UI.
yep, that works.
In general you’re doing it right… use e.g. the media_browser and select that one song that you want to play (not the playlist that contains the song). The media_browser part of this component will send the type and id via the media_play service to the player, but thats happening in the background
once the song is playing go to the development tools
→ states
and click on your media_player.ytube_music_player.
Scroll back up to the top and look at all the addition attributes. There will be one called media_id and another one that is called media_type. Note those down.
Stop the playback … or even turn off the ytube_media_player.
Go to development tools → services and select the play_media service. use the same values from above and hit send … that should start the exact same song.
Regarding the error
Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
is NOT from this component (right?) but from chromecast. I get this for every song but it works just fine. No idea what’s going on there (plus, it doesn’t matter )
JKW
Yes that’s coming from Chromecast. Sorry was just the only error I saw
Ok I tried pulling the media_id and type from the media_player. Went into the developer service and typed this in:
entity_id: media_player.office
media_content_id: 1-iKwZKc7Ok
media_content_type: track
I hear the Chromecast turn on but then…nothing. The song is Baby Shark (yeah…kids).
please use the ytube_music_player in the entity id
…d’oh!!! That did it. Knew there had to be something completely obvious I was missing.
Ok so if I wanted to automate this to play on different speakers, I’d set the input_select to the speaker I want and then use the play_media service. God that’s so much simpler than what I have now.
or even better … you don’t HAVE TO (but can) set the input_select … you can also use the select_source service … but again … both will work … the select_source way is just a bit cleaner as you could get ridge of the input_selects …
Ooo, good call. I’d still want the input_selects as again…kids and a SO who prefers to be able to physically change media controls.
the input select should also change when run the service … but anyway … whatever works best for you.
also see: https://github.com/KoljaWindeler/ytube_music_player#automations
JKW
Hi. This is an amazing component, thank you so much for it. I use it for play songs when I scan some NFC tags and it works perfectly (I always lose a few seconds of the beginning while loading, but it might be my not-so-speed internet connection).
Now I am trying to disable the continuos playing, because the song starts playing again and again and again (yeah, the definition of continuos…), but I have not been able to do that yet although I have set the ytube_music_player_playcontinuous to false. This is my config and automation:
- id: 'tag_scan_ytube_music'
alias: Handle Tag Scan Youtube Music
description: ''
trigger:
- platform: event
event_type: tag_scanned
condition: []
action:
- variables:
content_id: '{{ tags[trigger.event.data.tag_id].content_id }}'
- service: media_player.play_media
data:
entity_id: media_player.ytube_music_player
media_content_id: '{{ content_id }}'
media_content_type: track
- delay: '5'
mode: single
max_exceeded: silent
variables:
tags:
04-CA-00-00-00-01-00:
content_id: _UnbmCj-0QU
04-CA-00-00-00-02-00:
content_id: BzsrqaLgdpk
04-CA-00-00-00-03-00:
content_id: t_LOqKwbUcA
Any clue?
Ok, after setting the debug log and some testing, I ended up opening an issue:
Perhaps I’m still doing something wrong, but I don’t know what…
Hi, no … thats a real bug … will fix.
Edit: fixed https://github.com/KoljaWindeler/ytube_music_player/releases/tag/20210121
I 've made a very simple script… that is pretty fun for me.
The things i want to do “changing of playlist” with a command voice to my google mini.
I want to know what playlist is playing.
So “ok google active playlist” (in french) works like a charm, so i decided to share it.
I’m not a genius of yaml, it could be better !!!
you have to change
media_player.maison
to your media_player name
alias: Playlist
sequence:
- service: input_select.select_next
data: {}
entity_id: input_select.ytube_music_player_playlist
- service: media_player.turn_off
data: {}
entity_id: media_player.ytube_music_player
- delay: '00:00:02'
- service: tts.google_say
data_template:
entity_id: media_player.maison
message: 'Playlist "{{states(''input_select.ytube_music_player_playlist'')}}"'
- delay: '00:00:05'
- service: media_player.turn_on
data: {}
entity_id: media_player.ytube_music_player
mode: single
icon: 'mdi:boombox'
Ouch! I was expecting some of “please provide more information”, “need testing”, “by design”, “not a bug”… I don’t know, some kind of discussion… So disappointed
Anyway, thanks a lot for the quick fix (and release).