Queue
add(tracks, insertBeforeIndex)
Adds one or more tracks to the queue.
Returns: Promise<number | void> - The promise resolves with the first
added track index. If no tracks were added it returns void.
| Param | Type | Description |
|---|---|---|
| tracks | array of Track Object or a single one | The tracks that will be added |
| insertBeforeIndex | number | The index of the track that will be located immediately after the inserted tracks. Set it to null to add it at the end of the queue |
remove(tracks)
Removes one or more tracks from the queue.
Returns: Promise<void>
| Param | Type | Description |
|---|---|---|
| tracks | array of track indexes or a single one | The tracks that will be removed |
skip(index, initialPosition)
Skips to a track in the queue.
Returns: Promise<void>
| Param | Type | Description |
|---|---|---|
| index | number | The track index |
| initialPosition | number | Optional. Sets the initial playback for the track you're skipping to. |
skipToNext(initialPosition)
Skips to the next track in the queue.
Returns: Promise<void>
| Param | Type | Description |
|---|---|---|
| initialPosition | number | Optional. Sets the initial playback for the track you're skipping to. |
skipToPrevious(initialPosition)
Skips to the previous track in the queue.
Returns: Promise<void>
| Param | Type | Description |
|---|---|---|
| initialPosition | number | Optional. Sets the initial playback for the track you're skipping to. |
reset()
Resets the player stopping the current track and clearing the queue.
getTrack(index)
Gets a track object from the queue.
Returns: Promise<Track>
| Param | Type | Description |
|---|---|---|
| index | number | The track index |
getCurrentTrack()
Gets the index of the current track
Returns: Promise<number>
getQueue()
Gets the whole queue
Returns: Promise<Track[]>
removeUpcomingTracks()
Clears any upcoming tracks from the queue.
updateMetadataForTrack(index, metadata)
Updates the metadata of a track in the queue. If the current track is updated, the notification and the Now Playing Center will be updated accordingly.
Returns: Promise<void>
| Param | Type | Description |
|---|---|---|
| index | number | The track index |
| metadata | object | A subset of the Track Object with only the artwork, title, artist, album, description, genre, date, rating and duration properties. |
setRepeatMode(mode)
Sets the repeat mode.
| Param | Type | Description |
|---|---|---|
| mode | Repeat Mode | The repeat mode |
getRepeatMode()
Gets the repeat mode.
Returns: Repeat Mode