NEW 162329
WKWebView set mediaPlaybackRequiresUserAction = false not working to auto play a video
https://bugs.webkit.org/show_bug.cgi?id=162329
Summary WKWebView set mediaPlaybackRequiresUserAction = false not working to auto pla...
rainer
Reported 2016-09-20 19:04:09 PDT
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)
Attachments
Note You need to log in before you can comment on or make changes to this bug.