Only thing that might smell here to me is the ambient session category: looking at FMOD docs it seems like FMOD might try to use the solo ambient category, but here we set to ambient.
Will FMOD try and alter the session category under the covers?
FMOD 5 will not touch the audio session API (unlike FMOD 4). With FMOD 5 it is up to you to configure an activate it. Make sure you call setActive also:
I think I found a fix. Once I ensured we had the audio sesstion setActive call, I was able to catch that it was also failing.
In another FMOD forum post someone on the FMOD team mentioned: “We had some troubles a while back with certain devices reporting init errors because the internal audio state was in flux. Generally closing the FMOD system and try again was sufficient to recover.”
So, I took that 1 level lower, and would retry (after a small sleep) the setActive call, and it works.
I’m glad you were able to work around the issue, the comment was likely from me. I’ve certainly seen cases where the phone has transitioned to the foreground but as far as the audio system is concerned it is still backgrounded causing the AudioSession errors.