Events
Every Player and queue event with its arguments, in the order your listener receives them.
| Emitter | Use for |
|---|---|
player.events.on() | Events of one guild queue. The first argument is the queue |
player.on() | Player events, and Remedia node and session events |
The GuildQueueEvents constant lists the queue event names.
player.events.on('playerSkip', (queue, track, reason, description) => {
console.log(queue.guildId, track.title, reason, description);
});Queue events
Arguments are listed after queue. A trailing rawEvent is the original Remedia event.
Queue and tracks
| Event | Arguments |
|---|---|
queueCreate, queueDelete | none |
audioTrackAdd, audioTrackRemove | track |
audioTracksAdd, audioTracksRemove | tracks |
emptyQueue | none |
willPlayTrack | track |
willAutoPlay | tracks, done |
playerTrigger | track, reason |
debug | message |
error | error, rawEvent? |
Playback
| Event | Arguments |
|---|---|
playerStart | track, rawEvent? |
playerFinish | track, rawEvent? |
playerSkip | track, reason, description, rawEvent? |
playerStop | track | null, rawEvent? |
playerError | error, track, rawEvent? |
playerPause, playerResume, playerSeek | rawEvent |
volumeChange | oldVolume, newVolume, rawEvent? |
audioFiltersUpdate | oldGraph, newGraph, rawEvent? |
willAutoPlay needs a listener that calls done(trackOrNull). Without a listener the queue picks a track itself. Skipping, stopping, queue changes, and destruction cancel a pending choice and ignore a late done.
willPlayTrack is informational. To change the source, use a resource hook.
Voice
| Event | Arguments |
|---|---|
connection, connectionDestroyed | none |
disconnect | rawPacket? |
emptyChannel, channelPopulate | none |
voiceStateUpdate | previous | null, current, rawPacket |
voiceConnectionStateChange | previousState, state, rawEvent |
sessionDisposed | rawEvent |
voiceStateUpdate reports Discord member changes. A normalized state has guildId, userId, channelId, and the server mute and suppress flags when available. previous is null when unknown.
voiceConnectionStateChange reports the audio connection. A failed connection emits error with the Remedia event as its second argument.
emptyChannel, channelPopulate, and disconnect come from the queue's own voice tracking and do not depend on Remedia.
Crossfade and staging
| Event | Arguments |
|---|---|
willPrepareNextTrack | track, rawEvent |
stageReady | track | null, rawEvent |
stageFailed | track | null, error, rawEvent? |
stageInvalidated | track | null, rawEvent |
transitionCancelled | track | null, rawEvent |
Preparation is informational and can repeat after a cancel or a retry. It starts before the source is resolved. Staging never fires playerStart. Promotion does. A staging failure does not mean the current track failed.
A null track means the staged track could not be matched reliably.
Sessions and nodes
| Event | Arguments |
|---|---|
sessionEvent | name, rawEvent |
sessionResumed, sessionLost | rawEvent |
guildAssigned, guildReleased, guildMigrated | rawEvent |
sessionEvent reports every Remedia session event, including stale ones, before the queue processes them. It never changes queue state.
The guild events go only to queues that already exist.
Native event types
The trailing rawEvent types come from @remedia/client:
| Queue event | Remedia type |
|---|---|
willPrepareNextTrack | DiscordSessionEvents['prepareRequested'][0] |
stageReady | DiscordSessionEvents['stageReady'][0] |
stageFailed | DiscordSessionEvents['stageFailed'][0] |
stageInvalidated | DiscordSessionEvents['stageInvalidated'][0] |
transitionCancelled | DiscordSessionEvents['transitionCancelled'][0] |
sessionDisposed | DiscordSessionEvents['sessionDisposed'][0] |
audioFiltersUpdate | DiscordSessionEvents['filterChanged'][0] |
voiceConnectionStateChange | DiscordSessionEvents['voiceStateChanged'][0] |
error from a voice failure | DiscordSessionEvents['voiceFailed'][0] |
sessionResumed, sessionLost, guildAssigned, guildReleased, guildMigrated | The matching RemediaClientEvents payload |
Discord Player exports both DiscordSessionEvents and RemediaClientEvents as types.
Application-owned changes, such as adding a track or queueCreate, have no Remedia event, so none is added.
Remedia events on the player
player.on() receives every RemediaClientEvents event with its unchanged arguments:
nodeConnected, nodeDisconnected, sessionResumed, sessionLost, nodeEvent, eventsLost, guildAssigned, guildReleased, guildMigrated, plus the Remedia playback and voice session events.
It also emits debug, error, and voiceStateUpdate(guildId, packet).
player.on('nodeDisconnected', ({ node, error }) => {
console.warn(`Node ${node.id} disconnected`, error);
});Player events describe the whole client. Queue events describe one guild's queue. They are separate scopes, so a Remedia playback event can appear on both.
Continue reading
Plugins