Android MediaPlayer Error and Info Constants

If you’re ever debugging Android MediaPlayer issues, logging the output from the onError and onWarning functions may not help as the log will only display the int value of the constant, not the constant itself.

Android MediaPlayer State Diagram

You will have to look up the MediaPlayer API to find out the value’s constant definition which is annoying (and not always complete as I just found out) so I’m compiling a list here. It wouldn’t be hard to create an enum, HashMap or class to map the values in code.

These are the integer values for the “what” parameter in the public boolean onError(MediaPlayer mp, int what, int extra) or public boolean onInfo(MediaPlayer mp, int what, int extra)

Info Constants:

  • MEDIA_INFO_UNKNOWN: 1
  • MEDIA_INFO_VIDEO_TRACK_LAGGING: 700
  • MEDIA_INFO_NOT_SEEKABLE: 801
  • MEDIA_INFO_METADATA_UPDATE: 802
  • MEDIA_INFO_BUFFERING_START: 701
  • MEDIA_INFO_BUFFERING_END: 702
  • MEDIA_INFO_BAD_INTERLEAVING: 800
  • MEDIA_INFO_NETWORK_BANDWIDTH : 703 (Undocumented – found through source code)

Errors:

  • MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: 200
  • MEDIA_ERROR_SERVER_DIED: 100
  • MEDIA_ERROR_UNKNOWN: 1

Related Tweets

view search results for "Android MediaPlayer" on twitter

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>