Made opus truly optional

This commit is contained in:
hydrabolt
2015-11-08 10:55:57 +00:00
parent c5fe16af5b
commit a1e92dff5c
4 changed files with 32 additions and 18 deletions

View File

@@ -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) {