mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
Fix some stream bugs
This commit is contained in:
@@ -151,6 +151,7 @@ class VoiceBroadcast extends EventEmitter {
|
||||
if (this.currentTranscoder) {
|
||||
if (this.currentTranscoder.transcoder) this.currentTranscoder.transcoder.kill();
|
||||
this.currentTranscoder = null;
|
||||
this.emit('end');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,10 +226,7 @@ class VoiceBroadcast extends EventEmitter {
|
||||
* Emitted once the broadcast (the audio stream) ends
|
||||
* @event VoiceBroadcast#end
|
||||
*/
|
||||
transcoder.once('end', () => {
|
||||
this.emit('end');
|
||||
this.killCurrentTranscoder();
|
||||
});
|
||||
transcoder.once('end', () => this.killCurrentTranscoder());
|
||||
this.currentTranscoder = {
|
||||
transcoder,
|
||||
options,
|
||||
@@ -245,7 +243,6 @@ class VoiceBroadcast extends EventEmitter {
|
||||
*/
|
||||
playConvertedStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) {
|
||||
this.killCurrentTranscoder();
|
||||
stream.once('end', () => this.emit('end'));
|
||||
const options = { seek, volume, passes, stream };
|
||||
this.currentTranscoder = { options };
|
||||
stream.once('readable', () => this._startPlaying());
|
||||
|
||||
Reference in New Issue
Block a user