0

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.

Daniel Muñoz
  • 547
  • 1
  • 7
  • 23
supflux
  • 13
  • 1

1 Answers1

0

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:

  1. createSession
  2. loadQueue (described below)
  3. skipToItem

loadQueue

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.

Parameters

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.

Sample requests

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.

yrg
  • 336
  • 2
  • 6
  • Hi! Thanks for replying! Actually I want to play just a single track (MP3 file on AWS S3). Doing this via `loadCloudQueue`, as I understand, would require me to deploy a whole Cloud Queue Server + SMAPI Server setup. This seems oversized for playing just a single mp3. Can I use `loadCloudQuere` in a simpler manner? Or do you see another possibility to archive my goal? I also looked into the `audioClip` feature, but this would of course exclude older Sonos devices which do not support it. – supflux Feb 29 '20 at 19:19
  • Thanks for the support! This is exactly what I was looking for. – supflux Mar 04 '20 at 13:15
  • Tried to use the loadQueue command but there is just an empty `{}` result returned. Is this feature already canceled? – Erik Wolf Jan 31 '21 at 13:12