Prevent error when trying to close stream by assuming all streams have end/destroy methods

This commit is contained in:
Simon Schick
2015-11-28 22:19:17 +01:00
parent 44b6233a8d
commit 687970a3ec

View File

@@ -61,9 +61,16 @@ export default class VoiceConnection extends EventEmitter {
this.playing = false; this.playing = false;
this.playingIntent = null; this.playingIntent = null;
if(this.instream){ if(this.instream){
//not all streams implement these...
//and even file stream don't seem to implement them properly...
if(this.instream.end) {
this.instream.end(); this.instream.end();
}
if(this.instream.destroy) {
this.instream.destroy(); this.instream.destroy();
} }
this.instream = null;
}
} }
playStream(stream) { playStream(stream) {