C# wrapper onUserAudioStatusChange event problem

Hello all

I do use C# wrapper from https://github.com/zoom/zoom-c-sharp-wrapper. The version is [v4.6.21666.0428].

I do have an issue in audio event handler (see code snippet below):

serviceController = ZOOM_SDK_DOTNET_WRAP.CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap();
audioController = serviceController.GetMeetingAudioController();

audioController.Add_CB_onUserActiveAudioChange(onUserActiveAudioChange);
audioController.Add_CB_onUserAudioStatusChange(onUserAudioStatusChange);

private void onUserActiveAudioChange(uint[] lstActiveAudio) 
        {
            Console.WriteLine("onUserActiveAudioChange lstActiveAudio");
            if (lstActiveAudio != null)
            {
                foreach (uint el in lstActiveAudio)
                {
                    Console.WriteLine("activeAudio={0}", el);
                }
            }
        }

private void onUserAudioStatusChange(IUserAudioStatusDotNetWrap[] lstAudioStatusChange) 
        {
            Console.WriteLine("onUserAudioStatusChange lstAudioStatusChange");
            if (lstAudioStatusChange != null) 
            {
                foreach (IUserAudioStatusDotNetWrap el in lstAudioStatusChange) 
                {
                    Console.WriteLine("GetUserId={0} GetStatus={1} GetAudioType={2}", el.GetUserId(), el.GetStatus(), el.GetAudioType());
                    if (el.GetUserId() == myUserID) 
                    {
                        audioState = el.GetStatus();
                        Console.WriteLine("myaudiostate {0}", audioState);
                    }
                }
            }
        }

The userID in logs that I’m getting from event handles is always 0 and I can’t detect which user did mute/unmute mic then.

The logs are showing this:

onUserActiveAudioChange lstActiveAudio
activeAudio=16778240
onUserAudioStatusChange lstAudioStatusChange
GetUserId=0 GetStatus=Audio_UnMuted GetAudioType=AUDIOTYPE_VOIP

Can anyone help? In onUserActiveAudioChange is userID filled in correctly, but in OnUserAudioStatusChange handler not.
Thank you
Robert

I resolved it. There was an issue with wrapper. In meeting_audio_dotnet_wrap.cpp

virtual unsigned int GetUserId()
{
if (m_pStatus)
m_pStatus->GetUserId();
return 0;
}

changed to:

virtual unsigned int GetUserId()
{
if (m_pStatus)
return (unsigned int)m_pStatus->GetUserId();
return 0;
}

now it works.
GetUserId=16778240 GetStatus=Audio_Muted GetAudioType=AUDIOTYPE_VOIP
onUserActiveAudioChange lstActiveAudio
activeAudio=16778240

Just in case anyone else is having the same issue.

1 Like

Happy to hear you resolved the issue! :slight_smile:

Thanks for sharing the solution!

-Tommy