Weird Pause/Resume event behavior


#1

I’m looking to see if anyone else has encountered this issue or has any ideas on where I can look for an explanation or a solution to it. I apologize if this doesn’t fit the scope of this forum but I’m not sure where else to post this and get legitimate answers. I can’t find any material on the internet that discusses this issue.

My issue has to do with the Pause and Resume events I’ve set up for our recording and playback states. Basically what we do is pause and resume the playback or recording within the events. Nothing unusually there. Although iOS seems to have stopped responding to these events normally, iOS seems to be fading the audio out slowly after the pause event and then automatically resumes the audio playback or recording on resume even without me defining and registering a resume event.

What I’ve done to mask this is to create a resume event that resumes my playback service and everything in the controller needed for audio playback. If I don’t do this then the audio resumes without the current position/duration bar being updated and proceeds to cause all sorts of errors.

This doesn’t seem to happen on Android, only on iOS.

Any help would be appreciated since my masking solution isn’t ideal.

-Brad


#2

So I figured it out. I’ll post my solution here just in case someone else encounters this, doesn’t get any responses on their forum post and can’t figure out how to solve it.

Now, It did turn out to be an iOS specific thing so perhaps this question was best asked else where but at the time I wasn’t sure whether it was Ionic, the Cordova media plugin, or iOS. The solution turned out to be I needed to add the value of “audio” to Required Background modes (UIBackgroundMode) in my Custom iOS Target Properties. This allows audio to play when the user presses the home button or the screen turns off.