getCurrent() | Promise<Track | null> | Returns the track currently being played, or null if the queue is empty. |
setCurrent(track) | Promise<void> | Sets the track currently being played. Pass null to clear it. |
getPrevious() | Promise<Track[]> | Returns all previously played tracks, ordered from newest to oldest. |
addPrevious(track) | Promise<void> | Adds one or more tracks to the "previous" history list. |
setPrevious(track) | Promise<void> | Replaces the previous track list with the provided track(s). |
popPrevious() | Promise<Track | null> | Removes and returns the most recently played track (index 0 in history), or null if none. |
clearPrevious() | Promise<void> | Clears the history of previously played tracks. |
size() | Promise<number> | Returns the number of tracks currently queued (excluding the currently playing track). |
totalSize() | Promise<number> | Returns the total number of tracks in the queue, including the currently playing one. |
duration() | Promise<number> | Returns the total duration (in milliseconds) of all queued tracks. |
add(track, offset?) | Promise<void> | Adds one or more tracks to the queue. Optionally insert at a specific offset. |
remove(start?, end?) | Promise<Track[]> | Removes one or more tracks by index range and returns the removed tracks. |
clear() | Promise<void> | Removes all tracks from the queue. |
dequeue() | Promise<Track | undefined> | Removes and returns the next track in the queue (FIFO order). |
enqueueFront(track) | Promise<void> | Adds one or more tracks to the front of the queue. |
getTracks() | Promise<Track[]> | Returns all queued tracks in order. |
getSlice(start?, end?) | Promise<Track[]> | Returns a subset of the queued tracks by index range without removing them. |
modifyAt(start, deleteCount?, ...items) | Promise<Track[]> | Removes deleteCount tracks starting at start, replacing them with items if provided. Returns the removed tracks. |
shuffle() | Promise<void> | Randomly shuffles all tracks in the queue. |
userBlockShuffle() | Promise<void> | Shuffles the queue while keeping tracks from the same user grouped together. |
roundRobinShuffle() | Promise<void> | Shuffles tracks so that users are rotated fairly in playback order. |
mapAsync(callback) | Promise<T[]> | Runs callback for each track, returning the results as an array. |
filterAsync(callback) | Promise<Track[]> | Returns all tracks for which callback returns true. |
findAsync(callback) | Promise<Track | undefined> | Returns the first track for which callback returns true, or undefined if none match. |
someAsync(callback) | Promise<boolean> | Returns true if any track passes the callback test. |
everyAsync(callback) | Promise<boolean> | Returns true only if all tracks pass the callback test. |