iOS 13 - WkWebView BUG: audio stops when in background

I've an app that uses WkWebView to play audio from Soundcloud and Mixcloud by using their javascript widget, on iOS 13 Beta 6 the audio stops when the app is not in foreground, even when Audio is on in Background Modes.


When starting the playback this assertions is thrown:


Error acquiring assertion: <NSError: 0x282cf67c0; domain: RBSAssertionErrorDomain; code: 2; reason: "Required client entitlement is missing"> {
userInfo = {
  RBSAssertionAttribute = <RBSLegacyAttribute: 0x1592432e0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
}


And after entering background state the following assertion is thrown and audio suspended:


Can't end BackgroundTask: no background task exists with identifier 13 (0xd), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug. 
[ProcessSuspension] Background task expired while holding WebKit ProcessAssertion (isMainThread? 1).


This is not happening in iOS 12, where the audio plays normally when in background.

Replies

I have the same problem and after a week searching couldn't find any solution for it.

I have the same problem.

I have the same problem.


But Safari does not have this problem. Can somebody from Apple enginiers to help us?


Also, there is the similar question on SO -

https://stackoverflow.com/questions/57526699/ios-13-wkwebview-audio-stops-when-in-background


https://openradar.appspot.com/radar?id=5022510114406400

I too facing the same problem

wkwebview, audio stops when in background, but working in simulator

Reports are starting to roll in, from users of our app who upgraded to iOS 13, as well.

I am facing the same issue. Is this done on purpose to block webapp from running background audio?

same problem

I have the same problem.

I'm facing with the same issue, on iOs 13.1.2.

Same problem here, webapp audio is broken on iOS 13.

Still searching for a workaround...

Same issue, when I was using version 12+ was working perfect, as soon as the version 13.1.2 was release this issue started happening, the only work around I have found so far is keeping the screen on all the time.

Same error here trying to play local html audio in a cordova app. Plays in Simulator not on device. Even in foreground.

Upping the topic.


There is still an issue in iOS 13, the sound get paused automatically after few moment..., did anyone find a workaround?

Unfortunately, from iOS 13 this ability is under sytem entitlements, com.apple.multitasking.systemappassertions and com.apple.multitasking.unlimitedassertions, you can try it in simulator, no error in log. There is no way to launch it on device thought, as you need an Apple issued provision profile. So, all we can do is to hope that some future release will fix this.

I have the same issue