mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
refactor: allow sound even iphone is unmuted
This commit is contained in:
+9
-4
@@ -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]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user