Android的奇巧(4.4)视频自动播放不能在web视图工作了 [英] Android KitKat (4.4) video autoplay does not work anymore in webview

查看:913
本文介绍了Android的奇巧(4.4)视频自动播放不能在web视图工作了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android上的previous的版本中,我们可以通过调用播放()视频JS元法,或在其上模拟单击事件(仅适用于某些具体的设备,如关系开始视频在其上视频没有启动的话),现在它的工作了......我明白,我们不应该让这种针对Android版本的Chrome或Android网页浏览器,但为什么还有里面的WebView?

on previous versions of Android, we were be able to start a video by calling play() method on video js element or by simulating a click event on it (only for some specifics devices such as nexus on which the video does not start at all), now it's working anymore... i understand that we should not allow this for android chrome version or android web navigator, but why also inside webview ?

推荐答案

请尝试调用 WebView.getSettings()。setMediaPlaybackRequiresUserGesture(假)为您的WebView。

Please try calling WebView.getSettings().setMediaPlaybackRequiresUserGesture(false) for your WebView.

(见<一href="http://developer.android.com/reference/android/webkit/WebSettings.html#setMediaPlaybackRequiresUserGesture(boolean)">http://developer.android.com/reference/android/webkit/WebSettings.html#setMediaPlaybackRequiresUserGesture(boolean) )

这篇关于Android的奇巧(4.4)视频自动播放不能在web视图工作了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆