DSharpPlus
DSharpPlus copied to clipboard
VoiceNextConnection UserSpeaking handler only being called once per user
Summary
When using the UserSpeaking event, the handler is only called a single time per user in the instance of the VoiceNextConnection. Never handled more than once per user.
Details
.NET 5 C# 9 DSharpPlus 4.1.0 nightly 897 DSharpPlus 4.0.1 (both tested)
_connection.UserSpeaking += delegate(VoiceNextConnection sender, UserSpeakingEventArgs args)
{
if (args.User.Id == userId)
{
currentlPlaying = args.Speaking;
}
return Task.CompletedTask;
};
When debugging this code and break pointing the body of the if statement, it will only hit this break point once regardless of how many times "userId" starts or stops speaking. The one time this break point is hit (per user) "Speaking" has the value of true.
For example (Friend A, B) Friend A Speaking -> Handler is called (Speaking = true) Friend A Stops Speaking -> Nothing Occurs Friend B Speaking -> Handler is called (Speaking = true) Friend A Speaking -> Nothing Occurs
Steps to reproduce
- Follow this guide for connecting to a voice chat https://dsharpplus.readthedocs.io/en/stable/articles/voicenext.html
- Set an event handler for the current instance of VoiceNextConnection
- Begin speaking and make pauses to deactivate your Speaking state.
The docs site you linked are not the official docs.
https://dsharpplus.github.io/articles/audio/voicenext/transmit.html https://dsharpplus.github.io/articles/audio/voicenext/receive.html
From other sources this is speculated to be a Discord issue, Unknown if this is still happening.
This isn't a bug. While I can't find documentation on this currently, Discord now (read, since at least a year ago) only send OP5 once per user for SSRC <-> User mapping purposes, and never again.
The client now uses the actual RTC streams to synthesise speaking notifications.
https://github.com/imayhaveborkedit/discord.py/commit/ba277fec0c729880761b541b389de6b9a655cc25
For reference on how it's determined now