Play html audio in wkwebview will report error: Required client entitlement is missing

An error is reported when playing h5 audio or video elements in wkwebview: Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}> Then the performance of the webview will become very poor.
  1. There is an audio element and a button button in my HTML file. Click the button to play audio.

Code Block
<body>
<button onclick="handleClick()">PLAY</button>
<audio id="audio" src="https://ac-dev.oss-cn-hangzhou.aliyuncs.com/test-2022-music.mp3"></audio>
<script>
function handleClick() {
document.getElementById("audio").play();
}
</script>
</body>
  1. Create a wkwebview to load the html file in my demo APP.

Code Block
class ViewController: UIViewController , WKUIDelegate{
var webView: WKWebView!
override func loadView() {
let config = WKWebViewConfiguration()
config.preferences.javaScriptEnabled = true
config.allowsInlineMediaPlayback = true
webView = WKWebView(frame: .zero, configuration: config) //.zero
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
let myURL = URL(string: "https://ac-dev.oss-cn-hangzhou.aliyuncs.com/test-2022-py.html")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}
}
  1. Click the button in the HTML to play the audio, and you can see the error report on the xcode.

Code Block
iPadN[2133:855729] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}>
  1. To sum up, this error will appear when playing audio or video in HTML. Then the app performance will drop a lot, and the interactive response will be very slow.

Did you find a way around this? We are having the same issues.

I also desperately need a solution to this error.

I've been going around in circles trying to fix this with no joy. Any chance Apple?

I have the same issue and I've enabled Background Audio and Inter-App Audio just be safe and the error still doesn't go away.

Somebody found a solution for this bug ? My app is failing with this exact bug to play longer mp4 video from storage. Please heeeeelp 😭😭😭

Same error for me guys, I have a fully functionally PWA (https://lattesplayer.web.app), I tried to generate a build for the App Store with PWA Builder, but when I will start the app on a virtual device or on my iPhone, the app performance will drop a lot, and the interactive response will be very slow, and the error came up!

MusicPlayer[297:4753] [ProcessSuspension] 0x10e4dca80 - ProcessAssertion: Failed to acquire RBS MediaPlayback assertion 'WebKit Media Playback' for process with PID 297, error: Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}

Please help!

Fine in Playing audio, error happened in Video with debug mode

 [ProcessSuspension] 0x117cbea80 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=18140, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}

without connecting Xcode ,app works fine

is there an an solution

Have same problem wkwebview with oddcast client

Hi resolve it

class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate{
   
    @IBOutlet weak var webview: WKWebView!

    override func viewDidLoad() {
        super.viewDidLoad()
       
        webview.configuration.defaultWebpagePreferences.allowsContentJavaScript = true
        webview.configuration.allowsInlineMediaPlayback = true
        webview.configuration.allowsAirPlayForMediaPlayback = true
        webview.configuration.allowsPictureInPictureMediaPlayback = true
        webview.allowsBackForwardNavigationGestures = true        
        webview.allowsLinkPreview = true
        
        webview.uiDelegate = self        
        webview.navigationDelegate = self

and add this option

Hi Team, Im still see the issue using :

mport UIKit import WebKit

class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {

@IBOutlet weak var webView: WKWebView!

override func viewDidLoad() {
    super.viewDidLoad()
    webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true

    webView.configuration.allowsInlineMediaPlayback = true
    webView.configuration.allowsAirPlayForMediaPlayback = true
    webView.configuration.allowsPictureInPictureMediaPlayback = true
    webView.allowsBackForwardNavigationGestures = true
    webView.allowsLinkPreview = true

    webView.uiDelegate = self
    webView.navigationDelegate = self

    let myURL = URL(string: "https://ac-dev.oss-cn-hangzhou.aliyuncs.com/test-2022-py.html")
    let myRequest = URLRequest(url: myURL!)
    webView.load(myRequest)
}

}

Any idea what we missed?

Thanks in advance

Play html audio in wkwebview will report error: Required client entitlement is missing
 
 
Q