mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 01:31:29 +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);
|
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
|
// 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');
|
console.log(Date.now(), 'clean up triggered');
|
||||||
const filter = checkStream && this.currentDispatcher && this.currentDispatcher.stream === checkStream;
|
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');
|
console.log(Date.now(), 'pcm input stream ended');
|
||||||
})
|
})
|
||||||
this.cleanup();
|
this.cleanup(null, 'outstanding play stream');
|
||||||
this.currentConverter = converter;
|
this.currentConverter = converter;
|
||||||
if (this.currentDispatcher) {
|
if (this.currentDispatcher) {
|
||||||
this.streamingData = this.currentDispatcher.streamingData;
|
this.streamingData = this.currentDispatcher.streamingData;
|
||||||
|
|
@ -62,7 +62,7 @@ class AudioPlayer extends EventEmitter {
|
||||||
volume: 1,
|
volume: 1,
|
||||||
});
|
});
|
||||||
dispatcher.on('error', e => this.emit('error', e));
|
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));
|
dispatcher.on('speaking', value => this.voiceConnection.setSpeaking(value));
|
||||||
this.currentDispatcher = dispatcher;
|
this.currentDispatcher = dispatcher;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue