mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-16 11:28:18 +00:00
errory voice
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class ConverterEngine {
|
||||
|
||||
constructor(player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
createConvertStream() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ConverterEngine;
|
||||
@@ -0,0 +1 @@
|
||||
exports.fetch = () => require('./FfmpegConverterEngine');
|
||||
@@ -0,0 +1,33 @@
|
||||
const ConverterEngine = require('./ConverterEngine');
|
||||
const ChildProcess = require('child_process');
|
||||
|
||||
function chooseCommand() {
|
||||
for (const cmd of ['ffmpeg', 'avconv', './ffmpeg', './avconv']) {
|
||||
if (!ChildProcess.spawnSync(cmd, ['-h']).error) {
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FfmpegConverterEngine extends ConverterEngine {
|
||||
constructor(player) {
|
||||
super(player);
|
||||
this.command = chooseCommand();
|
||||
}
|
||||
|
||||
createConvertStream() {
|
||||
super.createConvertStream();
|
||||
const encoder = ChildProcess.spawn(this.command, [
|
||||
'-analyzeduration', '0',
|
||||
'-loglevel', '0',
|
||||
'-i', '-',
|
||||
'-f', 's16le',
|
||||
'-ar', '48000',
|
||||
'-ss', '0',
|
||||
'pipe:1',
|
||||
], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||
return encoder;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FfmpegConverterEngine;
|
||||
Reference in New Issue
Block a user