AbstractSpotifyService
On this page
- AbstractSpotifyService ⇐
Abstract- AbstractSpotifyService()
- setActiveState(active) ⇒
Promise.<Boolean> - getActiveState() ⇒
Promise.<Boolean> - setShuffle(shuffle) ⇒
Promise.<Boolean> - isShuffleOn() ⇒
Promise.<Boolean> - setRepeatMode(repeatMode) ⇒
Promise.<Boolean> - getRepeatMode() ⇒
Promise.<String> - getTrackMetadata(relativeIndex) ⇒
Promise.<Object> - playTrack() ⇒
Promise.<Boolean> - pauseTrack() ⇒
Promise.<Boolean> - nextTrack() ⇒
Promise.<Boolean> - previousTrack() ⇒
Promise.<Boolean> - seekInTrack(offset) ⇒
Promise.<Boolean> - getTrackPosition() ⇒
Promise.<Number> - _setActiveState(active) ⇒
Promise.<Boolean> - _getActiveState() ⇒
Promise.<Boolean> - _setShuffle(shuffle) ⇒
Promise.<Boolean> - _isShuffleOn() ⇒
Promise.<Boolean> - _setRepeatMode(repeatMode) ⇒
Promise.<Boolean> - _getRepeatMode() ⇒
Promise.<String> - _getTrackMetadata(relativeIndex) ⇒
Promise.<Object> - _playTrack() ⇒
Promise.<Boolean> - _pauseTrack() ⇒
Promise.<Boolean> - _nextTrack() ⇒
Promise.<Boolean> - _previousTrack() ⇒
Promise.<Boolean> - _seekInTrack(offset) ⇒
Promise.<Boolean> - _getTrackPosition() ⇒
Promise.<Number> - _onConnectRequest() ⇒
Promise.<void> - _onSpotifyActive() ⇒
Promise.<void> - _onSpotifyInactive() ⇒
Promise.<void> - _onShuffle(active) ⇒
Promise.<void> - _onRepeat(mode) ⇒
Promise.<void> - _onLostPermission() ⇒
Promise.<void> - _onPlay() ⇒
Promise.<void> - _onPause() ⇒
Promise.<void> - _onTrackChanged(metadata) ⇒
Promise.<void> - _onSeek(position) ⇒
Promise.<void> - “connectRequest”
- “spotifyActive”
- “spotifyInactive”
- “shuffle”
- “repeat”
- “lostPermission”
- “play”
- “pause”
- “trackChanged”
- “seek”
AbstractSpotifyService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Service:
Properties
| Name | Type | Description |
|---|---|---|
| isPaused | boolean | true if spotify is paused |
- AbstractSpotifyService ⇐
Abstract- new AbstractSpotifyService()
- .setActiveState(active) ⇒
Promise.<Boolean> - .getActiveState() ⇒
Promise.<Boolean> - .setShuffle(shuffle) ⇒
Promise.<Boolean> - .isShuffleOn() ⇒
Promise.<Boolean> - .setRepeatMode(repeatMode) ⇒
Promise.<Boolean> - .getRepeatMode() ⇒
Promise.<String> - .getTrackMetadata(relativeIndex) ⇒
Promise.<Object> - .playTrack() ⇒
Promise.<Boolean> - .pauseTrack() ⇒
Promise.<Boolean> - .nextTrack() ⇒
Promise.<Boolean> - .previousTrack() ⇒
Promise.<Boolean> - .seekInTrack(offset) ⇒
Promise.<Boolean> - .getTrackPosition() ⇒
Promise.<Number> - ._setActiveState(active) ⇒
Promise.<Boolean> - ._getActiveState() ⇒
Promise.<Boolean> - ._setShuffle(shuffle) ⇒
Promise.<Boolean> - ._isShuffleOn() ⇒
Promise.<Boolean> - ._setRepeatMode(repeatMode) ⇒
Promise.<Boolean> - ._getRepeatMode() ⇒
Promise.<String> - ._getTrackMetadata(relativeIndex) ⇒
Promise.<Object> - ._playTrack() ⇒
Promise.<Boolean> - ._pauseTrack() ⇒
Promise.<Boolean> - ._nextTrack() ⇒
Promise.<Boolean> - ._previousTrack() ⇒
Promise.<Boolean> - ._seekInTrack(offset) ⇒
Promise.<Boolean> - ._getTrackPosition() ⇒
Promise.<Number> - ._onConnectRequest() ⇒
Promise.<void> - ._onSpotifyActive() ⇒
Promise.<void> - ._onSpotifyInactive() ⇒
Promise.<void> - ._onShuffle(active) ⇒
Promise.<void> - ._onRepeat(mode) ⇒
Promise.<void> - ._onLostPermission() ⇒
Promise.<void> - ._onPlay() ⇒
Promise.<void> - ._onPause() ⇒
Promise.<void> - ._onTrackChanged(metadata) ⇒
Promise.<void> - ._onSeek(position) ⇒
Promise.<void> - “connectRequest”
- “spotifyActive”
- “spotifyInactive”
- “shuffle”
- “repeat”
- “lostPermission”
- “play”
- “pause”
- “trackChanged”
- “seek”
AbstractSpotifyService()
Service managing the Spotify Connect feature
setActiveState(active) ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| active | Boolean | true to establish connection, false to disconnect |
getActiveState() ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true if STB is the active playback device
setShuffle(shuffle) ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| shuffle | Boolean | true to activate shuffle, false to deactivate |
isShuffleOn() ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true if shuffle mode is on
setRepeatMode(repeatMode) ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| repeatMode | String | disabled, repeat_context or repeat_track |
getRepeatMode() ⇒ Promise.<String>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<String> - - promise value will be disabled, repeat_context or repeat_track
getTrackMetadata(relativeIndex) ⇒ Promise.<Object>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Object> - - promise value is the requested metadata object
| Param | Type | Description |
|---|---|---|
| relativeIndex | Number | target track index, relative to the current track, default value is 0 (current track) |
playTrack() ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
pauseTrack() ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
nextTrack() ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
previousTrack() ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
seekInTrack(offset) ⇒ Promise.<Boolean>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| offset | Number | time in ms to seek forward in the track, negative values will seek backwards |
getTrackPosition() ⇒ Promise.<Number>
Kind: instance method of AbstractSpotifyService
Returns: Promise.<Number> - - promise value will be time elapsed in ms in current track
_setActiveState(active) ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| active | Boolean | true to establish connection, false to disconnect |
_getActiveState() ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true if STB is the active playback device
_setShuffle(shuffle) ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| shuffle | Boolean | true to activate shuffle, false to deactivate |
_isShuffleOn() ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true if shuffle mode is on
_setRepeatMode(repeatMode) ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| repeatMode | String | disabled, repeat_context or repeat_track |
_getRepeatMode() ⇒ Promise.<String>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<String> - - promise value will be disabled, repeat_context or repeat_track
_getTrackMetadata(relativeIndex) ⇒ Promise.<Object>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Object> - - promise value is the requested metadata object
| Param | Type | Description |
|---|---|---|
| relativeIndex | Number | target track index, relative to the current track, default value is 0 (current track) |
_playTrack() ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
_pauseTrack() ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
_nextTrack() ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
_previousTrack() ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
_seekInTrack(offset) ⇒ Promise.<Boolean>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Boolean> - - promise value will be true on success
| Param | Type | Description |
|---|---|---|
| offset | Number | time in ms to seek forward in the track, negative values will seek backwards |
_getTrackPosition() ⇒ Promise.<Number>
Kind: instance abstract method of AbstractSpotifyService
Returns: Promise.<Number> - - promise value will be time elapsed in ms in current track
_onConnectRequest() ⇒ Promise.<void>
Dispatch Spotify Connect request
Kind: instance method of AbstractSpotifyService
Access: protected
_onSpotifyActive() ⇒ Promise.<void>
Dispatch Spotify becoming active
Kind: instance method of AbstractSpotifyService
Access: protected
_onSpotifyInactive() ⇒ Promise.<void>
Dispatch Spotify becoming inactive
Kind: instance method of AbstractSpotifyService
Access: protected
_onShuffle(active) ⇒ Promise.<void>
Dispatch Spotify shuffle mode changing
Kind: instance method of AbstractSpotifyService
Access: protected
| Param | Type | Description |
|---|---|---|
| active | Boolean | true if shuffle mode turned on, false if turned off |
_onRepeat(mode) ⇒ Promise.<void>
Dispatch Spotify repeat mode changing
Kind: instance method of AbstractSpotifyService
Access: protected
| Param | Type | Description |
|---|---|---|
| mode | String | disabled, repeat_context or repeat_track |
_onLostPermission() ⇒ Promise.<void>
Dispatch device losing Spotify playback permission
Kind: instance method of AbstractSpotifyService
Access: protected
_onPlay() ⇒ Promise.<void>
Dispatch Spotify starting or resuming playback
Kind: instance method of AbstractSpotifyService
Access: protected
_onPause() ⇒ Promise.<void>
Dispatch Spotify pausing playback
Kind: instance method of AbstractSpotifyService
Access: protected
_onTrackChanged(metadata) ⇒ Promise.<void>
Dispatch Spotify track changing
Kind: instance method of AbstractSpotifyService
Access: protected
| Param | Type | Description |
|---|---|---|
| metadata | SpotifyTrack | New metadata after it has changed |
_onSeek(position) ⇒ Promise.<void>
Dispatch Spotify seeking new position in its track
Kind: instance method of AbstractSpotifyService
Access: protected
| Param | Type | Description |
|---|---|---|
| position | Number | New position in the current track (in ms) |
“connectRequest”
When a device is asking to become the active playback device
Kind: event emitted by AbstractSpotifyService
“spotifyActive”
When the device is set as active playback device
Kind: event emitted by AbstractSpotifyService
“spotifyInactive”
When the device is not the active playback device anymore
Kind: event emitted by AbstractSpotifyService
“shuffle”
When the Spotify shuffle mode is turned on or off
Kind: event emitted by AbstractSpotifyService
“repeat”
When the Spotify repeat mode is changed or turned off
Kind: event emitted by AbstractSpotifyService
“lostPermission”
When the device is set as active playback device
Kind: event emitted by AbstractSpotifyService
“play”
When the playback has started or resumed
Kind: event emitted by AbstractSpotifyService
“pause”
When the playback has been paused
Kind: event emitted by AbstractSpotifyService
“trackChanged”
When the current track or its metadata has changed
Kind: event emitted by AbstractSpotifyService
“seek”
When the playback position in the track has changed
Kind: event emitted by AbstractSpotifyService