refactor: allow sound even iphone is unmuted

This commit is contained in:
Levils114
2026-08-06 09:12:37 -03:00
parent bd36634143
commit b1557a77b7
+9 -4
View File
@@ -376,13 +376,18 @@ bool setAudioMixWithOthers(bool mixEnabled)
{ {
@autoreleasepool @autoreleasepool
{ {
NSString *category = AVAudioSessionCategorySoloAmbient; AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *err; NSString *category = AVAudioSessionCategoryPlayback;
NSUInteger options = 0;
NSError *err = nil;
if (mixEnabled) 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) if (!success)
NSLog(@"Error in AVAudioSession setCategory: %@", [err localizedDescription]); NSLog(@"Error in AVAudioSession setCategory: %@", [err localizedDescription]);