How to handle background audio playing while iOS device is locked or on another application?

Playing Background Audio

An app that plays or records audio continuously (even while the app is
running in the background) can register to perform those tasks in the
background. You enable audio support from the Background modes section
of the Capabilities tab in your Xcode project. (You can also enable
this support by including the UIBackgroundModes key with the audio
value in your app’s Info.plist file.) Apps that play audio content in
the background must play audible content and not silence.

Apple reference “Playing and Recording Background Audio”

Ensuring That Audio Continues When the Screen Locks

For enabling/disabling this feature I found Activating and Deactivating Your Audio Session, I haven’t tried it myself, but it looks like what you need.

Leave a Comment