Merge branch 'master' of bitbucket.org:TheBosZ/cordova-plugin-run-in-background

This commit is contained in:
Nathan Kerr 2020-06-08 12:19:15 -07:00
commit b33044c8e5

View File

@ -174,6 +174,9 @@ NSString* const kAPPBackgroundEventDeactivate = @"deactivate";
// even another app starts playing sound // even another app starts playing sound
[session setCategory:AVAudioSessionCategoryPlayback [session setCategory:AVAudioSessionCategoryPlayback
error:NULL]; error:NULL];
// Prevent sound/music from stopping when opening the app. Also prevents embedded videos from pausing when unmuted.
[session setCategory:AVAudioSessionCategoryAmbient
error:NULL];
// Active the audio session // Active the audio session
[session setActive:YES error:NULL]; [session setActive:YES error:NULL];
@ -221,8 +224,8 @@ NSString* const kAPPBackgroundEventDeactivate = @"deactivate";
NSString* flag = [NSString stringWithFormat:@"%@._isActive=%@;", NSString* flag = [NSString stringWithFormat:@"%@._isActive=%@;",
kAPPBackgroundJsNamespace, active]; kAPPBackgroundJsNamespace, active];
NSString* depFn = [NSString stringWithFormat:@"%@.on%@();", NSString* depFn = [NSString stringWithFormat:@"%@.on('%@');",
kAPPBackgroundJsNamespace, event]; kAPPBackgroundJsNamespace, event];
NSString* fn = [NSString stringWithFormat:@"%@.fireEvent('%@');", NSString* fn = [NSString stringWithFormat:@"%@.fireEvent('%@');",