mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
AudioPlayer now destroys all dispatchers on closing, Broadcasts are also destroyed properly
This commit is contained in:
parent
b5f51d612a
commit
2f630a0dbb
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue