Search code examples
androidandroid-mediaplayer

Android MediaPlayer Error (-38,0)


I got a problem with my media player. Sometimes an error occurs and the on error is called. There I have the Mediaplayer and two int as parameters. The first int is "-38" and the second one is "0".

What does that mean?

EDIT: Code: http://pastebin.com/3XBaFYwF

Here's my logcat @Blundell LogCat:

http://pastebin.com/Wbjm3QCW


Solution

  • error 38 means you are asking the MediaPlayer to do something when in the wrong state. You won't be able to fathom your error just from this.

    Look at your Logcat before and after this error code and see what else has gone wrong. It's more than like you are calling start before the MediaPlayer has prepared or some other error of state.

    see http://developer.android.com/reference/android/media/MediaPlayer.html#StateDiagram

    state machine