public class PlaybackResource extends Object implements Subscribable
| Constructor and Description |
|---|
PlaybackResource(SonosApiClient apiClient)
Constructor for PlaybackResource.
|
| Modifier and Type | Method and Description |
|---|---|
SonosPlaybackStatus |
getPlaybackStatus(String clientToken,
String groupId)
Get playback status for the specified group
|
SonosSuccess |
loadLineIn(String clientToken,
String groupId,
String deviceId,
Boolean playOnCompletion)
Set a device in a group to use the line-in source.
|
SonosSuccess |
pause(String clientToken,
String groupId)
Set a group to 'pause' (not a toggle, see
togglePlayPause(String, String) |
SonosSuccess |
play(String clientToken,
String groupId)
Set a group to 'play' (not a toggle, see
togglePlayPause(String, String) |
SonosSuccess |
seek(String clientToken,
String groupId,
String itemId,
Integer positionMillis)
Go to a specific point in a track
|
SonosSuccess |
seekRelative(String clientToken,
String groupId,
String itemId,
Integer deltaMillis)
Seek to a relative position in a track.
|
SonosSuccess |
setPlayModes(String clientToken,
String groupId,
SonosPlayMode playMode)
Set playback options for a group (e.g.
|
SonosSuccess |
skipToNextTrack(String clientToken,
String groupId)
Skip to the next track
|
SonosSuccess |
skipToPreviousTrack(String clientToken,
String groupId)
Skip to the previous track
|
SonosSuccess |
subscribe(String clientToken,
String groupId)
Subscribe to events for this resource.
|
SonosSuccess |
togglePlayPause(String clientToken,
String groupId)
Toggle the play/pause state of a group
|
SonosSuccess |
unsubscribe(String clientToken,
String groupId)
Unsubscribe from events related to this resource.
|
public PlaybackResource(SonosApiClient apiClient)
Constructor for PlaybackResource.
apiClient - a SonosApiClient object.public SonosPlaybackStatus getPlaybackStatus(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - for the group you want to fetch the status forSonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APIpublic SonosSuccess loadLineIn(String clientToken, String groupId, String deviceId, Boolean playOnCompletion) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - for the group the device belongs todeviceId - of the device with a line-in source connectedplayOnCompletion - whether to start or continue playback once switched to line-in (if not provided, false)SonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APIpublic SonosSuccess play(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
togglePlayPause(String, String)clientToken - for the usergroupId - to playSonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APIpublic SonosSuccess pause(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
togglePlayPause(String, String)clientToken - for the usergroupId - to pauseSonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APIpublic SonosSuccess seek(String clientToken, String groupId, String itemId, Integer positionMillis) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - of the group to seekitemId - which should be targeted for the seek (optional - to ensure the right item is targeted)positionMillis - to seek toSonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APIpublic SonosSuccess seekRelative(String clientToken, String groupId, String itemId, Integer deltaMillis) throws SonosApiClientException, SonosApiError
seek(String, String, String, Integer)clientToken - for the usergroupId - of the group to seekitemId - to (optionally) target the seekdeltaMillis - to seek bySonosApiClientException - if an error occurs during the call.SonosApiError - if there is an error from the API.public SonosSuccess setPlayModes(String clientToken, String groupId, SonosPlayMode playMode) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - to set play mods forplayMode - a SonosPlayMode object containing partial or full settingsSonosApiClientException - if an error occurs during the call.SonosApiError - if there is an error from the API.SonosPlayMode,
Sonos docspublic SonosSuccess skipToNextTrack(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - to skip withinSonosApiClientException - if an error occurs during the call.SonosApiError - if there is an error from the API.public SonosSuccess skipToPreviousTrack(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - to skip withinSonosApiClientException - if an error occurs during the call.SonosApiError - if there is an error from the API.public SonosSuccess subscribe(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
Subscribe to events for this resource.
subscribe in interface SubscribableclientToken - for the usergroupId - of the resource to subscribe toSonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APIpublic SonosSuccess togglePlayPause(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
clientToken - for the usergroupId - to play/pauseSonosApiClientException - if an error occurs during the call.SonosApiError - if there is an error from the API.play(String, String),
pause(String, String)public SonosSuccess unsubscribe(String clientToken, String groupId) throws SonosApiClientException, SonosApiError
Unsubscribe from events related to this resource.
unsubscribe in interface SubscribableclientToken - for the usergroupId - of the resource to unsubscribe fromSonosApiClientException - if an error occurs during the callSonosApiError - if there is an error from the APICopyright © 2018. All rights reserved.