On iOS, when setting JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS=1, the audio session is failing to restart when an interruption has ended, ultimately hitting a JASSERT.
When enabling JUCE_IOS_AUDIO_LOGGING this is the console output immediately before the assertion:
handleStatusChange: enabled: 0, reason: AVAudioSessionInterruptionTypeBegan AVAudioSessionInterruptionTypeBegan handleStatusChange: enabled: 1, reason: AVAudioSessionInterruptionTypeEnded iOS Audio error: Session activation failed: JUCE Assertion failure in juce_Audio_ios.cpp:227
And this is the call stack, all in juce_Audio_ios.cpp (most recent first): Line 395: JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setActive: enabled error: &error]); Line 982: SetAudioSessionActive(enabled); Line 1720: device->handleStatusChange (enabled, reason); Line 180: audioSessionHolder->handleStatusChange (true, “AVAudioSessionInterruptionTypeEnded”);
Have tested on physical iPhones with both iOS 18 and 26 using my app and the AudioPlayBackDemo.
I have found a work around the issue by registering my own AVAudioSession options and AVAudioSessionInterruptionNotification handling, commenting out some things in juce_audio_ios.cpp, then restarting the audio session myself later using the device manager but it’d be preferable not to have to modify any JUCE code just to do this.
Maybe I’m completely missing something here with AudioIODeviceCallbacks, but it feels like there isn’t any way to handle iOS interrupts gracefully using JUCE. They are discussed in this thread from years ago: Callback on audio session interrupts and routing changes But I can’t see any other topics on it. The discussed interruptionHandler appears to have just become audioSessionChangedInterruptionType. I tried the audioDeviceError callback trick but it caused me more issues than it resolved.
Kris.
