Fixed process removing

This commit is contained in:
hydrabolt
2015-11-07 21:33:38 +00:00
parent 2e43117500
commit 48c3770caf
6 changed files with 73 additions and 13 deletions

View File

@@ -39,11 +39,14 @@ var VoiceConnection = (function (_EventEmitter) {
this.playingIntent = null;
this.playing = false;
this.streamTime = 0;
this.streamProc = null;
this.init();
}
VoiceConnection.prototype.stopPlaying = function stopPlaying() {
this.playing = false;
this.playingIntent = null;
if (this.streamProc) this.streamProc.kill();
};
VoiceConnection.prototype.playRawStream = function playRawStream(stream) {
@@ -171,9 +174,10 @@ var VoiceConnection = (function (_EventEmitter) {
var self = this;
return new Promise(function (resolve, reject) {
_this.encoder.encodeFile(stream)["catch"](error).then(function (stream) {
_this.encoder.encodeFile(stream)["catch"](error).then(function (data) {
var intent = self.playRawStream(stream);
self.streamProc = data.proc;
var intent = self.playRawStream(data.stream);
resolve(intent);
callback(null, intent);
});