Users in room cannot hear each other - Photon Voice 2 v2.6

Hello!

My team is using PUN 2 and Photon Voice 2 in a project of ours. We are currently having issues with v2.6 of PUN and PUN Voice 2.

Here is a reference to both assets on the Unity Asset Store, just to make sure we are referencing the same ones:
PUN 2- https://assetstore.unity.com/packages/tools/network/pun-2-free-119922
Photon Voice 2 - https://assetstore.unity.com/packages/tools/audio/photon-voice-2-130518

We are having an inconsistent bug occurring when users are in the same room. Even though the Photon.Voice.Unity.Recorder is created properly and receiving local input (verified using the Debug echo), the other users cannot hear each other. This issue does not always occur and is somewhat random. In testing this, the issue occurs about 20-30% of the time.

When this issue occurs, we have traced the stack and found Photon.Voice.VoiceClient's delegate RemoteVoiceInfoDelegate OnRemoteVoiceInfoAction is not being invoked. When this delegate is invoked, the issue does not occur and the users can hear each other.

In looking through the Photon forum, we also referenced these two posts...
Post #1: https://forum.photonengine.com/discussion/12965/photon-voices-big-bug-i-cannot-be-heard-when-re-joining-the-room ... Updating to v2.6 did fix the issue discussed in post #1.

Post #2: https://forum.photonengine.com/discussion/12856/photon-voice-2-voice-chat-not-working ... We are utilizing all of the solutions explored in post #2.

I'm posting this in hopes someone can guide us in the right direction if there is in fact something we are doing incorrectly when initializing the Photon voice components. Does anyone have an idea what we may be doing wrong?

Thank you!

Comments

  • Hi @brandon_doghead,

    Thank you for choosing Photon!

    First, if you download and import Photon Voice, you don't need to download and import PUN.

    Does this issue happen on the Unity Editor or on a build?
    Which Unity version?
    Which target platform?

    In testing this, the issue occurs about 20-30% of the time.
    hmm, how did you measure this? or is it just a guesstimate?

    When this issue occurs, we have traced the stack and found Photon.Voice.VoiceClient's delegate RemoteVoiceInfoDelegate OnRemoteVoiceInfoAction is not being invoked.
    How did you trace it? Could you make sure that clients are joined to the same VOICE room (same AppId, same Region, same server address, same room name)...
    Do you use multiple scenes and load a new one when the user joins a room?
  • Hello @JohnTube, and thank you for replying!

    This issue occurs on both the Unity Editor and on a build.
    Unity version: 2018.3.3f1
    Target platform: PC & Android

    When I said the issue occurs about 20-30% of the time, this is just a guesstimate.

    We traced the "OnRemoteVoiceInfo" delegate by going as far up the code logic as I could go with the Unity debugger and logged what paths were being executed. This is how we discovered the OnRemoteVoiceInfoAction was not being invoked. Also, when the debug log of PhotonVoiceNetwork is set to ALL, "OnRemoteVoiceInfo" is never logged in the console when the error occurs.

    The users are always in the same voice room, even when this issue occurs.
    We are using PhotonVoiceNetwork.AutoConnectAndJoin = true && PhotonVoiceNetwork.AutoLeaveAndDisconnect = true. The debug log of PhotonVoiceNetwork also confirms that both players reach the "Joined" VoiceState from VoiceConnect.OnVoiceStateChanged(ClientState, ClientState)

    We do have multiple scenes and load a new one when the user joins a room.

    Please let me know if I can provide any other information which may help you.

    Also, thank you for letting me know that importing Photon Voice results in downloading PUN!

    Thank you for your time!
  • Hi @brandon_doghead,

    OK, for the time being, I have the following things to suggest:

    1.
    In "VoiceConnection.cs"
    change
    private void FixedUpdate()
    to
    protected virtual void FixedUpdate()
    
    and then add this to PhotonVoiceNetwork class:
    protected override void FixedUpdate()
            {
                if (PhotonNetwork.IsMessageQueueRunning)
                {
                    base.FixedUpdate();
                }
            }
    2.
    After loading the scene to try force PhotonVoiceView / Speaker linking, on the client that should hear the others, grab the PhotonVoiceView from the instantiated object of the remote players and then disable and re-enable them, you may need to delay that using one frame (inside a coroutine):
    photonVoiceView.enabled = false;
    photonVoiceView.enabled = true;
    Let me know if this helps.
    I know it's tricky since you can't reproduce at 100%.

    The idea is:
    1. delay processing of voice info event (dispatch incoming messages) ==> delay OnRemoteVoiceInfoAction call until the scene finishes loading.
    2. force late linking of PhotonVoiceView/Speaker. Late linking: OnRemoteVoiceInfoAction is called before the Speaker to be linked with the remote voice info is not ready yet. This is done inside PhotonVoiceView.OnEnable using PhotonVoiceNetwork.Instance.CheckLateLinking. Remote voice infos should be cached in the VoiceConnection.cachedRemoteVoices, maybe log those (player Id - voice Id) if you need to check if you got them or not as expected.
  • Hey @JohnTube,

    I implemented both steps listed above, however they did not fix the issue. The OnRemoteVoiceInfoAction call still does not happen after the players and scene have loaded. When the OnRemoteVoiceInfoAction call does happen, the issue does not occur.

    PhotonVoiceNetwork.Instance.CheckLateLinking. is being called after the scene and player have loaded thanks to your suggestion of disabling, waiting one frame, and then re-enabling PhotonVoiceView.OnEnable

    I will give you a little more information on the components' values we are using:
    Our Recorder and Speaker components are linked to the PhotonVoiceView in the inspector and not during runtime. We do have to reinitialize the Recorder using Record.ReInit() since we are changing which microphone is being used during runtime. This issue does occur with both Recorder.MicrophoneType == Recorder.MicType.Unity && Recorder.MicrophoneType == Recorder.MicType.Photon however we are using Recorder.MicrophoneType == Photon

    I hope this information helps. Thank you again for your time. Please, let me know if there are any other solutions which may fix this issue.
  • Hi @brandon_doghead,

    Send us a minimal repro project by exporting a unitypackage.
Sign In or Register to comment.