iOS 12.2/Swift:在 iPhone 的 UIWebView 中阅读 html 上的视频时出现问题
iOS 12.2/ Swift: Problem with reading videos on html in the UIWebView on iPhone
我的应用程序适用于低于 iOS 12.2 的所有版本、所有设备和模拟器。
从那个新版本开始,它在 iPhone 和 iOS 12.2 上不起作用,没有任何错误消息(我没有看到该消息发生:nhandled Promise Rejection: NotAllowedError: )。我明确指出它可以在模拟器上运行,在 iOS 12.2 中的 ipad 上运行,但不能在 iphone 上运行。
我检查了 ticket 但它并没有解决问题。
我将该功能添加到 true 但没有成功:
webView.mediaPlaybackRequiresUserAction = true
webView.allowsInlineMediaPlayback = true
webView.mediaPlaybackAllowsAirPlay = true
我添加了那个键但没有成功:
<div class="col-md-12"><p class="ttl">'+tab_bloctitre[1]+'</p><video controls style="width:100%;" poster="'+key+'/img/fondvideo.png"><source src="'+tab_videobloc[1].replace("https://gmp2.newtelapps.fr/uploads/R1550158082/img/",lien)+'" type="video/mp4"></video></div>'
有什么想法吗?
indexWeb.keyboardDisplayRequiresUserAction = 否;
这个设置解决了我的问题。
webView.mediaPlaybackRequiresUserAction = false;
来自这个答案:
如果您不想 auto-play,请确保您的 HTML 中没有 "autoplay"。
我的应用程序适用于低于 iOS 12.2 的所有版本、所有设备和模拟器。
从那个新版本开始,它在 iPhone 和 iOS 12.2 上不起作用,没有任何错误消息(我没有看到该消息发生:nhandled Promise Rejection: NotAllowedError: )。我明确指出它可以在模拟器上运行,在 iOS 12.2 中的 ipad 上运行,但不能在 iphone 上运行。
我检查了 ticket 但它并没有解决问题。
我将该功能添加到 true 但没有成功:
webView.mediaPlaybackRequiresUserAction = true webView.allowsInlineMediaPlayback = true webView.mediaPlaybackAllowsAirPlay = true
我添加了那个键但没有成功:
<div class="col-md-12"><p class="ttl">'+tab_bloctitre[1]+'</p><video controls style="width:100%;" poster="'+key+'/img/fondvideo.png"><source src="'+tab_videobloc[1].replace("https://gmp2.newtelapps.fr/uploads/R1550158082/img/",lien)+'" type="video/mp4"></video></div>'
有什么想法吗?
indexWeb.keyboardDisplayRequiresUserAction = 否; 这个设置解决了我的问题。
webView.mediaPlaybackRequiresUserAction = false;
来自这个答案:
如果您不想 auto-play,请确保您的 HTML 中没有 "autoplay"。