I have a VideoView in my activity, which I use only as a background, with a video on looping mode.
The screen does not go into sleep mode automatically. I tried manually counting the seconds since the last user interactivity, but I was still not able to force the screen to turn off.
I have tried PowerManager, acquiring locks and goToSleep() function, but I still haven't managed to turn my screen off.
I know this is an ancient question, but I thought I'd write an answer anyway since this page shows up in Google searches.
I solved the same problem using this code:
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.setScreenOnWhilePlaying(false);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With