8

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!

Andrei Verdes
  • 993
  • 8
  • 23
  • 1
    did you get any solution to fix this? am also suddenly get this bug 3 days back – Samwinishere Here Mar 25 '19 at 06:19
  • Not yet, will post an answer once I do – Andrei Verdes Mar 25 '19 at 06:54
  • what you think the problem, is that webview issue?for me the first lauch its working, but after first lauch full screen not working – Samwinishere Here Mar 25 '19 at 07:05
  • For me is not even working for the first lunch, idk what seems to be the problem, maybe the video player. I'll try changing it and see what happens – Andrei Verdes Mar 25 '19 at 07:08
  • 1
    i have a small hack change user agent webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"); full screen will work but playerview will go as browser – Samwinishere Here Mar 25 '19 at 07:08
  • @SamwinishereHere I ended up using jQuery with `videojs` and ended up changing the video player, and that one works with fullscreen... also thank you for your response! – Andrei Verdes Mar 29 '19 at 14:25
  • can you show a sample – Samwinishere Here Apr 02 '19 at 05:09
  • @SamwinishereHere Same here too, from the second launch full screen will not work. It will work again if you delete this file from device storage: "data/app_name/app_webview/variations_seed". But we could not be sure if this trick will not cause any crash in future versions of Webview. I am considering deleting the "app_webview" folder at app startup time. – UenX Apr 02 '19 at 07:43
  • Did you get any solution.. Plz help me – Rezaul Karim Apr 15 '19 at 09:56

2 Answers2

3

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

TalkLittle
  • 8,866
  • 6
  • 54
  • 51
2

My problem solved when I updated my android chrome application to v74.0.3729.112.

related announcement: https://i.stack.imgur.com/ASsiW.png