[Solved] Android MediaPlayer continues playing after screen is turned off

[ad_1]

You should stop the MediaPlayer in onPause:

if (playback != null && playback.isPlaying()) {
        playback.pause();
    }

Resume it in onResume:

if (playback != null && !playback .isPlaying()) {
                playback.start();
    }

2

[ad_2]

solved Android MediaPlayer continues playing after screen is turned off