Player
#
GetDevicesGet information about a user’s available devices.
Parameters
Name | Description | Example |
---|
Usage
AvailabeDevices devices = _spotify.GetDevices();devices.Devices.ForEach(device => Console.WriteLine(device.Name));
#
GetPlaybackGet information about the user’s current playback state, including track, track progress, and active device.
Parameters
Name | Description | Example |
---|---|---|
[market] | An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | "DE" |
Usage
PlaybackContext context = _spotify.GetPlayback();if(context.Item != null) Console.WriteLine(context.Item.Name)); //Print the current song
#
GetPlayingTrackGet the object currently being played on the user’s Spotify account.
Parameters
Name | Description | Example |
---|---|---|
[market] | An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | "DE" |
This is a simpler (less data) version of GetPlayback
Usage
PlaybackContext context = _spotify.GetPlayingTrack();if(context.Item != null) Console.WriteLine(context.Item.Name)); //Print the current song
#
TransferPlaybackTransfer playback to a new device and determine if it should start playing.
Parameters
Name | Description | Example |
---|---|---|
deviceIds or deviceId | A JSON array containing the ID of the device on which playback should be started/transferred | "XXXX-XXXX-XXXX-XXXX" |
play | true: ensure playback happens on new device, false: keep current playback state | true |
Usage
ErrorResponse error = _spotify.TransferPlayback("XXXX-XXXX-XXXX-XXXX");
#
ResumePlaybackStart a new context or resume current playback on the user’s active device.
Parameters
Name | Description | Example |
---|---|---|
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
contextUri | Spotify URI of the context to play | "spotify:album:1Je1IMUlBXcx1Fz0WE7oPT" |
uris | An array of the Spotify track URIs to play. | new List<string> { "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" } |
offset | Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object, or when the uris parameter is used. | 0 |
Usage
ErrorResponse error = _spotify.ResumePlayback(uris: new List<string> { "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" });
#
PausePlaybackPause playback on the user’s account.
Parameters
Name | Description | Example |
---|---|---|
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.PausePlayback();
#
SkipPlaybackToNextSkips to next track in the user’s queue.
Parameters
Name | Description | Example |
---|---|---|
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.SkipPlaybackToNext();
#
SkipPlaybackToPreviousSkips to previous track in the user’s queue. Note that this will ALWAYS skip to the previous track, regardless of the current track’s progress. Returning to the start of the current track should be performed using the https://api.spotify.com/v1/me/player/seek endpoint.
Parameters
Name | Description | Example |
---|---|---|
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.SkipPlaybackToPrevious();
#
SeekPlaybackSeeks to the given position in the user’s currently playing track.
Parameters
Name | Description | Example |
---|---|---|
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. | 50 |
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.SeekPlayback(50);
#
SetRepeatModeSet the repeat mode for the user’s playback. Options are repeat-track, repeat-context, and off.
Parameters
Name | Description | Example |
---|---|---|
state | track, context or off. | RepeatState.Track |
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Track);
#
SetVolumeSet the volume for the user’s current playback device.
Parameters
Name | Description | Example |
---|---|---|
volumePercent | Integer. The volume to set. Must be a value from 0 to 100 inclusive. | 50 |
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.SetVolume(50);
#
SetShuffleToggle shuffle on or off for user’s playback.
Parameters
Name | Description | Example |
---|---|---|
shuffle | True or False | false |
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.SetShuffle(false);
#
AddToQueueAdd an Item to the User's Playback Queue. BETA.
Parameters
Name | Description | Example |
---|---|---|
uri | The uri of the item to add to the queue. Must be a track or an episode uri. | spotify:track:7zrCVKp6x0AtolOsn2iMif |
[deviceId] | The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | "XXXX-XXXX-XXXX-XXXX" |
Usage
ErrorResponse error = _spotify.AddToQueue("spotify:track:7zrCVKp6x0AtolOsn2iMif");