1

A few users have requested that my app keep the phone screen on while playing a video inside the WebView. I know how to request the wake lock for the screen to stay on but how do I know a video is playing inside the WebView?

The other question is, when they go full screen, I know at that point a video is playing full screen, is requesting a wake lock the only way to keep the screen on then?

Edit: the duplicate suggested solution only works on developer mode. Also this question is more about the WebView than how to keep the screen on.

casolorz
  • 8,486
  • 19
  • 93
  • 200
  • are you playing youtube video ? – Mithun Sarker Shuvro Mar 05 '19 at 17:18
  • No. Just videos in general. I do not want to play in the background and prevent that from happening, but if users want to use the app to watch videos then it can be annoying if the screen turns itself off. – casolorz Mar 05 '19 at 18:45
  • Possible duplicate of [Correct method for setKeepScreenOn / FLAG\_KEEP\_SCREEN\_ON](https://stackoverflow.com/questions/5331152/correct-method-for-setkeepscreenon-flag-keep-screen-on) – Andre Classen Mar 05 '19 at 19:53
  • Supposedly that only works on developer mode. Edit: maybe I spoke too quick, `android:keepScreenOn="true"` might work for the case when the video goes full screen. It is unclear whether that only applies to developer mode. But I can't have the entire `WebView` like that as this is only for a select number of users. – casolorz Mar 05 '19 at 19:59

0 Answers0