Boom, just played the next track.
Thanks for all your hard work.
Does 20201221_3 contain support for browser_mod? I’m not seeing it listed in the available speakers list. it does show up in my devices, and I can play to it thru other means.
sure does … should be in the list … or click directly on the player … that more-info dialog should also have the browser button
JKW
got it, its working for me now. (think it needed a reboot)
Great work! I have everything working but no sound…
I have Sonos… It gives me the error "Sonos does not support a media type of “audio/mp3” in the log of Home Assistant… So this is a no for me then?
Hi, I’m not sure if that is a general issue with sonos or something that me can fix. Reading
Makes me believe that it is possible to stream a mp3. Can you confirm that you can stream a mp3 file via the play_media service ?
Jkw
Edit: so does it really matter to use “music”?
I use audio/mp3 at the moment ytube_music_player/custom_components/ytube_music_player/media_player.py at cfebe6c279e3b0aebbe21a6dc9330afb2c4a7622 · KoljaWindeler/ytube_music_player · GitHub
Edit2: would you feel comfortable with editing that line in the media_player.py to test if it would work with “music” ?
Hi,
Already tried to edit the media_player.py and changed audio/mp3 to music. Also tried audio/mp4 does not work.
Red somewhere that you need to present the full link to Sonos in order to make it work… But that was a test to local mp3 files, so that should work.
If you use ‘music’ as the content_id i get “Illegal MIME-Type from 192.168.x.x” in the log…
EDIT: something like this works with Sonos: http://hass_ip:8123/local/your.mp3
Youtube Music works fine trough the Sonos app… I have no clue if i can find out what kind of info it sends to Sonos in order to make it play…
Strange that it works locally.
You can add a “_LOGGER.error(_url)”
Right here https://github.com/KoljaWindeler/ytube_music_player/blob/cfebe6c279e3b0aebbe21a6dc9330afb2c4a7622/custom_components/ytube_music_player/media_player.py#L859
To get the youtube link and try sending that with various “music” etc to your sonos. Or even download the file locally and then send the command … You know… figuring out if the type is the problem or the location … or whatever
So do you want me to add this line below the highlighted line, or replace it with _LOGGER.error(_url) ?
Tried it with replacing, and i do get a bunch of errors but i think it plays by video id or something:
{‘videoId’: ‘KLvRXYwZNRY’, ‘title’: ‘Zara Larsson - I Would Like (MAGNÜS Remix)’.
After that there is all the information visible that you normally find in the description of every youtube video…
just add it below
_url = res['url'] + "&sig=" + signature
so you can see it on the log.
JKW
well, that makes my Sonos speakers go to unavailable
well its very hard for me to understand what “that” means. Adding the log output? That seams fairly unlikely.
But anyway … you could try to replace the mp3 line with MEDIA_TYPE_TRACK
ATTR_MEDIA_CONTENT_TYPE: MEDIA_TYPE_TRACK,
at least that’s what the spotify integration is using…
JKW
edit: just tested with my chromcasts … works fine here … but then again … also mp3 worked … so I have the feeling that the chromcast pretty much ignores this anyway
Allright so i tested a bit more.
Adding MEDIA_TYPE_TRACK instead of ‘audio/mp3’ or ‘music’ does not work.
What i do have is the url how it wants to play:
Any chance that you could test the spotify Integration?
All above looks correct, the url works … At this point I’m pretty clueless what could be the problem.
I don’t have a sonos so I don’t know if play_media works with online stored media at all …
Jkw
I will try to test the Spotify integration later. Waiting on the premium subscription to be active.
Tested some .mp3 files over the internet which works on my Sonos. Apart from that, I’m nowhere near a dev or anything like that, so if you are clueless, than I’m automatically too
Maybe, but you have the hardware on site
Have you tried to download a track from youtube to a local place like your www folder and send your sonos a link to that file?
E.g. test.mp3 in the www folder and send http://IP.8123/local/test.mp3 to the speaker
Jkw
Well, not on my own Home Assistant instance. I have SSL setup and it cried about an ssl issue or something. But I have found a link to a public MP3 files which plays without any issue.
“https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3”
Well basically the following thing can be the issue from my view:
1.) Sonos can’t play online stored files at all
2.) The media type has to be different from audio/mp3
3.) The youtube link are too long
4.) The youtube links are ssl
5.) The YouTube links don’t provide proper file type suffixes
6.) Something else in the file isn’t compatible with sonos
You’ve tested 1.) And 2.) And 4.)
The next logical step would be to grab the file from youtube and store/play it locally. Either with a shorter filename and with/without file type suffix
Jkw
I think it has something to do with 5.)
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…
Found something for Youtube Music and Sonos, but I think this is something on it’s own…