Android : how to know if MediaPlayer is paused?

Regis_AG picture Regis_AG · Mar 4, 2014 · Viewed 11k times · Source

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 !

Answer

rickdmer picture rickdmer · Oct 4, 2015

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;