NodeLink Playback
Examples assume an initialized manager, a connected NodeLink player, and playable
Track values loaded from a supported source. Check player.node.isNodeLink
before exposing native actions.
Playback Extrasโ
await player.play(track, {
audioTrackId: "en",
loudnessNormalizer: true,
});
await player.setNodeLinkLoudnessNormalizer(false);
audioTrackId selects a source-specific audio track; do not assume the example
ID exists on every track. The legacy language play option is also supported.
These options are rejected on Lavalink. Standard startTime, endTime,
and noReplace options remain available.
See PlayOptions and RestPlayOptions.
Gapless Preloadingโ
await player.queue.add(nextTrack);
await player.preloadNextTrack(nextTrack);
// Cancel the server-side preload without removing local queued tracks.
await player.preloadNextTrack(null);
Preloading does not add the track to the local queue. Keep the local queue's
next entry aligned with the track you preload on NodeLink. The optional second
argument accepts audioTrackId or legacy language.
A gapless track-end event means NodeLink is already starting its preloaded
track. Magmastream advances the local queue without submitting a second play
request. The end reason is exposed as TrackEndReasonTypes.Gapless.
The helper does not automatically schedule all subsequent preloads, and changing the queue/repeat mode can invalidate a preload. Update or clear it when the next local track changes.
Fadingโ
await player.setNodeLinkFading({
enabled: true,
trackStart: { duration: 300, curve: "linear", type: "volume" },
trackEnd: { duration: 600, curve: "linear", type: "volume" },
pause: { duration: 150, type: "volume" },
resume: { duration: 150, type: "volume" },
});
Durations are milliseconds. Sections can also configure trackStop and seek.
Supported action types are volume, tape, scratch, and both; accepted
curves and their behavior are backend-defined.
Disable with await player.setNodeLinkFading({ enabled: false }).
See NodeLinkFadingConfig.
Audio Mixerโ
Mixer layers overlay audio on current playback rather than enqueueing the track. The server must support mixing, and a main track must be active.
const mix = await player.addNodeLinkMix(overlayTrack, 0.25);
const activeMixes = await player.getNodeLinkMixes();
await player.updateNodeLinkMix(mix.id, 0.5);
await player.removeNodeLinkMix(mix.id);
Mix volume is a 0 to 1 multiplier. Main player volume remains a 0 to 1000
value through player.setVolume() (0-500 when applyVolumeAsFilter is enabled).
Do not reuse the main-volume scale for layers.
| Preferred explicit name | Equivalent short alias |
|---|---|
addNodeLinkMix(track, volume?) | addMix(track, volume?) |
getNodeLinkMixes() | getMixes() |
updateNodeLinkMix(id, volume) | updateMix(id, volume) |
removeNodeLinkMix(id) | removeMix(id) |
The same operations are available on Node with the player as the first
argument. mixStarted and mixEnded manager events carry the native payload;
see ManagerEvents.
Low-Level Updatesโ
await player.node.rest.updatePlayer({
guildId: player.guildId,
data: {
fading: { enabled: false },
loudnessNormalizer: true,
},
});
Prefer the player helpers for queue-aware behavior. Raw REST calls do not automatically update the local queue. NodeLink-only fields are checked before sending to a Lavalink node; the request is not moved to another backend.