tvOS audio interruption

When minimizing and un-minimizing a game on tvOS - sometimes the audio doesn’t resume correctly.

Generally it happens rarely, but when a BeatEventCallback is active, it happens 25% of the time. ( could just be a coincidence, only managed to reproduce it around 10 times for now. )

I’ve checked the log and OnApplicationPause with mixerResume is being called, even when the audio doesn’t resume. Minimizing and unminimizing after an audio freeze, will make the audio continue again.
This is the last issue blocking our release.

Unity 2019.2.3f1, FMOD 1.10.15

Also how do I get logs to work in a build ? FMODSettings logging is set to LOG, logs work in the Editor, but I won’t get any logs when doing a development/debug build for AppleTV. Thanks

As long as you are using the FMOD logging libs (see iOS audio session interruption) FMOD will provide extra logging. When using the logging libs, if Debug_Initialize isn’t called, it will still be used but using default values (FMOD_DEBUG_LEVEL_LOG and FMOD_DEBUG_MODE_TTY) which will output to the devices console.

Thank you Cameron. I’ve got logs now - I’m not sure what it is tho… maybe a race condition between fmod/unity resuming and tvOS still locking the audio session.

Anyway after the audio freezes, calling mixerResume fires with RESULT_OK, but no audio comes back. Mixer suspend is being called before, which shows in the logs. I’ve uploaded two log files, a short one where it happened after the second try and a longer one where it happened multiple times.

tvOS interestingly fires a native Interruption notification started but doesn’t fire a stopped, with every minimizing/unminimizing action.

I’ve tried calling the native [[AVAudioSession sharedInstance] setActive: TRUE error: nil ]; as well but no luck. Audio will only always come back after loosing and regaining focus ( either Screensaver comes on, or minimizing/un…)

I’ve just created a completely empty FMOD project with 1 event 1 assets, empty Unity Project and reproduced the freeze after 20-30 attempts. Definitely a tick harder to reproduce then in our game.

At least I get the error message now :
[avas] AVAudioSession.mm:998:-[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.

I’m not sure why I can’t see this in our project. ( I guess maybe .net version or exception handling )

I don’t think there is much we can do if the OS isn’t triggering a stopped notification. When an interruption notification triggers, it will tear down the current Audio Session so if we don’t use mixerSuspend/Resume we won’t be able to get the audio back.

Note: There is no guarantee that a begin interruption will have a corresponding end interruption. Your app needs to be aware of a switch to a foreground running state or the user pressing a Play button. In either case, determine whether your app should reactivate its audio session.

From the Apple Audio Session docs.

Hi, old thread but we just experienced this issue on tvOS (14.3) with an Apple TV HD (A8X) with FMOD + Unity integration 2.01.05 (preview package with support for Apple Silicon, from this thread) running on Unity 2020.2.1f1. Was there ever a resolution to this?

We’ve never had this problem with Unity 2019.4.x and FMOD + Unity integration 1.10.19 running on the same hardware.

A race condition or some load-dependent factor is also suspected as a minimal standalone project with just the FMOD integration cannot easily repro this problem (if at all).

I’ve sent a message directly to FMOD support as I’ve discovered the nature of our issue is related to having an active video player component in the scene.

And contrary to what I stated earlier, this issue does occur on Unity 2019.4.x and FMOD integration 1.10.19.