added volume control

This commit is contained in:
Amish Shah
2015-12-12 17:52:25 +00:00
parent df368168ee
commit d66b765933
5 changed files with 56 additions and 58 deletions

View File

@@ -233,11 +233,17 @@ var VoiceConnection = (function (_EventEmitter) {
VoiceConnection.prototype.playFile = function playFile(stream) {
var _this = this;
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (err, str) {} : arguments[1];
var options = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, str) {} : arguments[2];
var self = this;
if (typeof options === "function") {
// options is the callback
callback = options;
options = {};
}
return new Promise(function (resolve, reject) {
_this.encoder.encodeFile(stream)["catch"](error).then(function (data) {
_this.encoder.encodeFile(stream, options)["catch"](error).then(function (data) {
self.streamProc = data.proc;
var intent = self.playStream(data.stream, 2);
resolve(intent);
@@ -255,11 +261,17 @@ var VoiceConnection = (function (_EventEmitter) {
VoiceConnection.prototype.playRawStream = function playRawStream(stream) {
var _this2 = this;
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (err, str) {} : arguments[1];
var options = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, str) {} : arguments[2];
var self = this;
if (typeof options === "function") {
// options is the callback
callback = options;
options = {};
}
return new Promise(function (resolve, reject) {
_this2.encoder.encodeStream(stream)["catch"](error).then(function (data) {
_this2.encoder.encodeStream(stream, options)["catch"](error).then(function (data) {
self.streamProc = data.proc;
self.instream = data.instream;
var intent = self.playStream(data.stream);