androidgoogle-chromewebviewfullscreenwebchromeclient

Android video WebView FullScreen not working - onShowCustomView() not called


I'm trying to load a video URL in a WebView in android using the example in this project: https://github.com/hanksudo/android-webview-youtube-fullscreen

Thing is the onShowCustomView method is never called. Whenever I click on the full screen button of the video I get this error:

I/chromium: [INFO:CONSOLE(0)] "Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture.", source: https://m.youtube.com/watch?v=dRekGX6dQRY (0)

Anyone knows how to fix it? Why is the browser interpreting it as a JS request and not a user gesture to make the video fullscreen? Are there any special flags I can set to enable full screen?

Thanks!


Solution

  • It is this high-priority bug in Google Chrome when used as WebView, fixed in Google Chrome 74.

    https://bugs.chromium.org/p/chromium/issues/detail?id=945287