Playing sound file on a specific Sonos device

Avatar
  • updated

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.

Avatar
LÊ NHÂN
Quote from Joachim O

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. 

Image 2182

Hello, have you found a solution to this problem yet?

Avatar
Łukasz Klinger
Quote from Gruyère Energie SA

Hello Joachim,

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

Avatar
Gruyère Energie SA

Hello Joachim,

Can you printscreen the sonos configuration into the program to play directly from the sounds library on the bos controller ?

Avatar
Joachim O

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. 

Image 2182

Avatar
Dieter Kraewinkels

Hello, can you re-post full example ? thank you !

Avatar
Ricardo Pinto

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://


Example: x-file-cifs://ipaddress/public/file.mp3

Avatar
Ricardo Pinto

Hello Rait,


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.


Thanks!

Avatar
Rait Lotamõis

Hello Ricardo,


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.



Avatar
Ricardo Pinto

Hello Rait,


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.


Kind regards

Avatar
Rait Lotamõis

I actually managed to achieve the above using a HttpRequest from within a Program. I just had to compose the POST request myself.