Use the seek
command in the playbackSession
namespace to seek to the position in the track with the specified itemId
in a cloud queue. This command requires your app to have either created a new session or joined an existing session, and also loaded a cloud queue on the group with loadCloudQueue
.
Use itemId
to ensure the group seeks on the current item. If the current item’s itemId
does not match the one provided, the player returns an ERROR_INVALID_OBJECT_ID
error.
Endpoint
POST
1 |
/playbackSessions/{sessionId}/playbackSession/seek |
Request Parameters
This command requires a sessionId
to determine the target of the command. See the Control documentation for details.
See the table below for descriptions of parameters in the body.
Parameter | Type | Value |
---|---|---|
itemId |
string | The identifier for the item. If this parameter does not match the currently playing item, the command fails. This ensures that playback does not jump back to a track if a user starts to scrub just as the player begins to play the next item. |
positionMillis |
unsigned int | Position within track in milliseconds. If this value exceeds the current track duration time, Sonos moves to the end of the current track, which results in a skip to the next track. |
Response
Returns an empty body with a success
value of true if successful.
In the event of a failure, returns a sessionError
or a globalError
.
For example, if the current item’s itemId
does not match the one provided, returns an ERROR_INVALID_OBJECT_ID
error.
Example
Request
1 2 3 4 |
{ "itemId": "abc", "positionMillis": 30000 } |