mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
Build the playArbitraryFFmpeg fix
This commit is contained in:
@@ -160,11 +160,11 @@ var AudioEncoder = (function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioEncoder.prototype.encodeArbitraryFFmpeg = function encodeArbitraryFFmpeg(ffmpegOptions) {
|
AudioEncoder.prototype.encodeArbitraryFFmpeg = function encodeArbitraryFFmpeg(ffmpegOptions, volume) {
|
||||||
var _this3 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
_this3.volume = new _VolumeTransformer2["default"](1);
|
_this3.volume = new _VolumeTransformer2["default"](volume);
|
||||||
|
|
||||||
// add options discord.js needs
|
// add options discord.js needs
|
||||||
var options = ffmpegOptions.concat(['-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']);
|
var options = ffmpegOptions.concat(['-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']);
|
||||||
|
|||||||
@@ -318,23 +318,23 @@ var VoiceConnection = (function (_EventEmitter) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
VoiceConnection.prototype.playArbitraryFFmpeg = function playArbitraryFFmpeg(ffmpegOptions) {
|
VoiceConnection.prototype.playArbitraryFFmpeg = function playArbitraryFFmpeg(ffmpegOptions, volume) {
|
||||||
var _this3 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (err, str) {} : arguments[1];
|
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, str) {} : arguments[2];
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
self.stopPlaying();
|
self.stopPlaying();
|
||||||
if (typeof options === "function") {
|
if (typeof volume === "function") {
|
||||||
// options is the callback
|
// volume is the callback
|
||||||
callback = options;
|
callback = volume;
|
||||||
}
|
}
|
||||||
if (typeof options !== "object") {
|
if (!ffmpegOptions instanceof Array) {
|
||||||
options = {};
|
ffmpegOptions = [];
|
||||||
}
|
}
|
||||||
options.volume = options.volume !== undefined ? options.volume : this.getVolume();
|
var volume = volume !== undefined ? volume : this.getVolume();
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
_this3.encoder.encodeArbitraryFFmpeg(ffmpegOptions)["catch"](error).then(function (data) {
|
_this3.encoder.encodeArbitraryFFmpeg(ffmpegOptions, volume)["catch"](error).then(function (data) {
|
||||||
self.streamProc = data.proc;
|
self.streamProc = data.proc;
|
||||||
self.instream = data.instream;
|
self.instream = data.instream;
|
||||||
var intent = self.playStream(data.stream);
|
var intent = self.playStream(data.stream);
|
||||||
|
|||||||
Reference in New Issue
Block a user