What does android web browser use for playing audio streams? MediaPlayer or something else?
android, android-mediaplayer
Solution
Fact
The Browser has extra features set up to strip the video source from the page and launch it in the native player most of the time. This functionality is not built into WebView, and the native player is very picky about what needs to passed into it as a URI to be able to play it.
It works since Gingerbread in the default android browser.
Possible explaination
You probably don't use the `MediaPlayer` the way the android browser does. Post some code to help futher help.
Further help
- The `MediaPlayer` has a lot of bugs before 4.0 (that fixed a lot a RTSP bugs).
- The Web Audio API as described by W3C: link
- Here is a detailed list of all media formats and protocols supported by Android: link
- Testing page: link
- This complete blog post also helped me about media streaming for Android: link
Problem
I have rtsp audio streams from a specific site (m.aveamuzik.com) that play within a browser. When I try to play the same stream using `MediaPlayer` class, I get `MEDIA_ERROR_UNKNOWN` (with extra=`-2147483648`). The error is not well documented but a little googling shows that it is most probably because of unsupported media format. My question is, if `MediaPlayer` class does not support some format, how does the built-in browser play it? Also, how to use the same mechanism used by the browser in my code, instead of the `MediaPlayer` class? Edit 1: @Joe I tried the following code: ``` Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(streamURL)); startActivity(intent); ``` MX Player and BSPlayer showed up as options to open the file, but not anything related with `AudioPreviewActivity`. Actually this is quite reasonable as my URLs are `rtsp`, but the intent filters for `AudioPreviewActivity` are just for `http`, `file` and `content` type of URIs.