Skip to main content
Version: 3.2

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.

ParamTypeDescription
tracksarray of Track Object or a single oneThe tracks that will be added
insertBeforeIndexnumberThe 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>

ParamTypeDescription
tracksarray of track indexes or a single oneThe tracks that will be removed

skip(index, initialPosition)

Skips to a track in the queue.

Returns: Promise<void>

ParamTypeDescription
indexnumberThe track index
initialPositionnumberOptional. Sets the initial playback for the track you're skipping to.

skipToNext(initialPosition)

Skips to the next track in the queue.

Returns: Promise<void>

ParamTypeDescription
initialPositionnumberOptional. Sets the initial playback for the track you're skipping to.

skipToPrevious(initialPosition)

Skips to the previous track in the queue.

Returns: Promise<void>

ParamTypeDescription
initialPositionnumberOptional. 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>

ParamTypeDescription
indexnumberThe 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>

ParamTypeDescription
indexnumberThe track index
metadataobjectA 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.

ParamTypeDescription
modeRepeat ModeThe repeat mode

getRepeatMode()

Gets the repeat mode.

Returns: Repeat Mode