iOS: output audio to speakers, not the receiver

This commit is contained in:
Flyinghead 2021-08-26 10:02:38 +02:00
parent ad80184e7f
commit 4bf20846bc
1 changed files with 8 additions and 1 deletions

View File

@ -40,8 +40,15 @@ static bool emulatorRunning;
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *error = nil;
[session setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionMixWithOthers
withOptions:AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionDefaultToSpeaker
| AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowBluetoothA2DP
| AVAudioSessionCategoryOptionAllowAirPlay
error:&error];
if (error != nil)
NSLog(@"AVAudioSession.setCategory: %@", error);
[session setActive:YES error:&error];
if (error != nil)
NSLog(@"AVAudioSession.setActive: %@", error);
return YES;
}