Is UIBackgroundModes audio required for WKWebView to play audio/airplay etc in the background?

I know WKWebview is in another process from the main app. My question is is the UIBackgroundModes audio entry in Info.plist required on the main app for WKWebview to play audio/video/airplay in the background?

Or is simply setting WKWebViewConfiguration allowsAirPlayForMediaPlayback and allowsPictureInPictureMediaPlayback enough?

I recall having issues with background audio from WKWebView on older versions of iOS a couple years ago so I added the audio entry to the Info.plist....

but I just removed the key from the Info.plist and background audio from WKWebview seems to be working fine...maybe audio background mode is not required? Or does it only seem to be working because my app is attached to the debugger? Or is this a bug?

It looks like this is broken in iOS 17.2.1. WKWebView that plays HTML <audio> element works. But if the app is in the background or if the screen is locked, you cannot start playing a new audio element.

You'll receive a .ended event from the ended audio file. You can use that to set the .src to a new audio file. You can call .play() on it, but no audio will be heard.

This is happening even if Info.plist has Required background modes including "App processes data in the background" and "App plays audio or streams audio/video using Airplay".

Is UIBackgroundModes audio required for WKWebView to play audio/airplay etc in the background?
 
 
Q