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 am also encountering this issue after upgrading to iOS 13.2.

I have the same problem.

I have the same problem.

Yes, same problem here, though the app is in foreground and audio doesn´t work at all.

EDIT: I just noticed that this is in regards to Cocoa Touch. I don´t use Cocoa Touch but I do use wkwebview.


iPadOS 13.2.2

Same issue here, using wkwebview-cordova plugin. WebAudio stops when iOS 13 app is put into background, and never comes back when app is restored. Subsequent calls to the audioContext don't produce any sound, despite seeming to work. (I know they seem to work because the program knows how long the individual files are, which affects elements in my UI.)


Creating a new audioContext after 'focus' doesn't work either.

https://bugs.webkit.org/show_bug.cgi?id=20426


Leaving this here for reference

Same issue here, has anyone had any luck with this yet? Complaints are rolling in...

Does anypne manage to fix this. i'm having the same problem.

Same problem here

Same issue on iOS 13.3.1. Is a fix coming anytime soon?

ios 13.3.1 on X model

audio and video tags on webview - NO SOUND.

it is reported for half year almost, there will be a fix in some point?

will Apple let us use webview to run actual real life web..mmm... view?

many devices it is working. on X model, worked on 13.3, after update - stopped working. video playing without sound. audio too.

@marcomartignone we're also experiencing this issue with MixCloud widget player. Were you able to resolve?

I have some problem. any solution for this issue?
If this is the same issue I am seeing, I've solved this problem by using cordova-plugin-background-mode. Enable background mode with a setTimeout() as soon as you trigger the play function.
My mistake.. Ignore my last input.. The problem still persists.. I just realized my build was 12.2