mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
voice: update prism and fix framesize to work for opusscript
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
"unpkg": "./webpack/discord.min.js",
|
"unpkg": "./webpack/discord.min.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pako": "^1.0.0",
|
"pako": "^1.0.0",
|
||||||
"prism-media": "hydrabolt/prism-media",
|
"prism-media": "^0.2.0",
|
||||||
"snekfetch": "^3.6.0",
|
"snekfetch": "^3.6.0",
|
||||||
"tweetnacl": "^1.0.0",
|
"tweetnacl": "^1.0.0",
|
||||||
"ws": "^4.0.0"
|
"ws": "^4.0.0"
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class BasePlayer extends EventEmitter {
|
|||||||
|
|
||||||
playPCMStream(stream, options, streams = {}) {
|
playPCMStream(stream, options, streams = {}) {
|
||||||
this.destroyDispatcher();
|
this.destroyDispatcher();
|
||||||
const opus = streams.opus = new prism.opus.Encoder({ channels: 2, rate: 48000, frameSize: 1920 });
|
const opus = streams.opus = new prism.opus.Encoder({ channels: 2, rate: 48000, frameSize: 960 });
|
||||||
if (options && options.volume === false) {
|
if (options && options.volume === false) {
|
||||||
stream.pipe(opus);
|
stream.pipe(opus);
|
||||||
return this.playOpusStream(opus, options, streams);
|
return this.playOpusStream(opus, options, streams);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class VoiceReceiver extends EventEmitter {
|
|||||||
if (!user) throw new Error('VOICE_USER_MISSING');
|
if (!user) throw new Error('VOICE_USER_MISSING');
|
||||||
const stream = this.packets.makeStream(user.id);
|
const stream = this.packets.makeStream(user.id);
|
||||||
if (mode === 'pcm') {
|
if (mode === 'pcm') {
|
||||||
const decoder = new prism.opus.Decoder({ channels: 2, rate: 48000, frameSize: 1920 });
|
const decoder = new prism.opus.Decoder({ channels: 2, rate: 48000, frameSize: 960 });
|
||||||
stream.pipe(decoder);
|
stream.pipe(decoder);
|
||||||
return decoder;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user