photon voice stop working after application pause

Options
zine
zine
edited June 2020 in Photon Voice
I used photon voice 2.15, and I found out after press home button(iOS), the voice stops working, seems it is unlink.
Does anyone have some ideas how to prevent this issue? I also think about to rejoin the photon voice, but did not find a proper solution. rejoin the PUN server solves, however won't fit to my need, just would like to restart or rejoin the voice, specifically the previous photon voice room..
If anyone has an idea, just leave here a message, thanks a lot.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @zine,

    Thank you for choosing Photon!

    Update to the latest Photon Voice 2.
    Try setting Recorder.StopRecordingWhenPaused = true (from editor or code).
    I also think about to rejoin the photon voice, but did not find a proper solution. rejoin the PUN server solves, however won't fit to my need, just would like to restart or rejoin the voice, specifically the previous photon voice room..
    Rejoining PUN room should automatically join the same previous Photon Voice room.
  • zine
    zine
    edited June 2020
    Options
    Hi @JohnTube, thank you for your reply.
    JohnTube wrote: »
    Hi @zine,

    Thank you for choosing Photon!

    Update to the latest Photon Voice 2.
    Try setting Recorder.StopRecordingWhenPaused = true (from editor or code).
    I also think about to rejoin the photon voice, but did not find a proper solution. rejoin the PUN server solves, however won't fit to my need, just would like to restart or rejoin the voice, specifically the previous photon voice room..
    Rejoining PUN room should automatically join the same previous Photon Voice room.

    May I ask by rejoining PUN room you meant rejoin the PUN room or only rejoin the photon voice room, since I don't want to leave or quit the PUN room, rejoin would also cause problem for me, so I only want to reconnect the voice.
    If you meant is keep the PUN room and reconnect the voice, could you point me the code to do this? cause PhotonVoiceNetwork auto connect and join setting does not work in this situation.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @zine,

    You are reporting that Photon Voice stops working on iOS when the application is paused.
    This can happen because of one of two reasons:

    A. Photon Voice client disconnects due to timeout.
    B. Photon Voice stream's audio session is broken on iOS.

    A: most likely PUN client will also be disconnected and PUN needs to recover from this as well. So if PUN client will rejoin the PUN room, Photon Voice client will follow and join a voice room and voice should resume working normally. Unless you have PhotonVoiceNetwork.AutoConnectAndJoin set to false or an error happens when trying to join the voice room from the voice client. Enable SupportLogger from PhotonVoiceNetwork to see any errors.

    B: Update to the latest Photon Voice 2. Try setting Recorder.StopRecordingWhenPaused = true (from editor or code). Or explicitly restart recording when application is unpaused: IsRecording = false then IsRecording = true.
  • zine
    Options
    @JohnTube thanks a lot, my case was the second reason you mention, the Pun client is still connected, only the voice is broken on iOS, it works perfect with the second solution, thanks again.
    A following question since the PUN client might be disconnected after pause, and I noticed that it is by default 10 seconds.
    I want to extend the time by "PhotonNetwork.KeepAliveInBackground = 60f;", but it still takes 10 seconds, is there however a way to change the default time?


  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @zine,
    I want to extend the time by "PhotonNetwork.KeepAliveInBackground = 60f;", but it still takes 10 seconds, is there however a way to change the default time?
    The backbround thread does not work on iOS. No solution for iOS unless you self-host and change timeout on your servers' config.