Playback policy list
Unless otherwise noted, when a playback policy is false, the commands that would cause the action will return an ERROR_DISALLOWED_BY_POLICY
playbackError. For example, if you have the canSkipBack
playback policy set to false and your app sends a skipToPreviousTrack command, the player would return an ERROR_DISALLOWED_BY_POLICY
playbackError. The description for the policy lists the commands that would cause an error.
See Set playback policies for details.
Policies for playback contexts
The following playback policies apply to the playback context, which includes the container, user account, and other parameters shown in the GET /context endpoint.
Policy | Decription | Type | Default value |
---|---|---|---|
canCrossfade | Determines whether or not the player allows the user to crossfade. If false, your app should not enable the ability to crossfade. | Boolean | true |
canRepeat | Determines whether or not the player allows the user to enable repeat on the current item list. If false, your app should not enable the ability to repeat. | Boolean | true |
canRepeatOne | Determines whether or not the player allows the user to enable repeat for the current item. If false, your app should not enable the ability to repeat a single item. | Boolean | true |
canResume | Determines whether or not the player reports playback progress information after playback pauses for a certain amount of time. When true, the player reports playback progress information, such as offsetMillis . Your service can use this information to later resume playback progress from where it paused. | Boolean | false |
canSeek | Determines whether or not the player allows the user to jump to a new position within an item. When false, the seek command returns an error. Note that this does not prevent users from repeating the item. | Boolean | true |
canShuffle | Determines whether or not the player allows the user to enable shuffle on the current item list. When false, your app should not enable the ability to shuffle. | Boolean | true |
canSkip | Determines whether or not the player allows the user to skip forward. When true, the player will also look at the value of the limitedSkips policy to determine whether or not to enforce skip limits. | Boolean | true |
canSkipBack | Determines whether or not the player allows the user to skip backwards. When false, the skipToPreviousTrack command returns an error. | Boolean | false |
canSkipToItem | Determines whether or not the player allows the user to jump to a new item. When false, the skipToItem command returns an error. | Boolean | true |
limitedSkips | Determines whether or not the player enforces skip limits. When true, the player sends a GET /itemWindow request when a user skips to the next track or back to a previous one. The server can then decide the appropriate action. The player waits for a response before performing the action. Your server handles informing the player of whether or not any skips are remaining. Use the reason parameter in these GET /itemWindow requests to keep track of skips. When there are no skips remaining, set skipLimitReached to true inside the limitedSkipsState object. See Set playback policies for details. | ||
notifyUserIntent | When true, players send a GET /itemWindow request on a user action, such as play, pause, or skipping items in the queue. The server can then decide the appropriate action. The player waits for a response before performing the action. For example, a listener uses the hardware buttons to skip to the next song. If your service has set notifyUserIntent to true, this action sends a new GET /itemWindow request to your server. This request has a reason parameter and that parameter will be “skipNext” to let your server know that the user requested to skip the item. | Boolean | false |
pauseAtEndOfQueue | When true, player pauses playback at the end of the queue. When false, player skips to the beginning of the queue. | Boolean | true |
pauseOnDuck | When false, player lowers volume during a duck action. When true, player pauses track during a duck action. True by default for items with a type of audiobook or chapter. False by default for other items. | Boolean | false |
pauseTtlSec | Specifies an amount of time (in seconds) for playback to be paused before Sonos marks the queue as expired. When the queue expires, Sonos disables all transport operations except play and stop. Resuming playback in this state forces the player to make a GET /itemWindow request. | number | 0 |
playTtlSec | Specifies a limit (in seconds) on continuous playback without interaction. Sonos pauses playback when it reaches this specified duration. At this point, pauseTtlSec will activate if it is configured. | number | 0 |
refreshAuthWhilePaused | If true, players refresh the access token when playback is paused, similar to the updateToken parameter in GET /version.If false, players do not refresh the access token. Users will not be able to start music when resuming playback if the access token has expired and will receive an error instead. Note: Portable devices, such as the Sonos Move, don’t wake up from deep power savings mode to refresh a token. | ||
showNNextTracks | Determines the number of upcoming tracks that can be displayed. Defaults to unlimited if you don’t specify a value. | number | unlimited |
showNPreviousTracks | Determines the number of previously played tracks that can be displayed. Defaults to unlimited if you don’t specify a value. | number | unlimited |
skipsRemaining | (Experimental) Sonos reserves this parameter in the limitedSkipsState object for future use. Even though this value is not exposed to the player, you may find it useful for debugging as you develop this feature. See Set playback policies for details. | number | null |
Policies for individual items
The following playback policies apply to individual items such as items, podcasts, and stations.
Policy | Decription | Type | Default value |
---|---|---|---|
canCrossfade | Overrides a container-level canCrossfade value of true for this single item. You can’t override a container-level canCrossfade value of false. Doing so would violate the crossfade policy for other items in the container.Set canCrossfade to false on items for which crossfading is not desired. For example, you may not want to allow crossfading for advertisements. If false, the item plays without crossfading with the previous or following item.This per-item policy does not change the crossfade mode set by the end user. The player does not change the current playModes values. The user may change the crossfade mode, if permitted, at the container-level. But this will not affect how the player handles the item with the canCrossfade policy of false. | Boolean | Container value |
canResume | Overrides the container-level canResume policy for this single item. If canResume is false at the item-level, the player won’t report playback progress information to your service for this item. If canResume is true at the item-level, the player reports playback progress information to your service for this item. | Boolean | false |
canSeek | Overrides the container-level canSeek policy for this single item.If the container has a canSeek policy of false, but the item has a canSeek policy of true, then the user can seek to a new position in the item. | Boolean | Container value |
canSkip | Overrides the container-level canSkip policy for this single item to determine whether or not the player allows the user to skip forward.If the container has a canSkip policy of false, but the item has a canSkip policy of true, then the user can skip the item. | Boolean | Container value |
canSkipBack | Overrides the container-level canSkipBack policy for this single item.If the container has a canSkipBack policy of false, but the item has a canSkipBack policy of true, then the user can skip to the previous item. | Boolean | Container value |
canSkipToItem | Overrides the container-level canSkipToItem policy for this single item.If the container has a canSkipToItem policy of false, but the item has a canSkipToItem policy of true, then the user can jump to a new item. | Boolean | Container value |
isVisible | Set this policy to false to hide an item, such as an advertisement. When hidden, items won’t be counted or visible in the queue. Hidden items don’t show as the next item before they’re played. Hidden items are visible when they play. Sonos events this metadata for your app to display on the Now Playing screen. | Boolean | true |
pauseOnDeck | When false, player lowers volume during a duck action. When true, player pauses track during a duck action. True by default for items with a type of audiobook or chapter. False by default for other items. | Boolean | false |
Updated over 1 year ago