From dd4429df25b0304b5bea005ffc74b6438e33cf0d Mon Sep 17 00:00:00 2001 From: Ian Clarkson Date: Wed, 25 Oct 2023 23:28:10 -0700 Subject: [PATCH] Fixes #1294 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://developer.apple.com/documentation/avfaudio/avaudiosessioncategoryoptions/avaudiosessioncategoryoptionallowairplay Apple's documentation states that "You can only explicitly set this option if the audio session’s category is set to AVAudioSessionCategoryPlayAndRecord." Change the code so that it's only explicitly enabled in that specific category. --- modules/juce_audio_devices/native/juce_Audio_ios.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_devices/native/juce_Audio_ios.cpp b/modules/juce_audio_devices/native/juce_Audio_ios.cpp index 148d5a5aec97..87a33d7645c2 100644 --- a/modules/juce_audio_devices/native/juce_Audio_ios.cpp +++ b/modules/juce_audio_devices/native/juce_Audio_ios.cpp @@ -276,7 +276,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater static void setAudioSessionCategory (NSString* category) { - NSUInteger options = AVAudioSessionCategoryOptionAllowAirPlay; + NSUInteger options = 0; #if ! JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS options |= AVAudioSessionCategoryOptionMixWithOthers; // Alternatively AVAudioSessionCategoryOptionDuckOthers @@ -285,7 +285,8 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater if (category == AVAudioSessionCategoryPlayAndRecord) { options |= AVAudioSessionCategoryOptionDefaultToSpeaker - | AVAudioSessionCategoryOptionAllowBluetooth; + | AVAudioSessionCategoryOptionAllowBluetooth + | AVAudioSessionCategoryOptionAllowAirPlay; if (@available (iOS 10.0, *)) options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;