mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Make FFMPEG error reject encoding
This commit is contained in:
@@ -87,10 +87,13 @@ var AudioEncoder = (function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
_this.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
||||
|
||||
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-loglevel', '0', '-i', '-', '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-hide_banner', '-i', '-', '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
|
||||
|
||||
stream.pipe(enc.stdin);
|
||||
enc.stdout.pipe(_this.volume);
|
||||
enc.stderr.on("data", function (data) {
|
||||
reject(new Error("FFMPEG: " + new Buffer(data).toString().trim()));
|
||||
});
|
||||
|
||||
_this.volume.once("readable", function () {
|
||||
resolve({
|
||||
@@ -117,9 +120,12 @@ var AudioEncoder = (function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
_this2.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
||||
|
||||
var enc = _child_process2["default"].spawn(_this2.getCommand(), ['-loglevel', '0', '-i', file, '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||
var enc = _child_process2["default"].spawn(_this2.getCommand(), ['-hide_banner', '-i', file, '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
|
||||
|
||||
enc.stdout.pipe(_this2.volume);
|
||||
enc.stderr.on("data", function (data) {
|
||||
reject(new Error("FFMPEG: " + new Buffer(data).toString().trim()));
|
||||
});
|
||||
|
||||
_this2.volume.once("readable", function () {
|
||||
resolve({
|
||||
@@ -146,10 +152,13 @@ var AudioEncoder = (function () {
|
||||
_this3.volume = new _VolumeTransformer2["default"](1);
|
||||
|
||||
// add options discord.js needs
|
||||
var options = ffmpegOptions.concat(['-loglevel', '0', '-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']);
|
||||
var enc = _child_process2["default"].spawn(_this3.getCommand(), options, { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||
var options = ffmpegOptions.concat(['-hide_banner', '-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']);
|
||||
var enc = _child_process2["default"].spawn(_this3.getCommand(), options);
|
||||
|
||||
enc.stdout.pipe(_this3.volume);
|
||||
enc.stderr.on("data", function (data) {
|
||||
reject(new Error("FFMPEG: " + new Buffer(data).toString().trim()));
|
||||
});
|
||||
|
||||
_this3.volume.once("readable", function () {
|
||||
resolve({
|
||||
|
||||
Reference in New Issue
Block a user