Fix for the playArbitraryFFmpeg issue (#351)

* This should probably fix #346

* Updated docs for playArbitraryFFmpeg
This commit is contained in:
Denocle
2016-05-17 15:30:47 +02:00
committed by abalabahaha
parent e6572caf6c
commit 43b1cc1d56
3 changed files with 11 additions and 11 deletions

View File

@@ -277,20 +277,20 @@ export default class VoiceConnection extends EventEmitter {
})
}
playArbitraryFFmpeg(ffmpegOptions, callback = function (err, str) { }) {
playArbitraryFFmpeg(ffmpegOptions, volume, callback = function (err, str) { }) {
var self = this;
self.stopPlaying();
if (typeof options === "function") {
// options is the callback
callback = options;
if (typeof volume === "function") {
// volume is the callback
callback = volume;
}
if (typeof options !== "object") {
options = {};
if (!ffmpegOptions instanceof Array) {
ffmpegOptions = [];
}
options.volume = options.volume !== undefined ? options.volume : this.getVolume();
var volume = volume !== undefined ? volume : this.getVolume();
return new Promise((resolve, reject) => {
this.encoder
.encodeArbitraryFFmpeg(ffmpegOptions)
.encodeArbitraryFFmpeg(ffmpegOptions, volume)
.catch(error)
.then(data => {
self.streamProc = data.proc;