Well, I\'ve been searching few days already, how to display HTML5 video in full-screen mode on android WebView.
I managed to play HTML5 videos on my webview. Problem
It seems that in lollipop and up (or maybe just a different WebView Version) that calling cprcrack's
onHideCustomView()
method does not work. It works if it is called from the exit fullscreen button but when you specifically call the method it will only exit fullscreen but the webView
stays blank. A way around it is to simply add these lines of code to onHideCustomView()
:
String js = "javascript:";
js += "var _ytrp_html5_video = document.getElementsByTagName('video')[0];";
js += "_ytrp_html5_video.webkitExitFullscreen();";
webView.loadUrl(js);
This will notify the webView that fullscreen has exited.