DSharpPlus icon indicating copy to clipboard operation
DSharpPlus copied to clipboard

VoiceNextConnection UserSpeaking handler only being called once per user

Open notpidgey opened this issue 3 years ago • 4 comments

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

  1. Follow this guide for connecting to a voice chat https://dsharpplus.readthedocs.io/en/stable/articles/voicenext.html
  2. Set an event handler for the current instance of VoiceNextConnection
  3. Begin speaking and make pauses to deactivate your Speaking state.

notpidgey avatar Jun 24 '21 23:06 notpidgey

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

Giggitybyte avatar Jun 25 '21 20:06 Giggitybyte

From other sources this is speculated to be a Discord issue, Unknown if this is still happening.

Neuheit avatar Aug 04 '21 04:08 Neuheit

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.

WamWooWam avatar Sep 15 '21 18:09 WamWooWam

https://github.com/imayhaveborkedit/discord.py/commit/ba277fec0c729880761b541b389de6b9a655cc25

For reference on how it's determined now

Emzi0767 avatar Sep 15 '21 20:09 Emzi0767