@kattowo/distube 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { Snowflake, Message, GuildTextBasedChannel, VoiceBasedChannel, VoiceState, Guild, GuildMember, Interaction, Collection, Client, ClientOptions } from 'discord.js';
2
+ import { VoiceBasedChannel, Snowflake, Message, GuildTextBasedChannel, VoiceState, Guild, GuildMember, Interaction, Collection, Client, ClientOptions } from 'discord.js';
3
3
  import { AudioResource, AudioPlayer, VoiceConnection } from '@discordjs/voice';
4
4
  import { TypedEmitter } from 'tiny-typed-emitter';
5
5
  import { ChildProcess } from 'node:child_process';
@@ -83,7 +83,51 @@ declare enum Events {
83
83
  /**
84
84
  * Emitted to provide debug information from DisTube's operation.
85
85
  */
86
- DEBUG = "debug"
86
+ DEBUG = "debug",
87
+ /**
88
+ * Emitted when a guild stream is paused.
89
+ */
90
+ PAUSE_SONG = "pauseSong",
91
+ /**
92
+ * Emitted when a paused guild stream is resumed.
93
+ */
94
+ RESUME_SONG = "resumeSong",
95
+ /**
96
+ * Emitted when a guild stream is seeked to a new position.
97
+ */
98
+ SEEK_SONG = "seekSong",
99
+ /**
100
+ * Emitted when the volume of a guild stream is changed.
101
+ */
102
+ SET_VOLUME = "setVolume",
103
+ /**
104
+ * Emitted after the songs of a {@link Queue} have been shuffled.
105
+ */
106
+ SHUFFLE_QUEUE = "shuffleQueue",
107
+ /**
108
+ * Emitted when a song is skipped.
109
+ */
110
+ SKIP_SONG = "skipSong",
111
+ /**
112
+ * Emitted when the audio filters of a {@link Queue} are changed.
113
+ */
114
+ CHANGE_FILTER = "changeFilter",
115
+ /**
116
+ * Emitted when the bot is moved to another voice channel.
117
+ */
118
+ VOICE_CHANNEL_CHANGE = "voiceChannelChange",
119
+ /**
120
+ * Emitted when DisTube starts pre-buffering / pre-fetching the next song in a {@link Queue}.
121
+ */
122
+ PRELOAD_SONG = "preloadSong",
123
+ /**
124
+ * Emitted when the next song in a {@link Queue} has been pre-buffered and is ready.
125
+ */
126
+ PRELOADED_SONG = "preloadedSong",
127
+ /**
128
+ * Emitted when pre-buffering the next song in a {@link Queue} fails.
129
+ */
130
+ PRELOAD_ERROR = "preloadError"
87
131
  }
88
132
  /**
89
133
  * The arguments of every {@link Events} event.
@@ -146,6 +190,50 @@ type DisTubeEvents = {
146
190
  * Emitted when a song starts playing.
147
191
  */
148
192
  [Events.PLAY_SONG]: [queue: Queue, song: Song];
193
+ /**
194
+ * Emitted when a guild stream is paused.
195
+ */
196
+ [Events.PAUSE_SONG]: [queue: Queue, song: Song];
197
+ /**
198
+ * Emitted when a paused guild stream is resumed.
199
+ */
200
+ [Events.RESUME_SONG]: [queue: Queue, song: Song];
201
+ /**
202
+ * Emitted when a guild stream is seeked to a new position.
203
+ */
204
+ [Events.SEEK_SONG]: [queue: Queue, song: Song, position: number];
205
+ /**
206
+ * Emitted when the volume of a guild stream is changed.
207
+ */
208
+ [Events.SET_VOLUME]: [queue: Queue, volume: number, oldVolume: number];
209
+ /**
210
+ * Emitted after the songs of a {@link Queue} have been shuffled.
211
+ */
212
+ [Events.SHUFFLE_QUEUE]: [queue: Queue, songs: Song[]];
213
+ /**
214
+ * Emitted when a song is skipped.
215
+ */
216
+ [Events.SKIP_SONG]: [queue: Queue, song: Song];
217
+ /**
218
+ * Emitted when the audio filters of a {@link Queue} are changed.
219
+ */
220
+ [Events.CHANGE_FILTER]: [queue: Queue, newFilters: string[], oldFilters: string[]];
221
+ /**
222
+ * Emitted when the bot is moved to another voice channel.
223
+ */
224
+ [Events.VOICE_CHANNEL_CHANGE]: [queue: Queue, oldChannel: VoiceBasedChannel, newChannel: VoiceBasedChannel];
225
+ /**
226
+ * Emitted when DisTube starts pre-buffering / pre-fetching the next song in a {@link Queue}.
227
+ */
228
+ [Events.PRELOAD_SONG]: [queue: Queue, song: Song];
229
+ /**
230
+ * Emitted when the next song in a {@link Queue} has been pre-buffered and is ready.
231
+ */
232
+ [Events.PRELOADED_SONG]: [queue: Queue, song: Song];
233
+ /**
234
+ * Emitted when pre-buffering the next song in a {@link Queue} fails.
235
+ */
236
+ [Events.PRELOAD_ERROR]: [queue: Queue, song: Song, error: Error];
149
237
  };
150
238
  /**
151
239
  * The typed event listeners of a {@link DisTube} instance.
@@ -174,6 +262,12 @@ type DisTubeVoiceEvents = {
174
262
  * Emitted when the audio player becomes idle, i.e. the song is finished.
175
263
  */
176
264
  finish: () => Awaitable;
265
+ /**
266
+ * Emitted when the connection moves to another voice channel.
267
+ * @param oldChannel - The previous voice channel
268
+ * @param newChannel - The new voice channel
269
+ */
270
+ channelChange: (oldChannel: VoiceBasedChannel, newChannel: VoiceBasedChannel) => Awaitable;
177
271
  };
178
272
  /**
179
273
  * An FFmpeg audio filter object
@@ -213,6 +307,20 @@ type FilterResolvable = string | Filter;
213
307
  * @see {@link defaultFilters}
214
308
  */
215
309
  type Filters = Record<string, string>;
310
+ /**
311
+ * The validated {@link DisTubeOptions.preload} options of a {@link DisTube} instance.
312
+ */
313
+ type PreloadOptions = {
314
+ /**
315
+ * Whether or not preloading is enabled.
316
+ */
317
+ enabled: boolean;
318
+ /**
319
+ * The number of seconds remaining in the currently playing song before
320
+ * preloading starts.
321
+ */
322
+ threshold: number;
323
+ };
216
324
  /**
217
325
  * DisTube options
218
326
  */
@@ -276,6 +384,29 @@ type DisTubeOptions = {
276
384
  * @default 10000
277
385
  */
278
386
  stuckThreshold?: number;
387
+ /**
388
+ * Pre-fetch stream information and prepare the stream for the next song in
389
+ * the queue before the current song finishes playing, to reduce the delay
390
+ * between two songs.
391
+ *
392
+ * Can be a simple `boolean` to toggle it with the default threshold, or an
393
+ * object to configure it:
394
+ * - `enabled`: whether or not preloading is enabled (@default false)
395
+ * - `threshold`: the number of seconds remaining in the currently playing
396
+ * song before preloading starts (@default 15)
397
+ * @default false
398
+ */
399
+ preload?: boolean | {
400
+ /**
401
+ * Whether or not preloading is enabled.
402
+ */
403
+ enabled?: boolean;
404
+ /**
405
+ * The number of seconds remaining in the currently playing song before
406
+ * preloading starts.
407
+ */
408
+ threshold?: number;
409
+ };
279
410
  /**
280
411
  * FFmpeg options
281
412
  */
@@ -714,6 +845,10 @@ declare const MAX_REDIRECT_DEPTH = 5;
714
845
  * Default DisTube audio filters.
715
846
  */
716
847
  declare const defaultFilters: Filters;
848
+ /**
849
+ * Default number of seconds remaining in the currently playing song before preloading starts.
850
+ */
851
+ declare const DEFAULT_PRELOAD_THRESHOLD_SECS = 15;
717
852
  /**
718
853
  * The default options of a {@link DisTube} instance.
719
854
  *
@@ -730,6 +865,7 @@ declare const defaultOptions: {
730
865
  joinNewVoiceChannel: true;
731
866
  unhandledError: "log";
732
867
  stuckThreshold: number;
868
+ preload: false;
733
869
  };
734
870
 
735
871
  /**
@@ -1112,6 +1248,11 @@ declare class Options {
1112
1248
  * @default 10000
1113
1249
  */
1114
1250
  stuckThreshold: number;
1251
+ /**
1252
+ * The preload options of the DisTube instance.
1253
+ * @default { enabled: false, threshold: 15 }
1254
+ */
1255
+ preload: PreloadOptions;
1115
1256
  /**
1116
1257
  * The FFmpeg options of the DisTube instance.
1117
1258
  */
@@ -1477,6 +1618,16 @@ declare class QueueManager extends GuildIdManager<Queue> {
1477
1618
  playSong(queue: Queue, emitPlaySong?: boolean, options?: {
1478
1619
  keepSongOnError?: boolean;
1479
1620
  }): Promise<void>;
1621
+ /**
1622
+ * Schedule preloading the next song in the queue before the current song finishes.
1623
+ * @param queue - The guild queue
1624
+ */
1625
+ schedulePreload(queue: Queue): void;
1626
+ /**
1627
+ * Preload the next song in the queue.
1628
+ * @param queue - The guild queue
1629
+ */
1630
+ preloadNextSong(queue: Queue): Promise<void>;
1480
1631
  }
1481
1632
 
1482
1633
  /**
@@ -2224,6 +2375,37 @@ declare class Queue extends DisTubeBase {
2224
2375
  * @internal
2225
2376
  */
2226
2377
  _listeners?: DisTubeVoiceEvents;
2378
+ /**
2379
+ * Preload timer
2380
+ * @internal
2381
+ */
2382
+ _preloadTimeout?: NodeJS.Timeout;
2383
+ /**
2384
+ * Preloaded song
2385
+ * @internal
2386
+ */
2387
+ _preloadedSong?: Song;
2388
+ /**
2389
+ * Preloaded stream
2390
+ * @internal
2391
+ */
2392
+ _preloadedStream?: DisTubeStream;
2393
+ /**
2394
+ * In-flight preload task
2395
+ * @internal
2396
+ */
2397
+ _preloading?: Promise<void>;
2398
+ /**
2399
+ * Bumped whenever the preloaded state is invalidated, so an in-flight
2400
+ * preload task can detect that its result is no longer needed.
2401
+ * @internal
2402
+ */
2403
+ _preloadGeneration: number;
2404
+ /**
2405
+ * Clear any preloaded song and cancel pending preload timer.
2406
+ * @internal
2407
+ */
2408
+ _clearPreload(): void;
2227
2409
  /**
2228
2410
  * Create a queue for the guild
2229
2411
  * @param distube - DisTube
@@ -3256,5 +3438,5 @@ declare function handleUnhandledError(error: Error, behavior?: UnhandledErrorBeh
3256
3438
  */
3257
3439
  declare const checkEncryptionLibraries: () => Promise<boolean>;
3258
3440
 
3259
- export { AUDIO_CHANNELS, AUDIO_SAMPLE_RATE, BaseManager, DEFAULT_VOLUME, DisTube, DisTubeBase, DisTubeError, DisTubeHandler, DisTubeStream, DisTubeVoice, DisTubeVoiceManager, Events, ExtractorPlugin, FilterManager, GuildIdManager, HTTP_REDIRECT_CODES, InfoExtractorPlugin, JOIN_TIMEOUT_MS, MAX_REDIRECT_DEPTH, Options, PlayableExtractorPlugin, Playlist, Plugin, PluginError, PluginErrorCode, PluginType, Queue, QueueManager, RECONNECT_MAX_ATTEMPTS, RECONNECT_TIMEOUT_MS, RepeatMode, STUCK_THRESHOLD_MS, SearchResult, SearchResultType, Song, StreamServer, TaskQueue, checkEncryptionLibraries, checkFFmpeg, checkIntents, checkInvalidKey, DisTube as default, defaultFilters, defaultOptions, formatDuration, handleUnhandledError, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isNsfwChannel, isObject, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isTruthy, isURL, isVoiceChannelEmpty, objectKeys, resolveGuildId, version };
3260
- export type { Awaitable, CustomPlaylistOptions, DisTubeEvents, DisTubeOptions, DisTubePlugin, DisTubeVoiceEvents, Disposable, FFmpegArg, FFmpegArgs, FFmpegOptions, Falsy, Filter, FilterResolvable, Filters, GuildIdResolvable, JumpOptions, KeyOf, PlayHandlerOptions, PlayOptions, PlaylistInfo, RelatedSong, ResolveOptions, ResolvePlaylistOptions, SearchOptions, SongInfo, StreamHandler, StreamOptions, StreamRequest, StreamResponse, StreamServerOptions, TypedDisTubeEvents, UnhandledErrorBehavior };
3441
+ export { AUDIO_CHANNELS, AUDIO_SAMPLE_RATE, BaseManager, DEFAULT_PRELOAD_THRESHOLD_SECS, DEFAULT_VOLUME, DisTube, DisTubeBase, DisTubeError, DisTubeHandler, DisTubeStream, DisTubeVoice, DisTubeVoiceManager, Events, ExtractorPlugin, FilterManager, GuildIdManager, HTTP_REDIRECT_CODES, InfoExtractorPlugin, JOIN_TIMEOUT_MS, MAX_REDIRECT_DEPTH, Options, PlayableExtractorPlugin, Playlist, Plugin, PluginError, PluginErrorCode, PluginType, Queue, QueueManager, RECONNECT_MAX_ATTEMPTS, RECONNECT_TIMEOUT_MS, RepeatMode, STUCK_THRESHOLD_MS, SearchResult, SearchResultType, Song, StreamServer, TaskQueue, checkEncryptionLibraries, checkFFmpeg, checkIntents, checkInvalidKey, DisTube as default, defaultFilters, defaultOptions, formatDuration, handleUnhandledError, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isNsfwChannel, isObject, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isTruthy, isURL, isVoiceChannelEmpty, objectKeys, resolveGuildId, version };
3442
+ export type { Awaitable, CustomPlaylistOptions, DisTubeEvents, DisTubeOptions, DisTubePlugin, DisTubeVoiceEvents, Disposable, FFmpegArg, FFmpegArgs, FFmpegOptions, Falsy, Filter, FilterResolvable, Filters, GuildIdResolvable, JumpOptions, KeyOf, PlayHandlerOptions, PlayOptions, PlaylistInfo, PreloadOptions, RelatedSong, ResolveOptions, ResolvePlaylistOptions, SearchOptions, SongInfo, StreamHandler, StreamOptions, StreamRequest, StreamResponse, StreamServerOptions, TypedDisTubeEvents, UnhandledErrorBehavior };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { Snowflake, Message, GuildTextBasedChannel, VoiceBasedChannel, VoiceState, Guild, GuildMember, Interaction, Collection, Client, ClientOptions } from 'discord.js';
2
+ import { VoiceBasedChannel, Snowflake, Message, GuildTextBasedChannel, VoiceState, Guild, GuildMember, Interaction, Collection, Client, ClientOptions } from 'discord.js';
3
3
  import { AudioResource, AudioPlayer, VoiceConnection } from '@discordjs/voice';
4
4
  import { TypedEmitter } from 'tiny-typed-emitter';
5
5
  import { ChildProcess } from 'node:child_process';
@@ -83,7 +83,51 @@ declare enum Events {
83
83
  /**
84
84
  * Emitted to provide debug information from DisTube's operation.
85
85
  */
86
- DEBUG = "debug"
86
+ DEBUG = "debug",
87
+ /**
88
+ * Emitted when a guild stream is paused.
89
+ */
90
+ PAUSE_SONG = "pauseSong",
91
+ /**
92
+ * Emitted when a paused guild stream is resumed.
93
+ */
94
+ RESUME_SONG = "resumeSong",
95
+ /**
96
+ * Emitted when a guild stream is seeked to a new position.
97
+ */
98
+ SEEK_SONG = "seekSong",
99
+ /**
100
+ * Emitted when the volume of a guild stream is changed.
101
+ */
102
+ SET_VOLUME = "setVolume",
103
+ /**
104
+ * Emitted after the songs of a {@link Queue} have been shuffled.
105
+ */
106
+ SHUFFLE_QUEUE = "shuffleQueue",
107
+ /**
108
+ * Emitted when a song is skipped.
109
+ */
110
+ SKIP_SONG = "skipSong",
111
+ /**
112
+ * Emitted when the audio filters of a {@link Queue} are changed.
113
+ */
114
+ CHANGE_FILTER = "changeFilter",
115
+ /**
116
+ * Emitted when the bot is moved to another voice channel.
117
+ */
118
+ VOICE_CHANNEL_CHANGE = "voiceChannelChange",
119
+ /**
120
+ * Emitted when DisTube starts pre-buffering / pre-fetching the next song in a {@link Queue}.
121
+ */
122
+ PRELOAD_SONG = "preloadSong",
123
+ /**
124
+ * Emitted when the next song in a {@link Queue} has been pre-buffered and is ready.
125
+ */
126
+ PRELOADED_SONG = "preloadedSong",
127
+ /**
128
+ * Emitted when pre-buffering the next song in a {@link Queue} fails.
129
+ */
130
+ PRELOAD_ERROR = "preloadError"
87
131
  }
88
132
  /**
89
133
  * The arguments of every {@link Events} event.
@@ -146,6 +190,50 @@ type DisTubeEvents = {
146
190
  * Emitted when a song starts playing.
147
191
  */
148
192
  [Events.PLAY_SONG]: [queue: Queue, song: Song];
193
+ /**
194
+ * Emitted when a guild stream is paused.
195
+ */
196
+ [Events.PAUSE_SONG]: [queue: Queue, song: Song];
197
+ /**
198
+ * Emitted when a paused guild stream is resumed.
199
+ */
200
+ [Events.RESUME_SONG]: [queue: Queue, song: Song];
201
+ /**
202
+ * Emitted when a guild stream is seeked to a new position.
203
+ */
204
+ [Events.SEEK_SONG]: [queue: Queue, song: Song, position: number];
205
+ /**
206
+ * Emitted when the volume of a guild stream is changed.
207
+ */
208
+ [Events.SET_VOLUME]: [queue: Queue, volume: number, oldVolume: number];
209
+ /**
210
+ * Emitted after the songs of a {@link Queue} have been shuffled.
211
+ */
212
+ [Events.SHUFFLE_QUEUE]: [queue: Queue, songs: Song[]];
213
+ /**
214
+ * Emitted when a song is skipped.
215
+ */
216
+ [Events.SKIP_SONG]: [queue: Queue, song: Song];
217
+ /**
218
+ * Emitted when the audio filters of a {@link Queue} are changed.
219
+ */
220
+ [Events.CHANGE_FILTER]: [queue: Queue, newFilters: string[], oldFilters: string[]];
221
+ /**
222
+ * Emitted when the bot is moved to another voice channel.
223
+ */
224
+ [Events.VOICE_CHANNEL_CHANGE]: [queue: Queue, oldChannel: VoiceBasedChannel, newChannel: VoiceBasedChannel];
225
+ /**
226
+ * Emitted when DisTube starts pre-buffering / pre-fetching the next song in a {@link Queue}.
227
+ */
228
+ [Events.PRELOAD_SONG]: [queue: Queue, song: Song];
229
+ /**
230
+ * Emitted when the next song in a {@link Queue} has been pre-buffered and is ready.
231
+ */
232
+ [Events.PRELOADED_SONG]: [queue: Queue, song: Song];
233
+ /**
234
+ * Emitted when pre-buffering the next song in a {@link Queue} fails.
235
+ */
236
+ [Events.PRELOAD_ERROR]: [queue: Queue, song: Song, error: Error];
149
237
  };
150
238
  /**
151
239
  * The typed event listeners of a {@link DisTube} instance.
@@ -174,6 +262,12 @@ type DisTubeVoiceEvents = {
174
262
  * Emitted when the audio player becomes idle, i.e. the song is finished.
175
263
  */
176
264
  finish: () => Awaitable;
265
+ /**
266
+ * Emitted when the connection moves to another voice channel.
267
+ * @param oldChannel - The previous voice channel
268
+ * @param newChannel - The new voice channel
269
+ */
270
+ channelChange: (oldChannel: VoiceBasedChannel, newChannel: VoiceBasedChannel) => Awaitable;
177
271
  };
178
272
  /**
179
273
  * An FFmpeg audio filter object
@@ -213,6 +307,20 @@ type FilterResolvable = string | Filter;
213
307
  * @see {@link defaultFilters}
214
308
  */
215
309
  type Filters = Record<string, string>;
310
+ /**
311
+ * The validated {@link DisTubeOptions.preload} options of a {@link DisTube} instance.
312
+ */
313
+ type PreloadOptions = {
314
+ /**
315
+ * Whether or not preloading is enabled.
316
+ */
317
+ enabled: boolean;
318
+ /**
319
+ * The number of seconds remaining in the currently playing song before
320
+ * preloading starts.
321
+ */
322
+ threshold: number;
323
+ };
216
324
  /**
217
325
  * DisTube options
218
326
  */
@@ -276,6 +384,29 @@ type DisTubeOptions = {
276
384
  * @default 10000
277
385
  */
278
386
  stuckThreshold?: number;
387
+ /**
388
+ * Pre-fetch stream information and prepare the stream for the next song in
389
+ * the queue before the current song finishes playing, to reduce the delay
390
+ * between two songs.
391
+ *
392
+ * Can be a simple `boolean` to toggle it with the default threshold, or an
393
+ * object to configure it:
394
+ * - `enabled`: whether or not preloading is enabled (@default false)
395
+ * - `threshold`: the number of seconds remaining in the currently playing
396
+ * song before preloading starts (@default 15)
397
+ * @default false
398
+ */
399
+ preload?: boolean | {
400
+ /**
401
+ * Whether or not preloading is enabled.
402
+ */
403
+ enabled?: boolean;
404
+ /**
405
+ * The number of seconds remaining in the currently playing song before
406
+ * preloading starts.
407
+ */
408
+ threshold?: number;
409
+ };
279
410
  /**
280
411
  * FFmpeg options
281
412
  */
@@ -714,6 +845,10 @@ declare const MAX_REDIRECT_DEPTH = 5;
714
845
  * Default DisTube audio filters.
715
846
  */
716
847
  declare const defaultFilters: Filters;
848
+ /**
849
+ * Default number of seconds remaining in the currently playing song before preloading starts.
850
+ */
851
+ declare const DEFAULT_PRELOAD_THRESHOLD_SECS = 15;
717
852
  /**
718
853
  * The default options of a {@link DisTube} instance.
719
854
  *
@@ -730,6 +865,7 @@ declare const defaultOptions: {
730
865
  joinNewVoiceChannel: true;
731
866
  unhandledError: "log";
732
867
  stuckThreshold: number;
868
+ preload: false;
733
869
  };
734
870
 
735
871
  /**
@@ -1112,6 +1248,11 @@ declare class Options {
1112
1248
  * @default 10000
1113
1249
  */
1114
1250
  stuckThreshold: number;
1251
+ /**
1252
+ * The preload options of the DisTube instance.
1253
+ * @default { enabled: false, threshold: 15 }
1254
+ */
1255
+ preload: PreloadOptions;
1115
1256
  /**
1116
1257
  * The FFmpeg options of the DisTube instance.
1117
1258
  */
@@ -1477,6 +1618,16 @@ declare class QueueManager extends GuildIdManager<Queue> {
1477
1618
  playSong(queue: Queue, emitPlaySong?: boolean, options?: {
1478
1619
  keepSongOnError?: boolean;
1479
1620
  }): Promise<void>;
1621
+ /**
1622
+ * Schedule preloading the next song in the queue before the current song finishes.
1623
+ * @param queue - The guild queue
1624
+ */
1625
+ schedulePreload(queue: Queue): void;
1626
+ /**
1627
+ * Preload the next song in the queue.
1628
+ * @param queue - The guild queue
1629
+ */
1630
+ preloadNextSong(queue: Queue): Promise<void>;
1480
1631
  }
1481
1632
 
1482
1633
  /**
@@ -2224,6 +2375,37 @@ declare class Queue extends DisTubeBase {
2224
2375
  * @internal
2225
2376
  */
2226
2377
  _listeners?: DisTubeVoiceEvents;
2378
+ /**
2379
+ * Preload timer
2380
+ * @internal
2381
+ */
2382
+ _preloadTimeout?: NodeJS.Timeout;
2383
+ /**
2384
+ * Preloaded song
2385
+ * @internal
2386
+ */
2387
+ _preloadedSong?: Song;
2388
+ /**
2389
+ * Preloaded stream
2390
+ * @internal
2391
+ */
2392
+ _preloadedStream?: DisTubeStream;
2393
+ /**
2394
+ * In-flight preload task
2395
+ * @internal
2396
+ */
2397
+ _preloading?: Promise<void>;
2398
+ /**
2399
+ * Bumped whenever the preloaded state is invalidated, so an in-flight
2400
+ * preload task can detect that its result is no longer needed.
2401
+ * @internal
2402
+ */
2403
+ _preloadGeneration: number;
2404
+ /**
2405
+ * Clear any preloaded song and cancel pending preload timer.
2406
+ * @internal
2407
+ */
2408
+ _clearPreload(): void;
2227
2409
  /**
2228
2410
  * Create a queue for the guild
2229
2411
  * @param distube - DisTube
@@ -3258,5 +3440,5 @@ declare const checkEncryptionLibraries: () => Promise<boolean>;
3258
3440
 
3259
3441
  // @ts-ignore
3260
3442
  export = DisTube;
3261
- export { AUDIO_CHANNELS, AUDIO_SAMPLE_RATE, BaseManager, DEFAULT_VOLUME, DisTube, DisTubeBase, DisTubeError, DisTubeHandler, DisTubeStream, DisTubeVoice, DisTubeVoiceManager, Events, ExtractorPlugin, FilterManager, GuildIdManager, HTTP_REDIRECT_CODES, InfoExtractorPlugin, JOIN_TIMEOUT_MS, MAX_REDIRECT_DEPTH, Options, PlayableExtractorPlugin, Playlist, Plugin, PluginError, PluginErrorCode, PluginType, Queue, QueueManager, RECONNECT_MAX_ATTEMPTS, RECONNECT_TIMEOUT_MS, RepeatMode, STUCK_THRESHOLD_MS, SearchResult, SearchResultType, Song, StreamServer, TaskQueue, checkEncryptionLibraries, checkFFmpeg, checkIntents, checkInvalidKey, defaultFilters, defaultOptions, formatDuration, handleUnhandledError, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isNsfwChannel, isObject, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isTruthy, isURL, isVoiceChannelEmpty, objectKeys, resolveGuildId, version };
3262
- export type { Awaitable, CustomPlaylistOptions, DisTubeEvents, DisTubeOptions, DisTubePlugin, DisTubeVoiceEvents, Disposable, FFmpegArg, FFmpegArgs, FFmpegOptions, Falsy, Filter, FilterResolvable, Filters, GuildIdResolvable, JumpOptions, KeyOf, PlayHandlerOptions, PlayOptions, PlaylistInfo, RelatedSong, ResolveOptions, ResolvePlaylistOptions, SearchOptions, SongInfo, StreamHandler, StreamOptions, StreamRequest, StreamResponse, StreamServerOptions, TypedDisTubeEvents, UnhandledErrorBehavior };
3443
+ export { AUDIO_CHANNELS, AUDIO_SAMPLE_RATE, BaseManager, DEFAULT_PRELOAD_THRESHOLD_SECS, DEFAULT_VOLUME, DisTube, DisTubeBase, DisTubeError, DisTubeHandler, DisTubeStream, DisTubeVoice, DisTubeVoiceManager, Events, ExtractorPlugin, FilterManager, GuildIdManager, HTTP_REDIRECT_CODES, InfoExtractorPlugin, JOIN_TIMEOUT_MS, MAX_REDIRECT_DEPTH, Options, PlayableExtractorPlugin, Playlist, Plugin, PluginError, PluginErrorCode, PluginType, Queue, QueueManager, RECONNECT_MAX_ATTEMPTS, RECONNECT_TIMEOUT_MS, RepeatMode, STUCK_THRESHOLD_MS, SearchResult, SearchResultType, Song, StreamServer, TaskQueue, checkEncryptionLibraries, checkFFmpeg, checkIntents, checkInvalidKey, defaultFilters, defaultOptions, formatDuration, handleUnhandledError, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isNsfwChannel, isObject, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isTruthy, isURL, isVoiceChannelEmpty, objectKeys, resolveGuildId, version };
3444
+ export type { Awaitable, CustomPlaylistOptions, DisTubeEvents, DisTubeOptions, DisTubePlugin, DisTubeVoiceEvents, Disposable, FFmpegArg, FFmpegArgs, FFmpegOptions, Falsy, Filter, FilterResolvable, Filters, GuildIdResolvable, JumpOptions, KeyOf, PlayHandlerOptions, PlayOptions, PlaylistInfo, PreloadOptions, RelatedSong, ResolveOptions, ResolvePlaylistOptions, SearchOptions, SongInfo, StreamHandler, StreamOptions, StreamRequest, StreamResponse, StreamServerOptions, TypedDisTubeEvents, UnhandledErrorBehavior };