Android MediaPlayer - loading and streaming at the same time

This question was asked before, but now with newer versions of Android (before Jelly Bean), I was wondering if there was any progress in downloading and streaming the file at the same time. From the API, it doesn't look as much as possible, as these are the available setDataSource methods:

void setDataSource(String path) Sets the data source (file-path or http/rtsp URL) to use. void setDataSource(Context context, Uri uri, Map<String, String> headers) Sets the data source as a content Uri. void setDataSource(Context context, Uri uri) Sets the data source as a content Uri. void setDataSource(FileDescriptor fd, long offset, long length) Sets the data source (FileDescriptor) to use. void setDataSource(FileDescriptor fd) Sets the data source (FileDescriptor) to use. 

Unfortunately, it does not accept InputStream of any type. There are examples that use the old NPR proxy code, which opens the local web server in the Android application, remotely downloads content and displays the requested data to any listening sockets, however this code is more than 2 years old, and it is still used as standard for this task (although many people report that there are stuttering problems, etc.).

I looked at the MediaPlayer class and wanted to expand it to provide this behavior, however, most of the implementation is done using native code and from what I read, different device manufacturers implement their own audio functions differently (and if so, I don’t want to touch his!:)).

So, what is the best method for storing and simultaneously streaming incoming audio data (MP3 or OGG) from a remote server without discarding data? Preferably with versions of Android 2.2 and higher, but entry into any available API will be appreciated.

+6
source share
1 answer

Creating a local proxy is your best bet. I did not watch the NPR example, but I made a similar use of Naga. See my answer here .

+1
source

All Articles