Discord Player
Migrate from v7

API changes

v7 APIs and their v8 equivalents.

You are reading the v8 docsDev

Mapping

v7v8Notes
new Player(client)new Player({ nodes, send, plugins })Discord Player no longer needs a client
Client wiringplayer.receive(rawPacket)You forward raw gateway packets
Ready on constructionawait player.initialize(botUserId)Finish before any playback
player.nodesplayer.nodesStill the queue manager
Extractor dispatcherplayer.pluginsSource operations are the main API
player.extractors.register(Extractor)Same callA wrapper adapts the extractor to a plugin
DefaultExtractors bundleRegister sources yourselfv8 has no built-in providers
player.play(channel, query)player.play(channel, resource)The channel needs a guild and channel ID. String queries need a plugin
queue.node.play(track)queue.play(track)queue.node.play(track) still works. A native source plays raw without the queue
Filter and dispatcher classesqueue.node.filtersNamed presets and raw FFmpeg graphs
Raw PCM and Opus streamsRemedia media sourcesThe engine owns codecs and voice
Queue volumequeue.node.setVolume(0..200)A percentage. 100 is the default
track.toJSON() for storageserialize() and deserialize()Versioned and validated
Context hooksplayer.context.provide({ guildId }, fn)Per Player
player.destroy()await player.destroy()Wait for the native sessions to close

Channels

player.play() accepts anything with an id and a guild, or explicit IDs:

await player.play({ guildId, channelId }, result);
await player.play(voiceChannel, result); // discord.js channel
await player.play(channelId, result, { guildId }); // Channel ID with an explicit guild

This keeps Discord Player independent from any one Discord library.

Playback option groups

Search settings retain the v7 shape. Queue initialization defaults belong in nodeOptions, and connection/session overrides belong in connectionOptions:

await player.play(channel, resource, {
  requestedBy: user,
  searchEngine: 'auto',
  nodeOptions: {
    metadata: { textChannel },
    lifecycle: {
      leaveOnEmpty: true,
      leaveOnEmptyCooldown: 60_000,
    },
    playback: {
      volume: 80,
    },
  },
  connectionOptions: {
    selfDeaf: true,
    selfMute: false,
    connectTimeoutMs: 30_000,
    nodeId: 'remote',
  },
  customMetadata: { requestId },
  signal,
});

Earlier v8 development builds accepted flat selfDeaf, selfMute, nodeId, connectTimeoutMs, volume, and filterGraph. Move these into connectionOptions; those flat aliases are removed. volume and filterGraph in this group apply immediately to existing sessions as well as new ones. Their nodeOptions counterparts initialize new queues only. Omitting an override retains the existing session value; zero volume and filterGraph: null are explicit overrides. Node placement cannot change for an existing session. enableFallbackSeeking is a creation-only connection setting and rejects attempts to change an existing session.

queue.play(track, { connectionOptions: { channelId, volume: 80 }, signal }) uses the same grouping. Omit connectionOptions.channelId to configure the existing channel. queue.connect({ channelId, volume: 80, signal }) stays flat. Raw Remedia sessions retain their native flat options and linear volume units.

Queue metadata and generation metadata are independent. player.play<QueueMetadata, GenerationMetadata>() types them separately. customMetadata and signal apply to playback started by the call; they are not retained on a future queued occurrence when another track is already active. Cancellation propagates through search, lock waiting, voice negotiation, source preparation, and playback. Connection controls already applied before cancellation are retained.

For twlite/music-bot, move the flat selfDeaf: true in apps/music-bot/src/app/commands/play.ts to connectionOptions: { selfDeaf: true } when updating its published v8 development dependency. Keep queueDefaults(...) and queue metadata under nodeOptions. Its /join call to queue.connect() and raw effect/session calls remain flat. The Discord Player test bot demonstrates the corrected call.

Queue controls are familiar

const queue = player.getQueue(guildId);

if (!queue) return;

await queue.node.pause();
await queue.node.seek(25_000);
await queue.skip();
await queue.stop();

Calls that reach Remedia are asynchronous. Await them, and handle errors, before you reply.

Events

player.events and its event names are the same. The arguments of events that come from Remedia gain an extra last argument with the original Remedia event.

playerStart, playerFinish, playerSkip, and playerError are separate outcomes. The queue schedules the next track itself, so remove any code that calls playNext() from a finish listener.

See the event reference and the event mapping.

Removed

v8 does not bring back the stream dispatcher, audio resource internals, raw codec format overrides, or custom filter registration. Use source plugins and filters instead.

Continue reading

Migrate extractors

Grouped queue defaults

player.queues.create(), player.createQueue(), and player.play({ nodeOptions }) accept the same GuildQueueOptions:

GroupSettings
connectionOptionsselfDeaf, selfMute, selectNode
playbackvolume, filterGraph, repeatMode, crossfade, stream hooks
historymaxHistorySize, disableHistory
autoplayautoplayTimeoutMs
lifecycleleaveOnEmpty, leaveOnEnd, leaveOnStop, their cooldowns, pauseOnEmpty

metadata and maxSize remain at the queue-options root. Move obsolete flat v8 queue settings into these groups. For example, use nodeOptions: { playback: { volume: 80 }, lifecycle: { leaveOnEnd: true } }. Per-call connectionOptions and queue.connect() retain their existing session settings.

On this page