When I create a playbackSession and load a track/playlist with loadStreamUrl
, this playlist repeats playing from the start after the last song was reached. I instead want it to stop at the end.
I tried to find a property similar to playOnComplete
(payload of loadStreamUrl
) which starts playback automatically after buffering the track, just for ending playback after the track was played.
I also tried to use playback->setPlayModes
to forbid repeating, but this is just ignored.
{
"playModes": {
"repeat": false
}
}
I know this is possible by setting up an Event Callback and process the playbackStatus events, but I am looking for a simple "fire-and-forget" solution.
The loadStreamUrl
command is for streaming radio. Since you're playing a playlist, you should use loadCloudQueue
.
Use loadCloudQueue
with a mediaUrl
for the track
instead of a SMAPI MusicObjectId
if you don't want to set up a SMAPI server. See loadCloudQueue
and Play audio (cloud queue) for details.
Alternatively, you can try the undocumented loadQueue
command. loadQueue
works like loadCloudQueue
but it doesn't require a cloud queue. To play a track without a cloud queue, send the following calls:
createSession
loadQueue
(described below) skipToItem
Initializes the Sonos queue with custom metadata and playback policies. Use this command with skipToItem
to send a track to the player. The player stops playing at the end of the track.
Name | Type | Description
metadata
| container
| Container metadata describing the queue. This could be a programmed radio station, an album, a playlist, etc.
policies
| playbackPolicy
| Playback policies for the session.
POST [base URL]/groups/{groupId}/playbackSession
{...}
POST [base URL]/playbackSessions/{sessionId}/playbackSession/queue
{...}
POST [base URL]/playbackSessions/{sessionId}/playbackSession/skipToItem
{...}
See Control API list for the base URL.