I have tried the Spotify integration but I’m a bit stuck.
I can use the integration, I can browse all the information through the media browser but there is no option from there to select a output device. It works with Spotcast, but that does not work for Sonos.
They made some progress on Spotify with Sonos, but as far as I know you are not able to browse using the media browser.
Here you can see that the correct uri from Sonos is used to make it work.
As said I am nowhere near a developer so I have no clue how to help any further for testing…
try the play_media url with the x-rincon-mp3radio prefix from edit3 below
download one song from youtube (just take the url from above) and store it to e.g. C:\temp\ with its original very long file name (or ‘a very long filename’ without suffix)
make a copy of the file with a way shorter filename e.g. test with no suffix
edit3: also try “x-rincon-mp3radio://YOURIP/test.mp3” instate of “http://YOURIP/test.mp3”
actually this might be a good idea upfront … try the original url from youtube and do the same replace there …
Simply do the same thing with this url:
x-rincon-mp3radio://r2—sn-5hne6nsr.googlevideo.com/videoplayback?expire=1608678376&ei=iCfiX7UjmtHXAu6tuZAL&ip=82.101.221.21&id=o-AJu9pHDJsPegnHiwZ4BoQ7XSsrKDfVyemEI36iA9SPyo&itag=140&source=youtube&requiressl=yes&mh=Br&mm=31%2C26&mn=sn-5hne6nsr%2Csn-4g5e6nlk&ms=au%2Conr&mv=m&mvi=2&pl=19&ctier=A&pfa=5&initcwndbps=1993750&hightc=yes&vprv=1&mime=audio%2Fmp4&ns=goTt-i2F5Wt6tkNLZjq8TM4F&gir=yes&clen=2736775&dur=169.041&lmt=1542338135916627&mt=1608656442&fvip=2&keepalive=yes&c=WEB_REMIX&txp=5432432&n=PqU0-uLypukRlye5&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cctier%2Cpfa%2Chightc%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKqdrFVZWwBYPtzoErxVfYNArxfn_a_m9H41g2xgR0Q2AiAbeTZAARfTxqEV04OoKnpmoGlGg0uNJGmI9loQbrRH4Q%3D%3D&sig=AOq0QJ8wRAIgV_y_-enNLZRo_tZ1yvUQpXLk9IRIJ-QuMTgdcgCAseACIG_Ndg8WcQanvXzcLdoOOBllRU4g-63f_S8BZ3SmmjsG
Edit although I don’t expect it to work due to the missing ssl
In the Sonos app I see that something wants to play but I get the message:
“cannot play videoplayback?expire= UNTIL BoQ7” (where UNTIL is everything in between) after that it also says cannot connect to r2--sn-5hne6nsr.googlevideo.com because the server is not found. Maybe the string is. indeed too long, because it looks like it caps the url at BoQ7…
I hit this error after updating (it’s fixed now so there is no issue)
2020-12-26 13:25:16 ERROR (SyncWorker_3) [custom_components.ytube_music_player.media_player] Exception during login, e.g. login data are NOT correct
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player]
============= ytube_music_player Integration Error ================
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player] unfortunately we hit an error in the sub api, please open a ticket at
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player] https://github.com/sigma67/ytmusicapi/issues
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player] and paste the following output:
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player] Traceback (most recent call last):
File "/home/homeassistant/homeassistant/custom_components/ytube_music_player/media_player.py", line 543, in _update_playlists
self._playlists = self._api.get_library_playlists(limit = 99)
File "/usr/local/share/homeassistant/lib/python3.8/site-packages/ytmusicapi/mixins/library.py", line 29, in get_library_playlists
results = find_object_by_key(nav(response, SINGLE_COLUMN_TAB + SECTION_LIST),
File "/usr/local/share/homeassistant/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 167, in nav
raise err
File "/usr/local/share/homeassistant/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 161, in nav
root = root[k]
KeyError: 'contents'
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player]
thanks, Kolja
2020-12-26 13:25:20 ERROR (SyncWorker_5) [custom_components.ytube_music_player.media_player] ============= ytube_music_player Integration Error ================
I just wanted to mention this in case it’s helpful to know - you did correctly catch the error on the first line.
2020-12-26 13:25:16 ERROR (SyncWorker_3) [custom_components.ytube_music_player.media_player] Exception during login, e.g. login data are NOT correct
I had forgotten that I recently cleared by browser cache.
I returned to YouTube Music and retrieved a new copy the cookie, which I was able to then reconfigure, using the integration’s OPTIONS. - Everything is back running now without error.
When detecting a login exception, it might be helpful to suggest for a user to obtain and reconfigure a fresh browser cookie.
I’ll add that, thanks for mentioning it. The login is still not “good” and that’s a known task for the underlying api. I’m very happy for all the great work they’ve done and I’m sure that they’ll find a proper way instead of the cookie - but until that: that’s what we have to deal with.
Jkw
Wow this is really amazing, love everything you have done! Trying to get the mini media player to work with my google home minis/nest minis. I cant seem to figure it out. Anyone have this working?
I walk down to the kitchen (an motion sensor detects me, turns on the lights and (within a certain time-window), starts playback of ytube_music in the kitchen)
Once the coffee is ready I walk over the my office (holding the kitchen lightswitch for 1s turns all lights etc off)
After arriving in my office I have to open homeassistant, turn off the ytube_music player, switch to the office player, turn it on again … sometime have to listen to the same song …
didn’t like that … so the new feature will help
The automation that turns off the kitchen light will (within a certain time-window) simply fire the media_player.select_source command
That will
grab the current media_position of the track on my kitchen player
stop the playback in the kitchen
turn off the kitchen player
start the same track (and playlist) on my office player
seek forward to the same position that the kitchen player was stopped at
Might be useful for any of you as well …
It works fine between my Google Home mini and my Chrome-cast and back, but I haven’t tested this on any other player … there is a little risk that the seek command arrives before the player started the playback (still loading the track). Never happened to me, but could be a potential weakness.
Happy New Year.
Thanks for the new feature!!! Quick question about the media browser. I have a large music library uploaded to youtube music, but when I check the media browser I only find a few songs under uploaded tracks. The category albums does not show my uploaded music. What’s the reason for that? I only can play my uploaded music through playlists. But it would me much more preferred if there would be a category artists to browse all music. Is that an issue by youtube music?
Hi, those limitations are self made youtube and the youtube api offers the option to browser through uploaded albums / artists. I haven’t implement it, as I don’t have uploaded music … let me tinker around a bit and see what I can add
let me know how it works for you, i saw some limitation, e.g. thumbnails missing, artist names missing, only first 25 tracks loaded. I’ve created a ticket for some but not all issues.
that was fast
works smooth and flawless but you are right regarding the limitations. I can see 100 Artists and i can access 25 Songs by every Artist. Same is true for Albums.