Merged in JesperBalslev/cordova-plugin-run-in-background (pull request #5)

Prevent sound/music from stopping when opening the app on iOS. Also prevents embedded videos (youtube) from pausing when unmuted.

* Previous fix wasn't backwards compatible with versions older than 12.2. This fixes it.

* Fixes iOS issues with backgroundMode.onactivate and backgroundMode.ondeactivate

* Prevent sound/music from stopping when opening the app on iOS. Also prevents embedded videos (youtube) from pausing when unmuted.

Approved-by: Nathan Kerr <nathankerr@gmail.com>
This commit is contained in:
Jesper Charles Balslev 2020-03-24 14:00:17 +00:00 committed by Nathan Kerr
parent 1dab2de6ec
commit 77767cab9b

View File

@ -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];