Player class

Spotify Player Object

Annotations
  • @JS.new('Spotify.Player')

Constructors

Player(PlayerOptions options)
The main constructor for initializing the Web Playback SDK. It should contain an object with the player name, volume and access token.

Properties

deviceID ↔ String?
Device id of the player.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(String type, Function callback) → void
Create a new event listener in the Web Playback SDK.
connect() → dynamic
Connects Web Playback SDK instance to Spotify with the credentials provided during initialization.
disconnect() → void
Closes the current session that Web Playback SDK has with Spotify.
getCurrentState() → dynamic
Collect metadata on local playback.
nextTrack() → dynamic
Skip to the next track in local playback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → dynamic
Pause the local playback.
previousTrack() → dynamic
Switch to the previous track in local playback.
removeListener(String event_name) → void
Remove an event listener in the Web Playback SDK.
resume() → dynamic
Resume the local playback.
seek(int position_ms) → dynamic
Seek to a position in the current track in local playback.
setName(String name) → dynamic
Rename the Spotify Player device. This is visible across all Spotify Connect devices.
setVolume(double volume) → dynamic
Set the local volume for the Web Playback SDK.
togglePlay() → dynamic
Resume/pause the local playback.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited