Native Android screen recorder causes Microphone to stop working

Hello! The game I’m working on makes heavy use of microphone input data, and I’ve realized that starting the native android screen recorder causes the microphone to stop accepting input.

Important facts:

  • Audio data is being captured with sound.lock() and sound.unlock()
  • This only happens when screen recorder is capturing microphone data
  • Getting input driver info before, during, and after does not reveal any change to the driver state
  • Trying to start recording while screen capture is active does not result in any error. Here’s where it gets extra weird: if I restart recording while capturing microphone only I can retrieve audio data again. If I’m recording microphone and device audio I won’t be able to retrieve any audio data, regardless of how much I try to restart the recording.
  • Unity version 2020.1.17, FMOD version 2.01.07
  • Android version 11

Thank you for any advice!

Hi BadDreamGames,

We’ve reproduced this issue - it looks to be an issue with our AAudio output support. We have been able to reproduce the issue and will look to fix this in a future version.

If you would like to work around it, if you call and set the type to FMOD_OUTPUTTYPE_OPENSL, that will work around the issue until we are able to get it fixed.

Thanks for the response Tristan. We’ve been using Open SL, and I made sure that nothing else was changing the output type by explicitly checking at each step. Using that output type does not change the issue.

Ok, I’ve tested on another handset and I’ve been able to reproduce the issue with OpenSL. On this particular handset, it looks like the screen recorder is taking over microphone input while its running. If that’s the case, and its handset specific behaviour, there may not be much we can do, at least with OpenSL. We will look to resolve the issue with AAudio and see if that presents a different way to get this working.