Class PlayerApi
- java.lang.Object
-
- de.sonallux.spotify.api.apis.PlayerApi
-
public class PlayerApi extends Object
-
-
Constructor Summary
Constructors Constructor Description PlayerApi()
-
Method Summary
-
-
-
Method Detail
-
addToQueue
public AddToQueueRequest addToQueue(String uri)
Add an item to queue
Add an item to the end of the user's current playback queue.
- Parameters:
uri-The uri of the item to add to the queue. Must be a track or an episode uri.
- Returns:
- a
AddToQueueRequestobject to build and execute the request
-
getUsersAvailableDevices
public GetUsersAvailableDevicesRequest getUsersAvailableDevices()
Get a User's Available Devices
Get information about a user's available devices.
- Returns:
- a
GetUsersAvailableDevicesRequestobject to build and execute the request
-
getInformationAboutUsersCurrentPlayback
public GetInformationAboutUsersCurrentPlaybackRequest getInformationAboutUsersCurrentPlayback()
Get Information About The User's Current Playback
Get information about the user's current playback state, including track or episode, progress, and active device.
- Returns:
- a
GetInformationAboutUsersCurrentPlaybackRequestobject to build and execute the request
-
getRecentlyPlayed
public GetRecentlyPlayedRequest getRecentlyPlayed()
Get Current User's Recently Played Tracks
Get tracks from the current user's recently played tracks. Note: Currently doesn't support podcast episodes.
- Returns:
- a
GetRecentlyPlayedRequestobject to build and execute the request
-
getUsersCurrentlyPlayingTrack
public GetUsersCurrentlyPlayingTrackRequest getUsersCurrentlyPlayingTrack(String market)
Get the User's Currently Playing Track
Get the object currently being played on the user's Spotify account.
- Parameters:
market-An ISO 3166-1 alpha-2 country code or the string
from_token. Provide this parameter if you want to apply Track Relinking.- Returns:
- a
GetUsersCurrentlyPlayingTrackRequestobject to build and execute the request
-
pauseUsersPlayback
public PauseUsersPlaybackRequest pauseUsersPlayback()
Pause a User's Playback
Pause playback on the user's account.
- Returns:
- a
PauseUsersPlaybackRequestobject to build and execute the request
-
seekToPositionInCurrentlyPlayingTrack
public SeekToPositionInCurrentlyPlayingTrackRequest seekToPositionInCurrentlyPlayingTrack(int positionMs)
Seek To Position In Currently Playing Track
Seeks to the given position in the user's currently playing track.
- Parameters:
positionMs-The position in milliseconds to seek to. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.
- Returns:
- a
SeekToPositionInCurrentlyPlayingTrackRequestobject to build and execute the request
-
setRepeatModeOnUsersPlayback
public SetRepeatModeOnUsersPlaybackRequest setRepeatModeOnUsersPlayback(String state)
Set Repeat Mode On User’s Playback
Set the repeat mode for the user's playback. Options are repeat-track, repeat-context, and off.
- Parameters:
state-track , context or off .
track will repeat the current track.
context will repeat the current context.
off will turn repeat off.- Returns:
- a
SetRepeatModeOnUsersPlaybackRequestobject to build and execute the request
-
setVolumeForUsersPlayback
public SetVolumeForUsersPlaybackRequest setVolumeForUsersPlayback(int volumePercent)
Set Volume For User's Playback
Set the volume for the user's current playback device.
- Parameters:
volumePercent-The volume to set. Must be a value from 0 to 100 inclusive.
- Returns:
- a
SetVolumeForUsersPlaybackRequestobject to build and execute the request
-
skipUsersPlaybackToNextTrack
public SkipUsersPlaybackToNextTrackRequest skipUsersPlaybackToNextTrack()
Skip User’s Playback To Next Track
Skips to next track in the user's queue.
- Returns:
- a
SkipUsersPlaybackToNextTrackRequestobject to build and execute the request
-
skipUsersPlaybackToPreviousTrack
public SkipUsersPlaybackToPreviousTrackRequest skipUsersPlaybackToPreviousTrack()
Skip User’s Playback To Previous Track
Skips to previous track in the user's queue.
- Returns:
- a
SkipUsersPlaybackToPreviousTrackRequestobject to build and execute the request
-
startUsersPlayback
public StartUsersPlaybackRequest startUsersPlayback()
Start/Resume a User's Playback
Start a new context or resume current playback on the user's active device.
- Returns:
- a
StartUsersPlaybackRequestobject to build and execute the request
-
toggleShuffleForUsersPlayback
public ToggleShuffleForUsersPlaybackRequest toggleShuffleForUsersPlayback(boolean state)
Toggle Shuffle For User’s Playback
Toggle shuffle on or off for user's playback.
- Parameters:
state-true : Shuffle user's playback.
false : Do not shuffle user's playback.- Returns:
- a
ToggleShuffleForUsersPlaybackRequestobject to build and execute the request
-
transferUsersPlayback
public TransferUsersPlaybackRequest transferUsersPlayback(List<String> deviceIds)
Transfer a User's Playback
Transfer playback to a new device and determine if it should start playing.
- Parameters:
deviceIds-A JSON array containing the ID of the device on which playback should be started/transferred.
For example:{device_ids:["74ASZWbe4lXaubB36ztrGX"]}
Note: Although an array is accepted, only a single device_id is currently supported. Supplying more than one will return400 Bad Request- Returns:
- a
TransferUsersPlaybackRequestobject to build and execute the request
-
-