From 2ae1c0f5d0c503ef9cf7ed3f2303794fce2eef60 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Apr 2020 09:52:27 -0700 Subject: [PATCH] Allow Bluetooth headphones for iOS playandrecord mode --- Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj | 0 src/audio/coreaudio/SDL_coreaudio.m | 8 ++++++++ 2 files changed, 8 insertions(+) mode change 100644 => 100755 Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj diff --git a/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj b/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj old mode 100644 new mode 100755 diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 676072f37..52b40b6dd 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -370,7 +370,15 @@ static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrec if (category == AVAudioSessionCategoryPlayAndRecord) { options |= AVAudioSessionCategoryOptionDefaultToSpeaker; } + if (category == AVAudioSessionCategoryRecord || + category == AVAudioSessionCategoryPlayAndRecord) { + options |= AVAudioSessionCategoryOptionAllowBluetooth; + } #endif + if (category == AVAudioSessionCategoryPlayAndRecord) { + options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP | + AVAudioSessionCategoryOptionAllowAirPlay; + } if ([session respondsToSelector:@selector(setCategory:mode:options:error:)]) { if (![session.category isEqualToString:category] || session.categoryOptions != options) {