Mic doesn't work after being disconnected

I'm currently using PUN Voice 2 on a MacBook pro and Surface Book. The mic works if there are no earphones connected (using the laptop audio) or when the earphones are connected (using the external audio). But once I disconnect earphones, the mic input doesn't revert back to the laptop audio, and vice versa. Is there something I need to do to fix this?

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    Thank you for choosing Photon!

    Please update to the latest Photon Voice 2 and retry.

    Make sure to enable Recorder.ReactOnSystemChanges and Recorder.SkipDeviceChangeChecks.

  • Hi John,

    I updated to the latest version of Photon Voice 2 and made sure Recorder.ReactOnSystemChanges and Recorder.SkipDeviceChangeChecks were enabled. But, it still doesn't work. Also, I'm using Unity 2019.4.15f1.

    Is there anything else I should try to get it working?

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    What microphone type did you try ? Unity or Photon? try both.

    If you increase log level of Recorder to INFO what do you see in the logs?

    Use Recorder.RestartRecording(true) to force restart and fix this manually for now.

  • I tried using both the Unity and Photon mic but it still doesn't work.

    This is what my debug log shows.

    I also set Recorder.RestartRecording(true) on start, but I still have the same issue. Although I do get a warning saying "Recorder does not require restart"

    I also tried the solution from https://forum.photonengine.com/discussion/comment/54426/#Comment_54426 but that didn't work either.

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2021

    Hi @dhishii,

    Please set log level of Recorder component/script to INFO or Recorders global log level to INFO from PhotonVoiceNetwork.

    I'm interested in the Recorder's logs and not PhotonVoiceNetwork.

    Also, you probably forgot to call set 'true' as parameter when you called Recorder.RestartRecording(true).

    The other forum thread is about Android and microphone permissions.

  • dhishii
    dhishii
    edited November 2021

    Hi @JohnTube

    Thank you for getting back to me.

    Sorry, I thought I had set it to true the previous time.

    This should be the Recorder and PhotonVoiceNetwork logs with Recorder.RestartRecording(true) on start and the microphone set to Photon.

    I started the scene and my mic works. Then I turn off my bluetooth earphones/mic and the pop up appeared. If I enter my password, Unity crashes.

    However, if I build the scene, the mic doesn't work at all.


  • This should be the Recorder and PhotonVoiceNetwork logs with Recorder.RestartRecording(true) on start and the microphone set to Unity.

    I started the scene and I couldn't hear any audio. Then I turn off my bluetooth earphones/mic and Unity crashed


  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    Make sure Photon Voice 2 version is 2.27.1

    Please retry with the following settings:

    Recorder.RecordOnlyWhenJoined = true

    Recorder.MicrophoneType = Photon

    Also send full player or editor log file. See here for how to get those.

    Upload somewhere and share link here or attach directly.

  • Hi @JohnTube

    Thank you for your help.

    I am currently using Photon Voice 2 version 2.27.1

    My settings Voice settings are as following.

    Recorder.RecordOnlyWhenJoined = true

    Recorder.MicrophoneType = Photon


    Attached is the Editor Log.


  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    Thanks for taking the time to reproduce and provide the logs.

    We will take it from here and get back to you once we find out what's wrong.

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2021

    Hi @dhishii,

    Can you replace one line 1554 of Recorder class, CreateLocalVoiceAudioAndSource method in "Assets\Photon\PhotonVoice\Code\Recorder.cs" as follows:

    from

                  this.inputSource = new MacOS.AudioInPusher(hwMicDevId, this.Logger);
    

    to

                  this.inputSource = new MacOS.AudioInPusher(hwMicDev.IsDefault ? -1 : hwMicDev.IDInt, this.Logger);
    

    then retry?

    Thanks.

  • Hi @JohnTube

    Thank you for checking the logs. I changed the line in the Recorder.cs but I had the same crashing problem.

    Could this problem be from using Unity collab between Mac and Windows? When I first downloaded Photon Voice 2 (Windows), made changes, uploaded, then downloaded on Mac, there were some errors. But, if I reimported the latest Photon Voice 2 package, the errors would be gone. I don't know if that would cause any issues.

    Attached is a copy of the log.


  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    Please import this patch in your project and retry now.

    I saw mentions of OVR, please read this.

    When I first downloaded Photon Voice 2 (Windows), made changes, uploaded, then downloaded on Mac, there were some errors

    Could you by chance remember of know more about those errors?

  • Hi @JohnTube

    Thank you for getting back to me. The patch helped, but when I disconnect my earphones and it switches back to the Macbook audio and mic, the quality drops significantly to the point where the other users can't understand what I'm saying. It's very choppy. The audio does work properly before it's disconnected.

    We no longer needed the OVR package for this build so I removed that.

    I know it was related to the "PhotonVoiceLibs/OSX" folder. But removing the Photon Voice 2 package and re-adding it did clear the errors. Sorry, I can't remember what exactly it was. Should I try to replicate it?

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    the quality drops significantly to the point where the other users can't understand what I'm saying. It's very choppy

    This is a different problem.

    Try changing microphone type to Photon or adding WebRtcAudioDsp and enabling some of its effects.

    Or tweak audio settings.

    The patch helped

    Thanks for testing and confirming.

    We will add this to the next version release.

    Sorry, I can't remember what exactly it was. Should I try to replicate it?

    No need, no worries.

  • Hi John,

    Thank you for all your help. I also found out that removing all the XR and Oculus plugins helped (since we don't need to use it for now).

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @dhishii,

    FYI: Photon Voice 2.28 is released with the fix for the issue you reported.

    Please update and confirm it works as expected now.

    Thanks for your time and help.