2023.3.XThird Party Issue
In this Unity project, a 3rd party plugin is capturing microphone data. It looks like the plugin is also making AVAudioSession changes. Much of the iOS AVAudioSession state is global, so once a plugin starts making those kinds of changes, the behavior is out of Unity's control. For example, when capturing mic data, by default the audio output will start getting routed only to the ear speaker, which will cause the overall volume to get reduced drastically. The plugin likely needs to add a line of code similar to the following to force both built-in output speakers to get used in this case:
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&osError];
I would guess the reason it works on some phones and OS versions, and not on others, is just the timing between when the Unity AVAudioSession code runs and when the plugin's AVAudioSession code runs. We've often seen this erratic behavior before when 3rd party code is making AVAudioSession changes.