mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
catch cleanup reasons
This commit is contained in:
parent
17586f0e20
commit
7818d37042
1 changed files with 3 additions and 3 deletions
|
|
@ -32,7 +32,7 @@ class AudioPlayer extends EventEmitter {
|
|||
return this.playPCMStream(conversionProcess.process.stdout, conversionProcess);
|
||||
}
|
||||
|
||||
cleanup(checkStream) {
|
||||
cleanup(checkStream, reason) {
|
||||
// cleanup is a lot less aggressive than v9 because it doesn't try to kill every single stream it is aware of
|
||||
console.log(Date.now(), 'clean up triggered');
|
||||
const filter = checkStream && this.currentDispatcher && this.currentDispatcher.stream === checkStream;
|
||||
|
|
@ -52,7 +52,7 @@ class AudioPlayer extends EventEmitter {
|
|||
|
||||
console.log(Date.now(), 'pcm input stream ended');
|
||||
})
|
||||
this.cleanup();
|
||||
this.cleanup(null, 'outstanding play stream');
|
||||
this.currentConverter = converter;
|
||||
if (this.currentDispatcher) {
|
||||
this.streamingData = this.currentDispatcher.streamingData;
|
||||
|
|
@ -62,7 +62,7 @@ class AudioPlayer extends EventEmitter {
|
|||
volume: 1,
|
||||
});
|
||||
dispatcher.on('error', e => this.emit('error', e));
|
||||
dispatcher.on('end', () => this.cleanup(dispatcher.stream));
|
||||
dispatcher.on('end', () => this.cleanup(dispatcher.stream, 'disp ended'));
|
||||
dispatcher.on('speaking', value => this.voiceConnection.setSpeaking(value));
|
||||
this.currentDispatcher = dispatcher;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue