Microphone not reconnecting upon application unpause on iOS

I can see other players, I can hear other players, but they can't hear me.

iOS
join room - using autoconnectandjoin checkbox on PhotonVoiceNetwork
swipe to go to home screen, and come back
no more mic

in OnApplicationPause
tried a bunch of things (resetting mic, disconnecting/reconnectnig, never comes back?

What am I doing wrong!?

Comments

  • Hi @gergtrom,

    Thank you for choosing Photon!

    What Photon Voice version is this?
    Does this happen with the demo scenes from the package?
    Does this happen with MicrophoneType Unity or Photon or both?
  • Voice 2
    2.15.0

    PUN 2
    2.17.1

    Photon type


    I am not sure if it happens on a demo scene right now. still trying to figure this out in my scene using the demo scene scripts :/ been a long day and we aren't any closer
  • Any update on this? Having the same issue. Thanks.
  • JohnTubeJohnTube mod
    edited April 26
    Hi @gergtrom, @Grant,

    Could you try adding the following code to the Recorder.cs
    private bool wasRecordingBeforePause;
    
            [SerializeField]
            private bool stopRecordingInBackground = true;
    
            private void OnApplicationPause(bool paused)
            {
                if (this.Logger.IsInfoEnabled)
                {
                    this.Logger.LogInfo("OnApplicationPause({0})", paused);
                }
                this.HandleApplicationPause(paused);
            }
    
            private void OnApplicationFocus(bool focused)
            {
                if (this.Logger.IsInfoEnabled)
                {
                    this.Logger.LogInfo("OnApplicationFocus({0})", focused);
                }
                this.OnApplicationPause(!focused);
            }
    
            private void HandleApplicationPause(bool paused)
            {
                if (paused)
                {
                    if (this.stopRecordingInBackground)
                    {
                        this.wasRecordingBeforePause = this.IsRecording;
                        if (this.wasRecordingBeforePause)
                        {
                            if (this.Logger.IsInfoEnabled)
                            {
                                this.Logger.LogInfo("Stopping recording as application went to background");
                            }
                            this.StopRecording();
                        }
                    }
                }
                else if (this.wasRecordingBeforePause)
                {
                    if (this.Logger.IsInfoEnabled)
                    {
                        this.Logger.LogInfo("Starting recording as application is back from background");
                    }
                    this.StartRecording();
                }
            }
    
  • never could figure that out - I did do something very similar to what you propose (though this looks like it might have worked)
    I ended up going away from the PhotonVoiceNetwork and did the non PUN integration with adding a voiceconnection and a ConnectAndJoin script. those worked fine.
    I don't think the PhotonVoiceNetwork script is handling the restart of the recorder properly out of the box
  • Hi @gergtrom,

    That's weird, PhotonVoiceNetwork extends VoiceConnection so not sure how it changes the behaviour here.

    Just to be clear, this happens only on iOS?
    Not in Unity Editor, not in macOS / Windows builds, not in Android?

    Maybe simply the PUN or Voice clients are disconnected due to timeout.
    Maybe the solution is to reconnect & rejoin the room?
Sign In or Register to comment.