Android WebView html5 video force fullscreen

纵饮孤独 提交于 2019-12-03 22:33:31

You can request full screen on play event, like this:

var element = document.getElementById("video");
element.addEventListener("playing", function() {
    if (element.requestFullscreen) {
        element.requestFullscreen();
    } else if (element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
    }
}, false);
Hafid Ben

You can try to set an user agent to the webView it works for me on ICS like this:

String ua = "Mozilla/5.0 (Android; Tablet; rv:20.0) Gecko/20.0 Firefox/20.0";

WebSettings s = webView.getSettings();
s.setUserAgentString(ua);

if it don't work ,look at this link for other user agents.

Good luck

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!