mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
AudioPlayer now destroys all dispatchers on closing, Broadcasts are also destroyed properly
This commit is contained in:
@@ -27,6 +27,7 @@ class AudioPlayer extends EventEmitter {
|
||||
timestamp: 0,
|
||||
pausedTime: 0,
|
||||
};
|
||||
this.voiceConnection.once('closing', () => this.destroyAllStreams());
|
||||
}
|
||||
|
||||
get currentTranscoder() {
|
||||
@@ -34,7 +35,9 @@ class AudioPlayer extends EventEmitter {
|
||||
}
|
||||
|
||||
destroyStream(stream) {
|
||||
if (stream instanceof VoiceBroadcast) {
|
||||
if (stream instanceof VoiceBroadcast && this.streams.has(stream)) {
|
||||
const data = this.streams.get(stream);
|
||||
if (data.dispatcher) data.dispatcher.destroy('end');
|
||||
this.streams.delete(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user