[Webkit-unassigned] [Bug 223733] Play h5 audio element in wkwebview will report error: Required client entitlement is missing

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 25 19:11:54 PDT 2021


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

--- Comment #3 from pengyong <pasoul.peng at pdabc.com> ---
1.There is an audio element and a button button in my HTML file. Click the button to play audio.
```
<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>
```
2.Create a wkwebview to load the html file in my demo APP.
```
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)
    }
}
```
3.Click the button in the HTML to play the audio, and you can see the error report on the xcode.
```
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}>
```
4.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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210326/f34c3809/attachment-0001.htm>


More information about the webkit-unassigned mailing list