我正在尝试在
null
let html = """
<html><head>
<title>YouTube Video</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, shrink-to-fit=no, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
Here is an embedded youtube video: <br/>
<iframe src="https://www.youtube.com/embed/oR-6N1Dc_zc?modestbranding=1&rel=0" frameborder="0" allowfullscreen></iframe>
<iframe src="https://player.vimeo.com/video/270611565" width="640" height="360" frameborder="0" allowfullscreen></iframe>
</body>
</html>
"""
WKWebView的配置接近默认值(CodeAllowSinLineMediaPlayback/code>已启用)。web页面加载
YouTube播放器中的全屏模式按钮变灰了。当我点击它时,会显示以下消息:“您的浏览器不支持全屏。”:
如果改用/code>标记嵌入的视频。当我从YouTube网站加载一段视频时,全屏模式会起作用(尽管它看起来更像是某种仿真,而不像原生的全屏模式)。
null
null
let webViewConfiguration = WKWebViewConfiguration()
webViewConfiguration.allowsInlineMediaPlayback = false
WKWebView(frame: .zero, configuration: webViewConfiguration)