Android MediaPlayer error codes?

Nathan Schwermann picture Nathan Schwermann · Oct 4, 2010 · Viewed 42k times · Source

I am struggling with getting a live radio stream to work on android. I am using the MediaPlayer class and just setting the URL and playing it. It works great for the most part, but after 5-30 minutes it inevitably dies. On 2.1 phones (more specifically a hero) I get this log output

W/MediaPlayer( 7919): info/warning (1, 26)
I/MediaPlayer( 7919): Info (1,26)
I/MediaStreamService( 7919): mPlayer info code:1  extra:26
E/MediaPlayer( 7919): error (1, -11)
E/MediaPlayer( 7919): Error (1,-11)

Where MediaStreamService is my Service containing the MediaPlayer the output is coming from the OnInfoListener

On 2.2 phones I don't get the OnInfoListener callback ever, the stream just dies. But I do see this in the logcat

E/HTTPStream( 1020): recv failed, errno = 11 (Try again)
E/HTTPDataSource( 1020): retrying connection failed

Seems to work flawlessly on my 1.6 phone despite the constant logcat spam of

E/PlayerDriver( 82): Invalid percentage value <big growing number>

My question is, what do the error codes (1, 26) mean? What is causing my mediaPlayer to crash? Is the 2.1 problem at all related to the 2.2 problem? Thanks, Nathan

Edit: I was looking in the source code to OnInfoListener and found public static final int MEDIA_INFO_UNKNOWN = 1; I'm not sure exactly what it means, and can't find where these extras are kept either.. Any insight on to what Media info unknown means? or what this 26 stands for would be very appreciated.

Answer

swcai picture swcai · Oct 12, 2010

My question is, what do the error codes (1, 26) mean?

  • 26 means PVMFInfoErrorHandlingStart, just an error indication

The error is -11, which means PVMFErrTimeout. You can check out the definition files here link text