Rai*_*ast 4 swift swift3 ios10
嗨,我现在正在使用Swift3在iOS 10上工作.
我的方案是使用WKWebView自动播放youtube视频内联.我将config的mediaPlaybackRequiresUserAction设置为false,以启用Apple Dev Docs建议的视频自动播放.
然而,此配置似乎不起作用,视频正确加载,但您必须按播放按钮才能使其实际播放.
有任何想法吗?谢谢 :)
let config = WKWebViewConfiguration()
config.requiresUserActionForMediaPlayback = false
config.allowsInlineMediaPlayback = true
let webView = WKWebView(frame: self.topView.bounds, configuration: config)
webView.addObserver(self, forKeyPath: self.webViewLoadingKey, options: .new, context: nil)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4267 次 |
| 最近记录: |