diff --git a/src/ios/APPBackgroundMode.m b/src/ios/APPBackgroundMode.m index be941ee..f28d1b2 100644 --- a/src/ios/APPBackgroundMode.m +++ b/src/ios/APPBackgroundMode.m @@ -174,6 +174,9 @@ NSString* const kAPPBackgroundEventDeactivate = @"deactivate"; // even another app starts playing sound [session setCategory:AVAudioSessionCategoryPlayback 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 [session setActive:YES error:NULL]; @@ -221,8 +224,8 @@ NSString* const kAPPBackgroundEventDeactivate = @"deactivate"; NSString* flag = [NSString stringWithFormat:@"%@._isActive=%@;", kAPPBackgroundJsNamespace, active]; - - NSString* depFn = [NSString stringWithFormat:@"%@.on%@();", + + NSString* depFn = [NSString stringWithFormat:@"%@.on('%@');", kAPPBackgroundJsNamespace, event]; NSString* fn = [NSString stringWithFormat:@"%@.fireEvent('%@');",