title: Streaming with Android MediaPlayer - catching errors and buffering
body: <p>I'm having trouble getting <code>MediaPlayer</code> to be resilient when streaming from a HTTP URL.</p>
  
  <p>If I start playing the file, but then drop the connection (e.g. airplane mode), <code>MediaPlayer#OnErrorListener</code> generates <code>what=1, extra=-17</code> and then shortly afterwards <code>what=-38, extra=0</code>. </p>
  
  <p>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).</p>
  
  <p>Do other people get the same values and is it safe to catch these values as meaning the connection's gone?</p>
  
  <p>How can I best resume when the connection reappears? (save the current seek to preferences, and retry every 5 seconds?)</p>
  
  <p>How do I know when the device has decided to start playing what it's been buffering - is there a callback (other than polling <code>isPlaying()</code>)?</p>
  
  <p>Additionally, I'm not entirely sure what <code>onBufferingUpdate</code> provides. I'm using a 40 minute podcast <code>MP3 (64kbps bitrate)</code> - 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?</p>
  
  <p>Finally - is there any way to pipe what's streamed to an <code>MP3</code>?</p>