VIVOX 16.3.0 - Unity 2021.3 LTS - Set Volume Locally not working - Error 1019 and Error 20000

Hi,

We are following Vivox’s documentation to implement setting other player’s volumes locally. Voice is in 3D space and we are trying to set someone’s volume on our local player. Whenever we call the function below, we get the Error 1019, which according to the documentation is a “programming error”. Well thank Vivox, but we did what you said we should do.

Our function:

public int SetPlayerLocalVolume(VoiceChatParticipant participant, int intValue)
    {
        int volumeFound = intValue;
        if (VivoxService.Instance.IsLoggedIn)
        {
            foreach (var channel in VivoxService.Instance.ActiveChannels)
            {
                foreach (var channelParticipant in channel.Value)
                {
                    if (channelParticipant.PlayerId == participant.PlayerId)
                    {
                        Debug.Log($"Vivox :: SetPlayerLocalVolume PlayerId={channelParticipant.PlayerId} IsSelf={channelParticipant.IsSelf} {channelParticipant.LocalVolume} {channelParticipant.IsMuted}");
                        channelParticipant.SetLocalVolume(volumeFound);
                        return volumeFound;
                    }
                }
            }
        }
      
      
        return volumeFound;
    }

This returns the following errors:

Vivox :: SetPlayerLocalVolume PlayerId=BjaAulia70fdIBbKlriWxOEmtU5L IsSelf=False -50 False
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
VoiceChatChannels:SetPlayerLocalVolume(VoiceChatParticipant, Int32)
VoiceChatUserSetting:UISlider_ValueChanged(Single)
UnityEngine.Events.InvokableCall`1:Invoke(T1)
UnityEngine.Events.UnityEvent`1:Invoke(T0)
UnityEngine.UI.Slider:Set(Single, Boolean)
UnityEngine.UI.Slider:UpdateDrag(PointerEventData, Camera)
UnityEngine.UI.Slider:OnDrag(PointerEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.PointerInputModule:ProcessDrag(PointerEventData)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32)
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()

VoiceChatUserSettings :: After - Volume change trigger WalkOverYou - Old=-1 New=-1
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
VoiceChatUserSetting:UISlider_ValueChanged(Single)
UnityEngine.Events.InvokableCall`1:Invoke(T1)
UnityEngine.Events.UnityEvent`1:Invoke(T0)
UnityEngine.UI.Slider:Set(Single, Boolean)
UnityEngine.UI.Slider:UpdateDrag(PointerEventData, Camera)
UnityEngine.UI.Slider:OnDrag(PointerEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.PointerInputModule:ProcessDrag(PointerEventData)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32)
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()

[Vivox]: <set_LocalVolumeAdjustment>b__0: vx_req_session_set_participant_volume_for_me_t failed: Unity.Services.Vivox.VivoxApiException: Invalid State (1019)
  at Unity.Services.Vivox.VxClient.EndIssueRequest (System.IAsyncResult result) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.ChannelParticipant+<>c__DisplayClass46_0.<set_LocalVolumeAdjustment>b__0 (System.IAsyncResult result) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.AsyncResult`1[T].SetComplete (T result) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.VxClient.InstanceOnMainLoopRun (System.Boolean& didWork) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.Client.RunOnce () [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.VxUnityInterop+<VivoxUnityRun>d__7.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.Logger:LogError(String, Object)
Unity.Services.Vivox.VivoxLogger:LogVxException(Object)
Unity.Services.Vivox.<>c__DisplayClass46_0:<set_LocalVolumeAdjustment>b__0(IAsyncResult)
Unity.Services.Vivox.AsyncResult`1:SetComplete(T)
Unity.Services.Vivox.VxClient:InstanceOnMainLoopRun(Boolean&)
Unity.Services.Vivox.Client:RunOnce()
Unity.Services.Vivox.<VivoxUnityRun>d__7:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Uploading Crash Report
VivoxApiException: Invalid State (1019)
  at Unity.Services.Vivox.VxClient.EndIssueRequest (System.IAsyncResult result) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.ChannelParticipant+<>c__DisplayClass46_0.<set_LocalVolumeAdjustment>b__0 (System.IAsyncResult result) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.AsyncResult`1[T].SetComplete (T result) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.VxClient.InstanceOnMainLoopRun (System.Boolean& didWork) [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.Client.RunOnce () [0x00000] in <00000000000000000000000000000000>:0
  at Unity.Services.Vivox.VxUnityInterop+<VivoxUnityRun>d__7.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Unity.Services.Vivox.<VivoxUnityRun>d__7:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

By checking the volume of the participant directly through Vivox when trying to set the volume to, in this example, -1, we get a value of -50, which doesn’t make sense since I can hear him anyway.

And then, when attempting to mute a player.
Our mute logic:

public bool MutePlayer(VoiceChatParticipant participant)
    {
        if (VivoxService.Instance.IsLoggedIn)
        {
            foreach (var channel in VivoxService.Instance.ActiveChannels)
            {
                foreach (var channelParticipant in channel.Value)
                {
                    if (channelParticipant.PlayerId == participant.PlayerId)
                    {
                        if (channelParticipant.IsSelf)
                        {
                            Debug.LogWarning(
                                $"Cannot mute self user :: {channelParticipant.DisplayName} :: Will mute local microphone instead");
                            VoiceChatManager.Instance.MicrophoneMuted = true;
                            return VoiceChatManager.Instance.MicrophoneMuted;
                        }

                        if (!channelParticipant.IsMuted)
                        {
                            Debug.Log($"Vivox :: MutePlayer PlayerId={channelParticipant.PlayerId} IsSelf={channelParticipant.IsSelf} {channelParticipant.LocalVolume} {channelParticipant.IsMuted}");
                            channelParticipant.MutePlayerLocally();
                        }
                        return channelParticipant.IsMuted;
                    }
                }
            }
        }

        return false;
    }

This one returns error 20000, which is not documented.

We are 3 days away from release and would appreciate some support!

Thanks

Hi @marcrem,

The first thing I’d recommend is setting the local player’s position via the update method to ensure they have a valid location to reference. All 3D channels start in a no audio space to ensure you do not hear a blip of audio from any location in particular, so updating the location is important to do as soon as your player is in the game.

Second, for 3D channels, participants add and remove events as they are in and out of audible distance based on your 3D audio settings. This means if you are setting a volume for a player who is not in audible distance, you likely will see errors like 1019 or 2000.

I hope this helps, and I will make a note to improve these documentation links to cover more clearly how the 3D participants function.

Carlo