mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 05:52:05 +00: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:
parent
026691702d
commit
d3c9384c9c
2 changed files with 6 additions and 1 deletions
|
|
@ -189,7 +189,7 @@ class VoiceWebSocket extends EventEmitter {
|
|||
this.emit('sessionDescription', packet.d);
|
||||
break;
|
||||
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;
|
||||
case VoiceOPCodes.CLIENT_DISCONNECT:
|
||||
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);
|
||||
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 });
|
||||
speakingTimeout = this.receiver.connection.client.setTimeout(() => {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue