Sonos control api supports loading a stream (e.g. a radio station) https://developer.sonos.com/reference/control-api/playbacksession/loadstreamurl/.
This is not suitable for single tracks, since it is not possible to seek (move forwards or backwards) within the track. The recommended way is to use loadCloudQueue https://developer.sonos.com/reference/control-api/playbacksession/load-cloud-queue/. This would mean hosting a separate http service that responds with the playlist information.
I see in a different answer that there is an undocumented api that would do the trick. https://stackoverflow.com/a/60457463/3023803. I couldn't figure out how to properly use it. The requests I did are:
method: POST
path: https://api.ws.sonos.com/control/api/v1/playbackSessions/<session_id>/playbackSession/queue
body: '{}'
RESPONSE 200 BODY {}
method: POST
path: https://api.ws.sonos.com/control/api/v1/playbackSessions/<session_id>/plabackSession/skipToItem
body: '{"itemID": "", "trackMetadata": {"mediaUrl": "...", "contentType": ""}}'
RESPONSE 499 BODY {"errorCode": "ERROR_ACCOUNT_FULL"}
Questions:
- Is there another way to play a single track through Control API, without the need to host you own server?
- Am I missing something when using this API?
- Any idea what the ERROR_ACCOUNT_FULL means?