Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: MediaPlayer, How to get properties of an audio stream?

I can successfully listen to an audio stream with the MediaPlayer interface, but how can I get properties of the stream like the current bit rate, or the stream text (lots of streams like on line radios include the currently playing track)?

I tried to find this information but couldn't, if these things are possibly is there a list somewhere on the android dev site where the various available 'properties' are listed?

like image 948
jwbensley Avatar asked Jan 30 '11 12:01

jwbensley


1 Answers

First, the Android DEV site is the site with all class information - but sometimes hard to find what you need. In that case, checking the java source of the class can be quite helpful.

From a quick look into the SDK, there is an onInfoListener interface, which you can implement in a class extending MediaPlayer. That needs you to have public boolean onInfo(MediaPlayer mp, int what, int extra) implemented. http://developer.android.com/reference/android/media/MediaPlayer.OnInfoListener.html states there is a what=MEDIA_INFO_METADATA_UPDATE.

But - checking google for that would give the idea that this never gets called :-/ So eventually you are on your own with that...

like image 163
Oliver Avatar answered Sep 30 '22 12:09

Oliver