setPlayedSeconds
This endpoint is deprecated
See Add reporting for details.
Sonos uses setPlayedSeconds
to report play time on Sonos players. Sonos also uses these reports to support resumable content such as audio books. Sonos players send a final setPlayedSeconds
report after 30 minutes of no playback activity to indicate that playback has stopped. Set the "Playback duration logging at track end" capability to receive these reports from players. See Add capabilities for details.
Request parameters
Name | Type | Description |
---|---|---|
id | string | The ID of the played track. |
seconds | int | The total number of seconds for which the track played. Due to seeking or skipping back to the start, this may be longer than the total duration of the track. While in a paused state, time does not count toward the number of played seconds. Tracks playing for less than one whole second are not reported. |
offsetMillis | int | (Optional) The playhead position, in milliseconds, for the track. This is only reported if the track or the container that the track is in has a canResume value of true . See Save & resume playback for details. |
contextId | string | Sonos provides an ID to add context about where the track was playing from. For example, if a user browsed to an album and queued the album container, the contextId would be the album container ID. If they played a track, it would be the track ID. Supported sources include:- programmed radio - single track - album - a playlist from your service - artist - stream - audiobookThis is empty if a user plays a Sonos playlist. Select the "Add play context to reporting" capability to enable. See Add capabilities for details. |
Response
None.
Details
- This method enables the player to report how long a user listened to a particular item. The player sends this notification at the end of track playback whether through a skip, direct user action switching playback to another source, natural end of playback, end of queue, or other action.
- Particular sections of the song may be counted multiple times, such as when a user seeks or skips back to an earlier position in the track and resumes playback.
Sample request
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<setPlayedSeconds xmlns="http://www.sonos.com/Services/1.1">
<id>t10001</id>
<seconds>350</seconds>
<contextId>album:2343</contextId>
</setPlayedSeconds>
</soap:Body>
</soap:Envelope>
Sample response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<setPlayedSecondsResponse xmlns="http://www.sonos.com/Services/1.1">
<setPlayedSecondsResult>
</setPlayedSecondsResult>
</setPlayedSecondsResponse>
</soap:Body>
</soap:Envelope>
Updated over 1 year ago