MediaPlayer.isPlaying()
does not allow to know if the MediaPlayer
is stopped or paused. How to know if it is paused and not stopped?
Thanks !
One way to do this is to check if the media player it not playing (paused) and check if it is at a position other than the starting position (1).
MediaPlayer mediaPlayer = new MediaPlayer();
Boolean isPaused = !mediaPlayer.isPlaying() && mediaPlayer.getCurrentPosition() > 1;
There is no API to check if MediaPlayer
is paused or not. So please use any Boolean variable to check and toggle it when you paused using any button
.
onClick(){
if(isPaused)
{
//resume media player
isPaused = false;
}else{
// pause it
isPaused = true;
}
}
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