Skip to main content
Hello



From a few days I knowing Sonos controll API form

https://developer.sonos.com/reference/control-api/

Actualy I did it auth process as well, and now I just to try play mp3 file form HD using Sonos API. Unfortunately i can't find simply way to play any mp3 file using API.

Could someone show me simply way to do it ? Only what I'm found this is play from url

https://developer.sonos.com/reference/control-api/playbacksession/loadstreamurl/

But this means, each file first should be must upload to service and next play. I'm wondering how it is working on my Sonos application in Android. There I can just choice file from my phone and play. I would like this same results. It is possible using this API ?
Sonos players cannot magically read your HD to play your mp3, so you will need to expose the file via https, either by copying it to the cloud or running a simple http server on your PC. The latter is how the Android app exposes music from your phone to the Sonos players.
I understand. Now it's all clear. Thank You for reply
I was solving quite similar problem. I didn't call API directly (instead I was using SoCo library to send commands to the Speaker), but also had to find a way to upload a file to Sonos to play it. Eventually I ended up with a solution that launches a simple HTTP server which serves the file I need to play. If you are interested, the code in Python is here: https://github.com/drudv/sonosplay/blob/master/sonosplay/streamer.py



Currently it doesn't stop working after the file is finished playing: it's probably necessary to poll the speaker's state in order to catch this moment and stop the streaming service, but now it can only be stopped manually.