@discord-player/opus
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@discord-player/opus

Streamable Opus encoder and decoder for Discord Player.

Installation

$ yarn add @discord-player/opus

Additionally, install one of the following opus libraries:

  • mediaplex
  • @discordjs/opus
  • opusscript
  • @evan/opus
  • node-opus

If one does not work, feel free to switch to another.

Adding custom opus library

import { OPUS_MOD_REGISTRY } from '@discord-player/opus';

OPUS_MOD_REGISTRY.unshift(['my-opus-package-name', (mod) => ({ Encoder: mod.OpusEncoder })]);

Make sure to use this code before using any of the opus classes.

Example

import { OpusEncoder, OpusDecoder } from '@discord-player/opus';

// encode
const opusStream = getPcmStreamSomehow().pipe(new OpusEncoder({ rate: 48000, channels: 2, frameSize: 960 }));

// decode
const pcmStream = getOpusStreamSomehow().pipe(new OpusDecoder({ rate: 48000, channels: 2, frameSize: 960 }));

Package Sidebar

Install

npm i @discord-player/opus

Weekly Downloads

1,518

Version

0.1.2

License

MIT

Unpacked Size

37.7 kB

Total Files

6

Last publish

Collaborators

  • androz2091
  • snowflake7