sandalone
sandalone

Reputation: 41749

Possible to detect paused state of MediaPlayer?

I have multiple media players where each player is player after another. So I have to detect which player was paused to continue playback on that specific player.

I tried to detect which player is paused, but MediaPlayer has only isPlaying() method, which does not help me in this case.

Is there a way to detect if and what MediaPlayer object has been paused?

Note: I thought of introducing another boolean value to help me in this case, but I first want to check if there is a way to detect paused state with the default objects.

Upvotes: 1

Views: 1539

Answers (1)

sandalone
sandalone

Reputation: 41749

I solved it by introducing a new boolean variable for each MediaPlayer object.

Then I later simply checked if the boolean value of that object is false or true.

boolean mIsPaused[];

//... later in the code
player[i].pause();
mIsPaused[i] = true;

//...even later more
player[i].start();
mIsPaused[i] = false;

So far, this satisfies my need and I see no slowdowns.

Upvotes: 2

Related Questions