Android: MediaPlayer, How to get the audio stream properties?

I can successfully listen to the audio stream using the MediaPlayer interface, but how can I get the stream properties, such as the current bit rate, or the text of the stream (many streams, such as linear radio stations, include the track currently being played)?

I tried to find this information, but could not, if possible, have a list somewhere on the Android developer site that lists the various available "properties"?

+6
android properties stream media-player
source share
3 answers

First, the Android DEV site is a site with all the class information, but sometimes it's hard to find what you need. In this case, checking the source of the java class can be very useful.

With a quick search in the SDK, there is an onInfoListener interface that can be implemented in a class that extends MediaPlayer . To do this, you need public boolean onInfo(MediaPlayer mp, int what, int extra) . http://developer.android.com/reference/android/media/MediaPlayer.OnInfoListener.html claims to have something = MEDIA_INFO_METADATA_UPDATE .

But - a google check for this would give the idea that it would never be called: - / Therefore, you will end up on your own ...

+3
source share

I could make it harder than necessary, but you can decode the Stream frame using Jlayer or other MP3 decoding to get the information you are looking for. Not sure if there is a way to do this using Android sdk.

0
source share

If your stream is a shoutcast / icecast stream, you can use the utility class http://code.google.com/p/streamscraper/ to extract metadata, including the name of the song. In addition, you can create your own metadata extractor. See http://www.smackfu.com/stuff/programming/shoutcast.html for more information.

-2
source share

All Articles