When a timer goes of or a call comes in on iOS, the game automatically mutes, but doesn’t unmute until manually tabbing in and out. I’ve looked at the mixerSuspend and mixerResume functions, and they are being called on OnApplicationPaused already in the FMODRuntimeManager - this should be a very common scenario, do you have any guidelines on how to achieve this in UNITY ? I’ve seen the iOS specific guide but how can I add a listener for the AVAudioSessionInterruptionNotification?
Neither OnApplicationPause nor OnApplicationFocus are triggered on interruptions…
Unity 2019.2.3 ( also tested in unity 2019.1.8) and FMOD Unity integration V 1.10.15 ( tried 1.10.9 previously ) It is actually only happening for timers/alarms - calls where fine on my last test.
EDIT: Tested on iOS12 and iOS13 Beta
I’m not getting anything in the logs. I had mine set to Warning, I will change it and test again. Does it fire OnApplicationFocus for you when alarm pop up comes in ? Is that supposed to fire?
FMOD Studio: Device iPhone9,3 classed as MobileHigh
FMODUnity.RuntimeUtils:GetCurrentPlatform()
FMODUnity.RuntimeManager:Initialize()
FMODUnity.RuntimeManager:get_Instance()
FMODUnity.RuntimeManager:get_StudioSystem()
FMODUnity.RuntimeManager:GetBus(String)
I’m just getting these initialisation logs at start up, and no logs whatsoever after that with logging set to LOG.
What I do is:
Set Alarm to 10 seconds, go back into the game, swipe the alarm banner away ( don’t click on it ) Audio will stop, no logs.
Currently testing with Unity 2019.2.3, XCode 10.3 and Xcode 11 on iOS 12 and iOS 13, iPhone SE, 2 different iPads and iPhone 7 - Same issues reproducible everywhere for me.
Ah yes, I was able to reproduce this. I was dismissing the notification differently which was causing the sound to come back.
It looks like what is happen is the OS is muting the game when it gets the notification, but then doesn’t un-mute it when the notification stops. The system does trigger a ‘AVAudioSessionInterruptionNotification’ when the notification starts and finishes but this does not appear to trigger Unity’s OnApplicationFocus.
Glad you managed to reproduce it, I was about to create an empty project and send that along.
No way around writing my own native plugin to fix this then? Thank you
Just implemented the plugin, but it still won’t work, the audio doesn’t come back.
I have an issue on tvOS as well where the audio sporadically just won’t work, and calling mixerResume or unPause won’t have any effect, only way to get the audio back is minimizing and unminimizing the app. ( both for this issue and the tvOS issue)
mixerResume won’t do anything if mixerSuspend has not been called before hand. Depending on how the app has interrupted it may not be getting suspended. Add some logging to make sure they are being called and in the order they need to be in.
Mixer suspend is being called I have the debug.log.
Fmod logs(appart from the initialzation) won’t work on iOS/tvOS builds, what do I need to do get them to work?
Thanks cameron. I was missing the static lib step.
So calling mixerSuspend on the AudioInterruption event (or anywhere else, I tried calling it sporadically)
doesn’t create any log or do anything. Pausing all events, effectively pauses all events, but also doesn’t create any log.
I’m using LOG as logging level.
When tabbing in and out however mixerSuspend and mixerResume logs show up correctly. (fired from your RuntimeManager implementation in OnApplicationFocus)
Is the fmodSystem you are using to call mixerSuspend/Resume the same system from FMODUnity.RuntimeManager.CoreSystem or FMODUnity.RuntimeManager.StudioSystem.getCoreSystem.
mixerSuspend/Resume will both return an FMOD.RESULT that will tell you if they fail for some reason.
Native plugin with AVAudioSessionInterruption + marshalling callback does the trick.
UnitySendMessage is async and might have caused some issues here too.