mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Made opus truly optional
This commit is contained in:
@@ -3,14 +3,22 @@
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var cpoc = require("child_process");
|
||||
var opus = require("node-opus");
|
||||
|
||||
var opus;
|
||||
try {
|
||||
opus = require("node-opus");
|
||||
} catch (e) {
|
||||
// no opus!
|
||||
}
|
||||
var VoicePacket = require("./VoicePacket.js");
|
||||
|
||||
var AudioEncoder = (function () {
|
||||
function AudioEncoder() {
|
||||
_classCallCheck(this, AudioEncoder);
|
||||
|
||||
this.opus = new opus.OpusEncoder(48000, 1);
|
||||
if (opus) {
|
||||
this.opus = new opus.OpusEncoder(48000, 1);
|
||||
}
|
||||
}
|
||||
|
||||
AudioEncoder.prototype.opusBuffer = function opusBuffer(buffer) {
|
||||
|
||||
Reference in New Issue
Block a user