I m having trouble getting MediaPlayer
to be resilient when streaming from a HTTP URL.
If I start playing the file, but then drop the connection (e.g. airplane mode), MediaPlayer#OnErrorListener
generates what=1, extra=-17
and then shortly afterwards what=-38, extra=0
.
There s no documentation I can see in the APIs of what this denotes, except extra is "Typically implementation dependant". I m using a HTC Hero (well, it s T-Mobile UK s G2 Touch).
Do other people get the same values and is it safe to catch these values as meaning the connection s gone?
How can I best resume when the connection reappears? (save the current seek to preferences, and retry every 5 seconds?)
How do I know when the device has decided to start playing what it s been buffering - is there a callback (other than polling isPlaying()
)?
Additionally, I m not entirely sure what onBufferingUpdate
provides. I m using a 40 minute podcast MP3 (64kbps bitrate)
- buffering goes 1%, 2%, 3%. When I seek to about 30 mins in, it shows 75%, then when I seek back to the start back to 5% - what is the point of this callback other than showing approximately what is cached?
Finally - is there any way to pipe what s streamed to an MP3
?