mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
fix(Voice): correctly set speaking data in the voice ssrcMap
Co-authored-by: Sillyfrog <sillyfrog@users.noreply.github.com>
This commit is contained in:
@@ -189,7 +189,7 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
this.emit('sessionDescription', packet.d);
|
this.emit('sessionDescription', packet.d);
|
||||||
break;
|
break;
|
||||||
case VoiceOPCodes.CLIENT_CONNECT:
|
case VoiceOPCodes.CLIENT_CONNECT:
|
||||||
this.connection.ssrcMap.set(+packet.d.audio_ssrc, packet.d.user_id);
|
this.connection.ssrcMap.set(+packet.d.audio_ssrc, { userID: packet.d.user_id, speaking: 0 });
|
||||||
break;
|
break;
|
||||||
case VoiceOPCodes.CLIENT_DISCONNECT:
|
case VoiceOPCodes.CLIENT_DISCONNECT:
|
||||||
const streamInfo = this.connection.receiver && this.connection.receiver.packets.streams.get(packet.d.user_id);
|
const streamInfo = this.connection.receiver && this.connection.receiver.packets.streams.get(packet.d.user_id);
|
||||||
|
|||||||
@@ -86,6 +86,11 @@ class PacketHandler extends EventEmitter {
|
|||||||
|
|
||||||
let speakingTimeout = this.speakingTimeouts.get(ssrc);
|
let speakingTimeout = this.speakingTimeouts.get(ssrc);
|
||||||
if (typeof speakingTimeout === 'undefined') {
|
if (typeof speakingTimeout === 'undefined') {
|
||||||
|
// Ensure at least the speaking bit is set.
|
||||||
|
// As the object is by reference, it's only needed once per client re-connect.
|
||||||
|
if (userStat.speaking === 0) {
|
||||||
|
userStat.speaking = 1;
|
||||||
|
}
|
||||||
this.connection.onSpeaking({ user_id: userStat.userID, ssrc: ssrc, speaking: userStat.speaking });
|
this.connection.onSpeaking({ user_id: userStat.userID, ssrc: ssrc, speaking: userStat.speaking });
|
||||||
speakingTimeout = this.receiver.connection.client.setTimeout(() => {
|
speakingTimeout = this.receiver.connection.client.setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user