voice not working after switching scenes

Arivazhagan
edited November 2018 in Photon Voice
when I switch the scenes voice is not working and it shows the error as,

OnDisconnected cause=DisconnectByServer
UnityEngine.Debug:LogErrorFormat(String, Object[])
Photon.Voice.Unity.UtilityScripts.ConnectAndJoin:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonVoice/Code/UtilityScripts/ConnectAndJoin.cs:155)
Photon.Realtime.ConnectionCallbacksContainer:OnDisconnected(DisconnectCause) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3240)
Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2371)
ExitGames.Client.Photon.<>c__DisplayClass100_0:b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:893)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:429)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1428)
Photon.Voice.Unity.VoiceConnection:FixedUpdate() (at Assets/Photon/PhotonVoice/Code/VoiceConnection.cs:304)

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Arivazhagan,

    Thank you for choosing Photon!

    You need to set the GameObject to which the VoiceConnection script is attached to as DontDestroyOnLoad so it persists across scenes.
    If you use PhotonVoiceNetwork it has this option built-in.

    But I doubt that your issue is related to scene switching as if it was the case the DisconnectCause would be TimeoutDisconnect.
    Make sure you are not sending too much to the server.
  • Can I know when the error will come as DisconnectByServer?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Arivazhagan,

    What do you mean?
    I have checked the code of DisconnectCause and it seems I was wrong about something:
    /// <summary>OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgements from the client).</summary>
            ServerTimeout,
            /// <summary>OnStatusChanged: The server disconnected this client. Most likely the server's send buffer is full (receiving too much from other clients).</summary>
            [Obsolete("Replace with: ServerTimeout (same value).")]
            DisconnectByServer = ServerTimeout,
    /// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time.</summary>
            ClientTimeout,
            /// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time.</summary>
            [Obsolete("Replace with: ClientTimeout (same value).")]
            TimeoutDisconnect = ClientTimeout,
    DisconnectByServer is now obsolete and replaced with ServerTimeout.
    The TimeoutDisconnect is also obsolete is replaced with ClientTimeout.

    Loading level can take too much time (> 10 seconds) during which the server will disconnect the client if the latter "does not show any sign of life" (reply or send back ACKs to the server).
    So the solution is to have the GameObject to which VoiceConnection (or PhotonVoiceNetwork) component attached set as DontDestroyOnLoad to persist between scenes.
  • Arivazhagan
    edited December 2018
    Yeah I set it on DontDestroyonload, But I'm having the error
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Arivazhagan,

    I managed to reproduce and I'm trying to fix this.
    Will post an update here if I make it work as expected.
    Sorry for the inconvenience!
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Arivazhagan,

    Could you try replacing "Photon/PhotonVoice/Code/VoiceConnection.cs" with this and test again?
  • yeah, It's working...thanks for your support.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Thank you for your help!
    We will include this fix in the next update.
  • JohnTube
    JohnTube ✭✭✭✭✭
    FYI:
    This was fixed in Photon Voice 2.1.3.
  • That script you gave was not working also. At first, it works now I'm checking it again it's not working.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Arivazhagan,

    Forget about the patched file.
    Update to 2.1.3 and check again.
    How do you test this?
  • I'm using version 2.1 that came on November 8th, 2018, is it updated?
    If not, can I know how to update the newest version?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Currently, last version is 2.1.3 released on December 7th, 2018.
    The update is done via Unity Asset Store.
    You should get notifications from Unity Asset Store about assets that has updates.
  • Arivazhagan
    edited December 2018
    After updating to the new version voice is not working.
  • JohnTube
    JohnTube ✭✭✭✭✭
    I don't understand how you confirmed that it's working the first time then it stopped working for you.
    If this is a random behaviour where you can't reproduce 100% then it is tricky to debug.

    Does this happen in the Unity Editor or in a build? if it's a build which platform?
    what Unity version is this?
    could you send us a minimal repro project?