From a07301019751c2f21d999327c2d0c19d41947847 Mon Sep 17 00:00:00 2001 From: Brian Tanner Date: Mon, 30 May 2016 21:34:50 -0400 Subject: [PATCH] fix bug in hookEncodingProcess causing playRawStream to not work (#392) * fix typo in hookEncodingProcess * proper fix for _this4 bug in src, use arrow functions * Get abalabahaha to build the noobs' changes --- lib/Voice/AudioEncoder.js | 4 +++- src/Voice/AudioEncoder.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Voice/AudioEncoder.js b/lib/Voice/AudioEncoder.js index ee9f0b747..84ec8e004 100644 --- a/lib/Voice/AudioEncoder.js +++ b/lib/Voice/AudioEncoder.js @@ -122,6 +122,8 @@ var AudioEncoder = (function () { }; AudioEncoder.prototype.hookEncodingProcess = function hookEncodingProcess(resolve, reject, enc, stream) { + var _this4 = this; + var processKilled = false; function killProcess(cause) { @@ -160,7 +162,7 @@ var AudioEncoder = (function () { this.volume.once("readable", function () { var data = { proc: enc, - stream: this.volume, + stream: _this4.volume, channels: 2 }; diff --git a/src/Voice/AudioEncoder.js b/src/Voice/AudioEncoder.js index 27ee545a0..ac4ac3335 100644 --- a/src/Voice/AudioEncoder.js +++ b/src/Voice/AudioEncoder.js @@ -130,7 +130,7 @@ export default class AudioEncoder { enc.stdout.pipe(this.volume); - enc.stderr.on("data", function (data) { + enc.stderr.on("data", (data) => { ffmpegErrors += "\n" + new Buffer(data).toString().trim(); }); @@ -148,7 +148,7 @@ export default class AudioEncoder { } }); - this.volume.once("readable", function () { + this.volume.once("readable", () => { var data = { proc: enc, stream: this.volume,