mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2024-11-14 19:44:53 +00:00
Fix ios other apps audio interruption (#209)
* Fix ios other apps audio interruption Other apps audio was interrupted when the background mode was enabled. I found the solution on this post http://stackoverflow.com/questions/10180500/how-to-use-kaudiosessionproperty-overridecategorymixwithothers If we don't disable the audio session before that the option AVAudioSessionCategoryOptionMixWithOthers is set, it interrupts the other apps audio. Because the category 'AVAudioSessionCategoryPlayback' is set and by default the session is already active and this category interrupts other apps audio without the option 'mix with others'. * Update APPBackgroundMode.m
This commit is contained in:
parent
a9877ec0a1
commit
6dabe3427d
@ -149,13 +149,14 @@ NSString *const kAPPBackgroundEventFailure = @"failure";
|
||||
- (void) configureAudioSession {
|
||||
AVAudioSession* session = [AVAudioSession
|
||||
sharedInstance];
|
||||
|
||||
// Don't activate the audio session yet
|
||||
[session setActive:NO error:NULL];
|
||||
// Play music even in background and dont stop playing music
|
||||
// even another app starts playing sound
|
||||
[session setCategory:AVAudioSessionCategoryPlayback
|
||||
withOptions:AVAudioSessionCategoryOptionMixWithOthers
|
||||
error:NULL];
|
||||
|
||||
// Active the audio session
|
||||
[session setActive:YES error:NULL];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user