如何禁用 iOS Webview 在视频播放时全屏显示
我正在尝试播放嵌入 iOS 本机应用程序中的内嵌视频。
无论我做什么,播放视频后播放器都会自动进入全屏。
我正在尝试所有提到的建议,例如 playsinline
、 allowfullscreen="false"
、 controls="false"
等。
有没有办法防止iOS webview 无法进入全屏?
I am trying to play inline video embedded inside iOS native app.
Whatever I do, the player keeps entering full screen automatically once the video is played.
I was trying all mentioned suggestions such as playsinline
, allowfullscreen="false"
, controls="false"
etc.
Is there a way to prevent iOS webview from entering full screen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Swift 5.5
你只需要
allowsInlineMediaPlayback = true
Swift 5.5
You just need
allowsInlineMediaPlayback = true
您可以通过代码中的配置,使用 WKWebViewConfiguration 和 allowedInlineMediaPlayback 在 iOS Web 视图中启用内联播放:
您可以在此答案中查看示例:https://stackoverflow.com/a/59834721/334402
You can enable inline playback in an iOS web view via configuration in your code, using WKWebViewConfiguration and allowsInlineMediaPlayback:
You can see an example in this answer: https://stackoverflow.com/a/59834721/334402