mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19: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,
|
timestamp: 0,
|
||||||
pausedTime: 0,
|
pausedTime: 0,
|
||||||
};
|
};
|
||||||
|
this.voiceConnection.once('closing', () => this.destroyAllStreams());
|
||||||
}
|
}
|
||||||
|
|
||||||
get currentTranscoder() {
|
get currentTranscoder() {
|
||||||
@@ -34,7 +35,9 @@ class AudioPlayer extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroyStream(stream) {
|
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);
|
this.streams.delete(stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user