Members
-
spotify :Spotify
-
Description
The spotify client.
Details
Methods
-
state( [ types ] ) → {Promise.<(State|HTTPError|ApiError)>}
-
Description
Get information about the user's current playback state.
Parameters
Name Type Attributes Default Description types
Array.<AdditionalTypes> <optional> ['track'] The types that the client supports. (track, episode)
Returns
Details
-
transfer( id [, play ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Transfer playback to a new device and determine if it should start playing.
Parameters
Name Type Attributes Default Description id
string The id of the device to transfer the playback to.
play
boolean <optional> true The playback continues after transfer.
Returns
Details
-
devices() → {Promise.<(Array.<Device>|HTTPError|ApiError)>}
-
Description
Get information about a user’s available devices.
Returns
Details
-
current( [ types ] ) → {Promise.<(Track|HTTPError|ApiError)>}
-
Description
Get the object currently being played on the user's Spotify account.
Parameters
Name Type Attributes Default Description types
Array.<AdditionalTypes> <optional> ['track'] The types that the client supports.
Returns
Details
-
start( uri [, options ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Start a new context.
Parameters
Name Type Attributes Description uri
ContextURI The context uri to start playing.
options
StartOptions <optional> Returns
Details
-
resume( [ device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Resume current playback on the user's active device.
Parameters
Name Type Attributes Description device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
pause( [ device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Pause playback on the user's account.
Parameters
Name Type Attributes Description device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
next( [ device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Skips to next track in the user’s queue.
Parameters
Name Type Attributes Description device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
back( [ device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Skips to previous track in the user’s queue.
Parameters
Name Type Attributes Description device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
seek( ms [, device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Seeks to the given position in the user’s currently playing track.
Parameters
Name Type Attributes Description ms
number The position in milliseconds to seek to. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.
device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
repeat( state [, device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Set the repeat mode for the user's playback. Options are repeat-track, repeat-context, and off.
Parameters
Name Type Attributes Description state
RepeatStates The state to set the user's currently active device repeat mode to.
device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
volume( vol [, device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Set the volume for the user’s current playback device.
Parameters
Name Type Attributes Description vol
number The volume to set. Must be a value from 0 to 100 inclusive.
device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
shuffle( state [, device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Toggle shuffle on or off for user’s playback.
Parameters
Name Type Attributes Description state
boolean To shuffle the user's playback.
device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details
-
recent( options ) → {Promise.<(Array.<Track>|HTTPError|ApiError)>}
-
Description
Get tracks from the current user's recently played tracks. Note: Currently doesn't support podcast episodes.
Parameters
Name Type Description options
RecentOptions Returns
Details
-
queue( uri [, device ] ) → {Promise.<(Status|HTTPError|ApiError)>}
-
Description
Add an item to the end of the user's current playback queue.
Parameters
Name Type Attributes Description uri
ContextURI The uri of the item to add to the queue. Must be a track or an episode uri.
device
string <optional> The id of the device this command is targeting. If not supplied, the user's currently active device is the target.
Returns
Details