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.
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
MediaPlayer
has a lot of bugs before 4.0 (that fixed a lot a RTSP bugs).If it looked like the screenshot on this other question when it is playing in the Browser, then it should be the AudioPreview Activity from the Music app.
You should be able to
launch it by simply calling startActivity()
with an Intent that matched one of its IntentFilter in the manifest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With