problem with mac OSX

i have use : recorder.ReactOnSystemChanges = true; for checking when user change microphone it work fine on android ,pc , ios but it's cause lagging on mac osx , please help me to fix it


  • JohnTube
    JohnTube ✭✭✭✭✭
    edited September 2021
    Hi @wromRed,

    What Unity version is this?
    What Photon Voice version is this?

    Do you use Photon microphone type or Unity microphone type?
    Did you enable Recorder.SkipDeviceChangeChecks?

    This could be due to a known issue yes.
    Somehow Unity's OnAudioConfigChange callback that we rely on is triggered multiple times on macOS.
  • hi @JohnTube yes , i have edit function OnAudioConfigChange callback like this theard :
    it's remove lagging but now no audio send from mac , i set microphone type to photon
  • any news , i really need help for this case please
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @wromRed,

    My colleague @vadim implemented audio device change handling in native plugin for macOS.
    I will prepare a version for you to test asap.
    Expect it this week.

    Thank you for your patience and understanding!
  • wromRed
    edited September 2021
    hello @JohnTube so for now it's has issue no audio for photon voice on macOS ? please confirm because I need to report for my user
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @wromRed,

    Please download and import this version to see if it fixes the lagging in macOS when microphone changes. (preferably clean install, backup first or always use VCS properly)
    Keep Recorder.ReactToSystemChanges = true.
    Do not make any other modifications.
  • Has this been fixed? We are observing this in Unity 2020.3.39 in macOS

  • What version of Voice? The current is 2.50.

  • We are using v2.22.22 still as we never had issues until now. Is this fixed in newer versions? I will update if its fixed but its not easy for us to just update to test as we have many versions for different platforms

  • We had server-side issues recently. If you did not update your client, your problems could be caused by these issues.

  • EdDC
    edited November 2022

    Hi guys and @vadim! I have almost the same issue with OSX. The AudioChangeHandle detects audio device change after each "Speaker" creation in runtime, even if I do not have any extra microphones attached to my mac machine. And that causes a Restart for the Recorder and recreation of the speaker object, also during each creation of the Speaker it makes a huge lag and freezes the game for 1-2 seconds. So it becomes as an endless loop of -> Recorder Restart -> Lag -> Speaker Creation -> and so on.

    I have checked both echo mode, multiplayer, and editor and build. Same issue...

    Also, I have checked the assigned AudioChangeHandle from the inspector and at runtime before starting the recorder.

    It works just well for Windows 11.

    My OS version is macOS Monterey, version 12.6

    Voice chat version: v2.50 (October 2022)

    Unity 2021.3.9f1

    Photon Fusion : 1.1.4, F, Build 609 (Nov 01, 2022)

    Let me know if you need any additional information! I spent about a week to get my own solution to fix that issue but it seems like the issue comes from Photon(Microphone) native plugin. The chosen Microphone type is Photon(but it doesn't work with Unity as well).

  • Hi,

    Device change detection component for MacOS is broken.

    The workaround is to get the list of devices with device enumerator instance (Platform.CreateAudioInEnumerator) and compare it with the previously saved list before calling this.recorder.MicrophoneDeviceChangeDetected() in AudioChangesHandler.OnDeviceChange()

  • Thanks, @vadim ! I'll try to do with that way and let you know in case of any other issues.

    Do you plan to have a fix for this in the upcoming weeks?

  • vadim
    vadim mod
    edited November 2022

    I tried to fix the native plugin but did not succeed. So maybe the fix will be the same as the workaround. It's simple, does not require many resources and does not depend on obscure and poorly documented api details.