Playing sound file on a specific Sonos device
Bart Schellens 6 years ago in Devices / Sonos • updated by Łukasz Klinger 2 years ago • 12
Can someone tell me how to play a specific sound file in the Music Library of my Sonos system on a specific Sonos. I'm trying to use the ChangeStationByUri(stationName, streamingUrl) function but no success yet. The command is being transferred to the Sonos player when I put the link to the file (\\NAS-....) instead of stationName (and leave streamingURL blank) but my Sonos controller tells me "Unable to locate ...". Also tried putting the audio file in my Sonos favorites and calling the favorite in bOS but no luck so far.
Customer support service by UserEcho
What I know the only way with bOS is to play a URL.
I have solved this with Python script and play for example Spotify list or notifications with a http request from bOS.
I'm having an odd issue. I can play radio stations without any problems using the ChangeStationByUri function. However, when I'm trying to play a wav file from the Internet (http://IP/dir/to/file.wav) using the same function - it's not working. The title changes to the filename, and the playback time jumps between 0 - 3 seconds but no playback is happening.
When trying to play the same file using a custom script and setting the "SetAVTransportURI" to play the file URL, everything works as expected.
ChangeStationByUri only works for streaming uris, for now.
Sonos device in bOS will be improved in the next major version release (bOS 5), which will not happen soon.
Any suggestions about Sonos are welcome.
I actually managed to achieve the above using a HttpRequest from within a Program. I just had to compose the POST request myself.
Would you like to share the implementation?
I'm looking forward to compose the HttpRequest, but either it doesn't work, or it restarts the Sonos and clears the playlist. I've tried several examples with the Headers etc, but I can't get it working.
you can find a sample here
This is how I'm playing a wav file for instance. Should be the same for streaming as well, all you need to do is make sure your URI starts with rincon-x-mp3radio:// instead of http://
Also, this only sets the new URI, if you want to play it you will need to send a regular Play command afterwards.
Thanks for the example!
Meanwhile I was able to find the correct configs for the headers and post command, but I only got to test play and pause commands, so with your example now it's more clear.
So in practice, with this task I set the file to be played, and then I need to set play to start. Got it! Will test it soon.
Rait, it also works with other file locations, like NAS folder for example.
I was able to successfully set an mp3, located in my NAS public folder.
If you need to try, you can use x-file-cifs://
Hello, can you re-post full example ? thank you !
Has anyone had success playing (on a sonos) the files stored locally on the bos controller?
On my jigsaw i have som .mp3 files stored. I'm not able to find the correct path.
Can you printscreen the sonos configuration into the program to play directly from the sounds library on the bos controller ?
też jestem zainteresowany odtwarzaniem plików na bos ale i też jeśli ktoś wykąbinował odtwarzanie z bos mieniionego tekstu na mowe