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

You can find an example in the ambient source code.
http://ambientmp.hg.sourceforge.net/hgweb/ambientmp/ambientmp/file/696c3448b456/src/main/java/sk/baka/ambient/playerservice/StreamerServer.java
>From what I gather you need to provide a file size.   I think for
streams the current kludge is to use a large file size and just keep
restarting mediaplayer when it gets to the end.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to