Android:如何知道MediaPlayer是否已暂停?

问题描述:

MediaPlayer.isPlaying()不允许知道MediaPlayer是停止还是暂停.如何知道它是否已暂停且未停止?

MediaPlayer.isPlaying() does not allow to know if the MediaPlayer is stopped or paused. How to know if it is paused and not stopped?

谢谢!

一种方法是检查媒体播放器是否未播放(暂停),并检查其是否位于起始位置以外的位置(1 ).

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;