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


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-
Photon Voice 2 -

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: ... Updating to v2.6 did fix the issue discussed in post #1.

Post #2: ... 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!


  • JohnTube
    JohnTube ✭✭✭✭✭
    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!
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @brandon_doghead,

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

    In "VoiceConnection.cs"
    private void FixedUpdate()
    protected virtual void FixedUpdate()
    and then add this to PhotonVoiceNetwork class:
    protected override void FixedUpdate()
                if (PhotonNetwork.IsMessageQueueRunning)
    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.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @brandon_doghead,

    Send us a minimal repro project by exporting a unitypackage.
  • Hey @JohnTube,

    Sorry for the late reply.

    We believe the issue is caused from PhotonVoiceNetwork.Instance.Client.AppId being lost somehow during the programs execution. We have eliminated the issue by forcing the AppID of the PhotonVoiceNetwork.Instance.Client when we create an instance of our networked client.

    With the current state of our project, we cannot delegate time to recreating a repro project since the solution listed above has sufficed. However, thank you for your time. I will be sure to post here again if this issue reoccurs and our solution becomes obsolete.

    Thanks again!
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @brandon_doghead,

    Thank you for the update.
    Let us know if the issue persists after all this.