如何在wkwebview视频中禁用自动启动AVplayer

问题描述 投票:0回答:1

我想像野生动物园一样设置警报,当用户单击视频URL时,它将要求播放或取消。

当前,当我单击视频URL(已加载页面内的URL)时,它将直接在AVplayer中播放视频。

enter image description here

希望您能解决我的问题,并向我提出实现该问题的方法...

ios swift avplayer wkwebview wkwebviewconfiguration
1个回答
0
投票

您需要在Web视图配置中指定所需的用户交互,如下所示

let webConfiguration = WKWebViewConfiguration()
webConfiguration.allowsInlineMediaPlayback = true
webConfiguration.mediaTypesRequiringUserActionForPlayback = .all // < here it is
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
© www.soinside.com 2019 - 2024. All rights reserved.