Skip to content

DisTubeOptions

type DisTubeOptions = object;

DisTube options

autoplayAttempts?: number;

The number of times in a row that autoplay items may fail to prepare or stream before autoplay gives up. When an attempt fails, another related song from the same seed is queried.

3

crossfade?: object;

Crossfade the end of the current song with the beginning of the next one, instead of a hard switch between two streams.

The transition is a single FFmpeg process that mixes both songs with an acrossfade filter, so the fade is seamless (no gaps, no extra decode round-trips). Because the fade length must be prepared in advance, the next song’s stream is resolved even when preloading is disabled.

Can be an object to configure it:

  • duration: the default crossfade duration in seconds for new queues (@default 0). Each Queue can override it at runtime with its crossfade property, which is what bots typically bind to a guild setting.
  • curve: the FFmpeg acrossfade fade curve (@default “qsin”)
  • warmup: seconds before the fade window when the transition stream is spawned to warm up its buffers (@default 5)
  • preparePrimaryInput: an optional adapter preparing the fading-out song’s FFmpeg input before the transition stream is spawned. Useful for streaming inputs that cannot fast-seek (CrossfadeOptions.preparePrimaryInput).
curve?: string;

The FFmpeg acrossfade fade curve applied to both songs.

duration?: number;

The default crossfade duration (in seconds) for new queues (0 disables).

preparePrimaryInput?: PrepareCrossfadeInput;

Optional adapter preparing the fading-out song’s FFmpeg input (CrossfadeOptions.preparePrimaryInput).

warmup?: number;

Seconds before the fade window when the transition stream is spawned.

{ duration: 0, curve: "qsin", warmup: 5 }

customFilters?: Filters;

Override defaultFilters or add more ffmpeg filters


emitAddListWhenCreatingQueue?: boolean;

Whether or not emitting addList event when creating a new Queue

true

emitAddSongWhenCreatingQueue?: boolean;

Whether or not emitting addSong event when creating a new Queue

true

emitNewSongOnly?: boolean;

Whether or not emitting Events.PLAY_SONG event when looping a song or next song is the same as the previous one

false

ffmpeg?: object;

FFmpeg options

args?: Partial<FFmpegArgs>;

FFmpeg default arguments

path?: string;

FFmpeg path


joinNewVoiceChannel?: boolean;

Whether or not joining the new voice channel when using DisTube#play method

true

nsfw?: boolean;

Whether or not playing age-restricted content and disabling safe search in non-NSFW channel

false

plugins?: DisTubePlugin[];

DisTube plugins. The order of this effects the priority of the plugins when verifying the input.


preload?:
| boolean
| {
enabled?: boolean;
threshold?: number;
};

Pre-fetch stream information and prepare the stream for the next song in the queue before the current song finishes playing, to reduce the delay between two songs.

Can be a simple boolean to toggle it with the default threshold, or an object to configure it:

  • enabled: whether or not preloading is enabled (@default false)
  • threshold: the number of seconds remaining in the currently playing song before preloading starts (@default 15)

boolean


{
enabled?: boolean;
threshold?: number;
}
enabled?: boolean;

Whether or not preloading is enabled.

threshold?: number;

The number of seconds remaining in the currently playing song before preloading starts.

false

savePreviousSongs?: boolean;

Whether or not saving the previous songs of the queue and enable Queue#previous method. Disable it may help to reduce the memory usage

true

stuckThreshold?: number;

Time (in milliseconds) a track may stay in the “buffering” state before it is considered stuck and gets skipped automatically.

Set to 0 to disable the stuck-track detection.

10000

unhandledError?: UnhandledErrorBehavior;

Behavior when the Events.ERROR event is emitted but nobody listens to it.

By default ("log"), the error is logged to the console instead of crashing the process, which is the Node.js default behavior for the special "error" event.

"log"