[Webkit-unassigned] [Bug 162329] New: WKWebView set mediaPlaybackRequiresUserAction = false not working to auto play a video

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 20 19:04:09 PDT 2016


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

            Bug ID: 162329
           Summary: WKWebView set mediaPlaybackRequiresUserAction = false
                    not working to auto play a video
    Classification: Unclassified
           Product: WebKit
           Version: Other
          Hardware: iPhone / iPad
                OS: iOS 10
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: WebKit API
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rainer at 126.com

Hi I am working on iOS 10 with Swift3 right now.

My scenario is to autoplay a youtube video inline using WKWebView. I set the config's mediaPlaybackRequiresUserAction to false in order to enable the video autoplay, as suggested by Apple Dev Docs.

However this config does not seem to work, the video loaded correctly, but you have to press the play button to make it actually play.

Code below:

let config = WKWebViewConfiguration()
            config.requiresUserActionForMediaPlayback = false
            config.allowsInlineMediaPlayback = true
            config.mediaPlaybackRequiresUserAction = false
            config.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone
            let webView = WKWebView(frame: self.topView.bounds, configuration: config)
            webView.addObserver(self, forKeyPath: self.webViewLoadingKey, options: .new, context: nil)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160921/6e2b4c07/attachment.html>


More information about the webkit-unassigned mailing list