Losing voice chat when changing scene

Hello,

I have a unity application with several scenes and using Photon Voice.

I change scenes with PhotonNetwork.LoadLevel.
I keep the voice chat on by applying DontDestroyOnLoad on the character prefab with the photon voice scripts.

On some occasions, when changing scenes, Photon voice seems to time out. But the players are still connected to the room.

Is there a way to reconnect to Photon Voice?


Thank you in advance for your help!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @AntoineR,

    Thank you for choosing Photon!

    What is the Photon Voice version you use?
    What is the Unity version you use?

    On some occasions, when changing scenes.

    How long does it take for the scene to load?
    Photon voice seems to time out
    The background thread should keep the connection alive.
    I need to check if it sends ACKs only or it can keep sending and receiving voice data.
    What do you mean by time out? is the voice client state disconnected or you just stop hearing the voice of other players?
    But the players are still connected to the room.
    Do you mean "PUN room" or "voice room"?

    Can you provide any logs?

    Is there a way to reconnect to Photon Voice?
    Yes you could call
    Connect
    as soon as you lose the connection, but I think this is done automatically for you.
  • Hello,

    Thank you for your answer!

    I am using:
    Photon Voice: 1.8
    Unity: 5.4.2f2

    Some scenes can take 10-15 seconds to load.

    I meant PUN room.

    Here are the logs I get when losing the voice chat. Sorry, should have sent you this first:

    PUNVoice: Got a unexpected Disconnect in LoadBalancingClient State: Disconnected. at ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnStatusChanged(StatusCode statusCode) in E:\BackupsAB
    \hns4_33\Assets\Photon\Plugins\PhotonLoadbalancingApi\LoadBalancingClient.cs:line 2268
    at ExitGames.Client.Photon.PeerBase+<>c__DisplayClass148_0.b__0()
    at ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands()
    at ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands()
    at ExitGames.Client.Photon.PhotonPeer.Service()
    at ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.Service() in E:\BackupsAB\hns4_33\Assets\Photon\Plugins\PhotonLoadbalancingApi\LoadBalancingClient.cs:line 838
    at ExitGames.Client.Photon.Voice.LoadBalancingFrontend.Service() in E:\BackupsAB\hns4_33\Assets\Photon\Plugins\PhotonVoiceApi\LoadBalancingFrontend.cs:line 137
    at PhotonVoiceNetwork.Update() in E:\BackupsAB\hns4_33\Assets\Photon\PUNVoice\Scripts\PhotonVoiceNetwork.cs:line 201
    UnityEngine.Debug:LogWarning(Object)
    UnityVoiceFrontend:DebugReturn(DebugLevel, String)
    (at Assets/Photon/PUNVoice/Scripts/PhotonVoiceNetwork.cs:342)
    ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:OnStatusChanged(StatusCode) (at
    Assets/Photon/Plugins/PhotonLoadbalancingApi/LoadBalancingClient.cs:2270)
    ExitGames.Client.Photon.<>c__DisplayClass148_0:b__0()
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands
    ()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:Service()
    ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:Service() (at
    Assets/Photon/Plugins/PhotonLoadbalancingApi/LoadBalancingClient.cs:838)
    ExitGames.Client.Photon.Voice.LoadBalancingFrontend:Service() (at Assets/Photon/Plugins/PhotonVoiceApi/LoadBalancingFrontend.cs:137)
    PhotonVoiceNetwork:Update() (at Assets/Photon/PUNVoice/Scripts/PhotonVoiceNetwork.cs:201)




    Sometimes I also get this log:

    PUNVoice: Player 2 voice # 1 speaker unlinked.
    UnityEngine.Debug:LogFormat(String, Object[])
    UnityVoiceFrontend:OnRemoteVoiceRemove(Int32, Int32, Byte, Object) (at
    Assets/Photon/PUNVoice/Scripts/PhotonVoiceNetwork.cs:451)
    ExitGames.Client.Photon.Voice.VoiceClient:removePlayerVoices(Int32, Int32) (at Assets/Photon/Plugins/PhotonVoiceApi/Core/VoiceClient.cs:1084)
    ExitGames.Client.Photon.Voice.LoadBalancingFrontend:onPlayerLeave(Int32) (at Assets/Photon/Plugins/PhotonVoiceApi/LoadBalancingFrontend.cs:304)
    ExitGames.Client.Photon.Voice.LoadBalancingFrontend:onEventActionVoiceClient(EventData) (at Assets/Photon/Plugins/PhotonVoiceApi/LoadBalancingFrontend.cs:273)
    ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:OnEvent(EventData) (at Assets/Photon/Plugins/PhotonLoadbalancingApi/LoadBalancingClient.cs:2497)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:Service()
    ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:Service() (at Assets/Photon/Plugins/PhotonLoadbalancingApi/LoadBalancingClient.cs:838)
    ExitGames.Client.Photon.Voice.LoadBalancingFrontend:Service() (at Assets/Photon/Plugins/PhotonVoiceApi/LoadBalancingFrontend.cs:137)
    PhotonVoiceNetwork:Update() (at
    Assets/Photon/PUNVoice/Scripts/PhotonVoiceNetwork.cs:201)



    Best
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @AntoineR,

    We have fixed this in Voice v1.9

    ADDED: PhotonVoiceHandler to implements a fallback thread that keeps sending ACKs when in background (Android) or keeps service loop when loading scenes.


    I recommend you update to latest v1.12.
  • Thanks, will try this!
  • Hello, after importing the latest Photon Voice package from the Unity Asset Store, I get these errors:

    Assets/PUNVoice/Scripts/PhotonVoiceNetwork.cs(252,30): error CS0115: `PhotonVoiceNetwork.BufferReaderPushAdapterAsyncPoolFloatToShort.Service(ExitGames.Client.Photon.Voice.LocalVoice)' is marked as an override but no suitable method found to override

    And

    Assets/PUNVoice/Scripts/PhotonVoiceRecorderShort.cs(22,30): error CS0115: `PhotonVoiceRecorderShort.BufferReaderPushAdapterAsyncPoolFloatToShort.Service(ExitGames.Client.Photon.Voice.LocalVoice)' is marked as an override but no suitable method found to override


    Best

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @AntoineR,

    You probably did not remove old Photon Voice before.
    Please clean up Photon Voice files from your project then import Photon Voice again.

    Sorry for the inconvenience.
  • AntoineR
    AntoineR
    edited October 2017
    It seems to have fixed the problems. Thanks a lot for your help!

    By the way, here is the game we are using Photon for:
    Hide N Seek VR
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @AntoineR,

    Hide and seek in VR, clever, original, brilliant idea!

    Please fill this form so we could add you to our #madeWithPhoton page here.

    peek a boo!
  • Thanks for the offer! I filled the form.