The documentation for the Android MediaPlayer
shows that there are no invalid states for the reset()
call: http://developer.android.com/reference/android/media/MediaPlayer.html#Valid_and_Invalid_States (the invalid states are listed as {}, or "none.").
However, I have seen an IllegalStateException
thrown while calling reset()
:
java.lang.IllegalStateException at android.media.MediaPlayer._reset(Native Method) at android.media.MediaPlayer.reset(MediaPlayer.java:1061) at com.example.android.player.AsyncPlayer$AsyncHandler.handleMessage(AsyncPlayer.java:654) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.os.HandlerThread.run(HandlerThread.java:60)
Is the documentation incorrect?
Hard to say without seeing your code but I think you may be calling reset() after you call release() ?
The documentation states
When a MediaPlayer object is just created using new or after reset() is called, it is in the Idle state; and after release() is called, it is in the End state. Between these two states is the life cycle of the MediaPlayer object.
You may be calling reset outside of the valid life cycle.
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