瀏覽代碼

Allow Bluetooth headphones for iOS playandrecord mode

Sam Lantinga 6 年之前
父節點
當前提交
2ae1c0f5d0
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj

+ 8 - 0
Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj

@@ -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) {