diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index b391ea7..01d243e 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -105,7 +105,8 @@ class Queue { highWaterMark: 1 << 25 }, initialVolume: 100, - bufferingTimeout: 3000 + bufferingTimeout: 3000, + spotifyBridge: true } as PlayerOptions, options ); @@ -638,7 +639,7 @@ class Queue { const customDownloader = typeof this.onBeforeCreateStream === "function"; if (["youtube", "spotify"].includes(track.raw.source)) { - if (track.raw.source === "spotify" && !track.raw.engine) { + if (this.options.spotifyBridge && track.raw.source === "spotify" && !track.raw.engine) { track.raw.engine = await YouTube.search(`${track.author} ${track.title}`, { type: "video" }) .then((x) => x[0].url) .catch(() => null); @@ -647,7 +648,7 @@ class Queue { if (!link) return void this.play(this.tracks.shift(), { immediate: true }); if (customDownloader) { - stream = (await this.onBeforeCreateStream(track, "youtube", this)) ?? null; + stream = (await this.onBeforeCreateStream(track, track.raw.source || "youtube", this)) ?? null; if (stream) stream = ytdl .arbitraryStream(stream, { diff --git a/src/types/types.ts b/src/types/types.ts index 694b0ee..1715260 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -128,6 +128,7 @@ export interface PlayerProgressbarOptions { * @property {YTDLDownloadOptions} [ytdlOptions={}] The youtube download options * @property {number} [initialVolume=100] The initial player volume * @property {number} [bufferingTimeout=3000] Buffering timeout for the stream + * @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube * @property {Function} [onBeforeCreateStream] Runs before creating stream */ export interface PlayerOptions { @@ -139,6 +140,7 @@ export interface PlayerOptions { ytdlOptions?: downloadOptions; initialVolume?: number; bufferingTimeout?: number; + spotifyBridge?: boolean; onBeforeCreateStream?: (track: Track, source: TrackSource, queue: Queue) => Promise; }