How do you get the metadata for a stream played through minim?

edited October 2014 in How To...

I hope this is the right place to ask and answer this question, I'm new here. I like to play streaming audio through minim, and the call to get player getMetadata was not giving the song/artist, and since most players will show it, I figured it had to be in there somewhere.

After moving to eclipse and debugging a bit, I found for shoutcast/icy streams, this will give you the stream title, which for a lot of the things I listen to is of the form "Artist - Song Title". Anyway, I wanted to pass this along as I couldn't find it in the docs etc., hoping this is not an "everyone knew that" thing. Happy processing!

You'll need this:

import javazoom.spi.mpeg.sampled.file.IcyListener;

Then in your draw method, to periodically show the data, something like this. The key part is the getting of the listener, and then calling the method on it:

        if ((frameCount % 20) == 0) {
            IcyListener icyListener = IcyListener.getInstance();
            String streamTitle = icyListener.getStreamTitle();
            text(streamTitle, 20, 20);    
        }
Tagged:
Sign In or Register to comment.