title: Streaming to the Android MediaPlayer
body: <p>I'm trying to write a light-weight <code>HTTP</code> server in my app to <code>feed</code> dynamically generated <code>MP3</code> data to the built-in <code>Android</code> <code>MediaPlayer</code>.  I am not permitted to store my content on the <code>SD card</code>.</p>
  
  <p>My input data is essentially of an infinite length.  I tell <code>MediaPlayer</code> that its data source should basically be something like <code>"http://localhost/myfile.mp3"</code>.  I've a simple server set up that waits for <code>MediaPlayer</code> to make this request.  However, <code>MediaPlayer</code> isn't very cooperative.  At first, it makes an <code>HTTP GET</code> and tries to grab the whole file.  It times out if we try and simply dump data into the <code>socket</code> so we tried using the <code>HTTP</code> Range header to write data in chunks.  <code>MediaPlayer</code> doesn't like this and doesn't keep requesting the subsequent chunks.</p>
  
  <p>Has anyone had any success streaming data directly into <code>MediaPlayer</code>?  Do I need to implement an <code>RTSP</code> or <code>Shoutcast</code> server instead?  Am I simply missing a critical <code>HTTP header</code>?  What strategy should I use here?</p>