Merge pull request #89006 from LeonardoDemartino/ios_playandrecord_volume
Fix low volume sound output on iOS when Play and Record category is used
This commit is contained in:
commit
1a7f694b40
@ -105,11 +105,17 @@ static ViewController *mainViewController = nil;
|
|||||||
|
|
||||||
// Initialize with default Ambient category.
|
// Initialize with default Ambient category.
|
||||||
AVAudioSessionCategory category = AVAudioSessionCategoryAmbient;
|
AVAudioSessionCategory category = AVAudioSessionCategoryAmbient;
|
||||||
|
AVAudioSessionCategoryOptions options = 0;
|
||||||
|
|
||||||
|
if (GLOBAL_GET("audio/general/ios/mix_with_others")) {
|
||||||
|
options |= AVAudioSessionCategoryOptionMixWithOthers;
|
||||||
|
}
|
||||||
|
|
||||||
if (sessionCategorySetting == SESSION_CATEGORY_MULTI_ROUTE) {
|
if (sessionCategorySetting == SESSION_CATEGORY_MULTI_ROUTE) {
|
||||||
category = AVAudioSessionCategoryMultiRoute;
|
category = AVAudioSessionCategoryMultiRoute;
|
||||||
} else if (sessionCategorySetting == SESSION_CATEGORY_PLAY_AND_RECORD) {
|
} else if (sessionCategorySetting == SESSION_CATEGORY_PLAY_AND_RECORD) {
|
||||||
category = AVAudioSessionCategoryPlayAndRecord;
|
category = AVAudioSessionCategoryPlayAndRecord;
|
||||||
|
options |= AVAudioSessionCategoryOptionDefaultToSpeaker;
|
||||||
} else if (sessionCategorySetting == SESSION_CATEGORY_PLAYBACK) {
|
} else if (sessionCategorySetting == SESSION_CATEGORY_PLAYBACK) {
|
||||||
category = AVAudioSessionCategoryPlayback;
|
category = AVAudioSessionCategoryPlayback;
|
||||||
} else if (sessionCategorySetting == SESSION_CATEGORY_RECORD) {
|
} else if (sessionCategorySetting == SESSION_CATEGORY_RECORD) {
|
||||||
@ -118,11 +124,7 @@ static ViewController *mainViewController = nil;
|
|||||||
category = AVAudioSessionCategorySoloAmbient;
|
category = AVAudioSessionCategorySoloAmbient;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GLOBAL_GET("audio/general/ios/mix_with_others")) {
|
[[AVAudioSession sharedInstance] setCategory:category withOptions:options error:nil];
|
||||||
[[AVAudioSession sharedInstance] setCategory:category withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
|
|
||||||
} else {
|
|
||||||
[[AVAudioSession sharedInstance] setCategory:category error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user