Merge pull request #2350 from Levils114/refactor/ios/allow-sound-even-iphone-unmuted

refactor: allow sound even iphone is unmuted
This commit is contained in:
Sasha Szpakowski
2026-08-08 11:09:20 -03:00
committed by GitHub
+9 -4
View File
@@ -376,13 +376,18 @@ bool setAudioMixWithOthers(bool mixEnabled)
{
@autoreleasepool
{
NSString *category = AVAudioSessionCategorySoloAmbient;
NSError *err;
AVAudioSession *session = [AVAudioSession sharedInstance];
NSString *category = AVAudioSessionCategoryPlayback;
NSUInteger options = 0;
NSError *err = nil;
if (mixEnabled)
category = AVAudioSessionCategoryAmbient;
options = AVAudioSessionCategoryOptionMixWithOthers;
bool success = [[AVAudioSession sharedInstance] setCategory:category error:&err];
bool success = [session setCategory:category
mode:AVAudioSessionModeDefault
options:options
error:&err];
if (!success)
NSLog(@"Error in AVAudioSession setCategory: %@", [err localizedDescription]);