mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
voice fixes
This commit is contained in:
@@ -67,8 +67,7 @@ var AudioEncoder = (function () {
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ["-f", "s16le", "-ar", "48000", "-ac", "1", // this can be 2 but there's no point, discord makes it mono on playback, wasted bandwidth.
|
||||
"-af", "volume=1", "pipe:1", "-i", "-"]);
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ['-i', "-", '-f', 's16le', '-ar', '48000', '-ac', 1, 'pipe:1']);
|
||||
|
||||
stream.pipe(enc.stdin);
|
||||
|
||||
@@ -102,8 +101,7 @@ var AudioEncoder = (function () {
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ["-f", "s16le", "-ar", "48000", "-ac", "1", // this can be 2 but there's no point, discord makes it mono on playback, wasted bandwidth.
|
||||
"-af", "volume=1", "pipe:1", "-i", file]);
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ['-i', file, '-f', 's16le', '-ar', '48000', '-ac', 1, 'pipe:1']);
|
||||
|
||||
enc.stdout.once("readable", function () {
|
||||
callback(null, {
|
||||
@@ -117,11 +115,13 @@ var AudioEncoder = (function () {
|
||||
});
|
||||
|
||||
enc.stdout.on("end", function () {
|
||||
console.log("end");
|
||||
callback("end");
|
||||
reject("end");
|
||||
});
|
||||
|
||||
enc.stdout.on("close", function () {
|
||||
console.log("close");
|
||||
callback("close");
|
||||
reject("close");
|
||||
});
|
||||
|
||||
@@ -122,11 +122,10 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
self.playingIntent = retStream;
|
||||
|
||||
function send() {
|
||||
|
||||
if (!self.playingIntent || !self.playing) {
|
||||
self.setSpeaking(false);
|
||||
retStream.emit("end");
|
||||
self;
|
||||
console.log("ending 1");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -137,6 +136,7 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
if (onWarning) {
|
||||
retStream.emit("end");
|
||||
self.setSpeaking(false);
|
||||
console.log("ending 2");
|
||||
return;
|
||||
} else {
|
||||
onWarning = true;
|
||||
|
||||
Reference in New Issue
Block a user