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)
MediaStreamService is my Service containing the
MediaPlayer the output is coming from the
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?
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.
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
Maybe RDS data ?
Do you set your buffer size manually ?
To start the playback, start() must be called. After start() returns successfully, the MediaPlayer object is in the Started state. isPlaying() can be called to test whether the MediaPlayer object is in the Started state.
While in the Started state, the internal player engine calls a user supplied OnBufferingUpdateListener.onBufferingUpdate() callback method if a OnBufferingUpdateListener has been registered beforehand via setOnBufferingUpdateListener(OnBufferingUpdateListener). This callback allows applications to keep track of the buffering status while streaming audio/video.
Calling start() has not effect on a MediaPlayer object that is already in the Started state.
Maybe it a part of the response.