3

I use Android MediaPlayer for streaming audio playback. But some times record preparing stage takes too long. So I would like to give user ability to interrupt preparing and start another. How can I do this?

Thanks in advance.

Michael

Lampapos
  • 1,063
  • 1
  • 12
  • 26

1 Answers1

1

As can be seen in the list of valid and invalid states, the Preparing state is never mentioned, not in the invalid states and, much more importantly, not in the valid states. While this is a bit confusing, you are better of ignoring the list of invalid states and just not calling a method if the current state is not listed as valid.

So, the only methods that are valid for you to call are those that are valid in any state. Thus, the only way to achieve your goal without using two alternating MediaPlayers is to release() the MediaPlayer and create a new one.

Jelle Fresen
  • 1,916
  • 1
  • 20
  • 24