Discord Player
API reference

GuildQueue and node

Queue options, methods, state, and the playback node.

You are reading the v8 docsDev

GuildQueue schedules tracks. queue.node is a GuildQueuePlayerNode that controls the Remedia session.

Queue options

const queue = await player.createQueue(guildId, { maxSize: 100, metadata: { textChannelId } });
OptionDescription
metadataYour data, stored on the queue
maxSizeUpcoming-track capacity; zero or less means unlimited
history.maxHistorySize, history.disableHistoryHistory retention limit and collection policy
playback.repeatModeInitial repeat mode
playback.volume, playback.filterGraphInitial volume percentage (0–200) and filtergraph
playback.crossfadeCrossfade policy; false disables it
playback.onBeforeCreateStream, playback.onStreamExtracted, playback.onAfterCreateStreamResource hooks
connectionOptions.selfDeaf, connectionOptions.selfMuteDefault voice flags
connectionOptions.selectNodeInitial Remedia node selection
autoplay.autoplayTimeoutMsTotal related discovery and selection deadline, default 30000 ms
lifecycleLeave and pause policies, including cooldowns

Options apply when the queue is created.

Methods

MethodDescription
connect(options)Join or move to options.channelId
play(resource, options?)Queue a track, batch, playlist, or search result and start if idle
playNext()Start the next upcoming track when idle
skip(reason?, description?)Skip the current track. Returns the next track or null
skipTo(target), jump(target)Skip to an upcoming track
stop()Stop playback and keep upcoming tracks
destroy(), delete()Stop, leave voice, and remove the queue
addTrack(trackOrPlaylist), addTracks(tracks)Add to the end
prepend(), append(), insertTrack()Add at a position
removeTrack(), moveTrack(), swapTracks(), copyTrack()Change upcoming tracks
clear()Remove upcoming tracks and history
setSelfDeaf(enabled), setSelfMute(enabled)Voice flags
enableShuffle(), disableShuffle(), toggleShuffle()Shuffle
setRepeatMode(mode)Set the repeat mode
setMaxSize(n), setMaxHistorySize(n)Change limits

connect() accepts Discord Player's GuildQueueConnectOptions: channel and node selection, voice flags, percentage volume, a raw filtergraph, creation-only enableFallbackSeeking, and cancellation. connectTimeoutMs controls the initial join deadline, which defaults to 100 seconds. This is a queue API, not the full native session-options object; see playback controls for fallback-seeking constraints.

State

PropertyDescription
guildIdThe guild ID
currentTrackThe playing or paused track, or null
tracksUpcoming tracks
size, maxSize, maxHistorySizeCounts and limits. size excludes the current track
estimatedDurationDuration of upcoming tracks in milliseconds
historyThe history manager
nodeThe playback node
metadataYour data
repeatMode, isShufflingRepeat and shuffle state
isPlaying()true while playing, including when paused
filtersSame as node.filters
syncedLyricsSynchronized lyrics
statsCounters for finished and failed tracks
signalAbortSignal that aborts as soon as destroy() starts

Lifetime signal

queue.signal aborts when queue.destroy() or queue.delete() starts, including when the Player destroys the queue. It stays aborted if cleanup fails. Stopping, skipping, pausing, or replacing a session does not abort it. A new queue for the same guild gets a new signal.

Pass it to cancellable APIs, or listen with { once: true }. Before you work with a stored queue, call queue.signal.throwIfAborted().

Playback node

await queue.node.pause();
await queue.node.seek(15_000);
await queue.node.setVolume(80);
MemberDescription
pause(), resume(), setPaused(paused)Playback state
seek(ms)Seek to a position
setVolume(percent)0 to 200
volumeCurrent volume percentage
playbackTime, streamTimeElapsed playback time in milliseconds
totalDurationTrack duration in milliseconds
getTimestamp(){ current, total, progress } or null
createProgressBar(options?)Text progress bar
isIdle(), isPlaying(), isPaused()Session status
filtersAudio filters
getSession()The Remedia session. Throws without one. getSession(false) returns null
play(track, options?)Managed playback of a track. With no argument, starts the next track
play(source)Raw playback of a Remedia media source. It does not use the queue
stopSession()Stop the raw session audio
skip(), skipTo(), jump(), stop()Delegates to the queue

Prefer the queue methods for commands. They keep history, repeat, and events consistent.

Continue reading

Events

On this page