1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 13:03:18 +00:00
musix-oss/node_modules/node-opus/index.js
2020-03-03 22:30:50 +02:00

33 lines
762 B
JavaScript

"use strict";
var OpusEncoder = require( './lib/OpusEncoder' );
exports.OpusEncoder = OpusEncoder;
var oggPacket = true;
try {
require( "ogg-packet" );
} catch( ex ) {
oggPacket = false;
}
// Check if the ogg packet loaded successfully.
if( oggPacket ) {
// ogg packet loaded successfully. Encoder and Decoder can be used.
exports.Encoder = require( './lib/Encoder' );
exports.Decoder = require( './lib/Decoder' );
} else {
// ogg packet not available.
exports.Encoder = exports.Decoder = function() {
throw new Error(
"ogg-packet is not available. " +
"Only the raw OpusEncoder can be used. " +
"Install ogg-packet package to use the Encoder and Decoder" );
} ;
}