mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 10:49:20 +00:00
🐛 fix: Broken Spotify player
This commit is contained in:
@@ -231,7 +231,7 @@ export class DiscordMusicPlayerInstance {
|
|||||||
if (previousTrack) this.previousTrack = previousTrack;
|
if (previousTrack) this.previousTrack = previousTrack;
|
||||||
|
|
||||||
if (this.queue.track.length > 0) {
|
if (this.queue.track.length > 0) {
|
||||||
this.playTrack(this.queue.track[0]);
|
await this.playTrack(this.queue.track[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,13 +375,23 @@ export class DiscordMusicPlayerInstance {
|
|||||||
);
|
);
|
||||||
|
|
||||||
resource = createAudioResource(stream.stream, {
|
resource = createAudioResource(stream.stream, {
|
||||||
inputType: stream.type
|
//inputType: stream.type
|
||||||
});
|
});
|
||||||
this.actualPlaybackURL = search.url;
|
this.actualPlaybackURL = search.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.player.play(resource);
|
this.player.play(resource);
|
||||||
this.voiceConnection.subscribe(this.player);
|
this.voiceConnection.subscribe(this.player);
|
||||||
|
|
||||||
|
let timeout = 0;
|
||||||
|
while (!resource.started && timeout < 10000) {
|
||||||
|
console.log('Waiting for resource to start');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||||
|
timeout += 100;
|
||||||
|
|
||||||
|
if (timeout >= 10000)
|
||||||
|
this.events.emit('error', new PlayerErrorEvent(this, new Error('Resource took too long to start')));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
this.events.emit('error', new PlayerErrorEvent(this, error));
|
this.events.emit('error', new PlayerErrorEvent(this, error));
|
||||||
this.skipTrack();
|
this.skipTrack();
|
||||||
|
|||||||
Reference in New Issue
Block a user