Get ShoutCast / IceStream metadata using mp3spi1.9.5

I use JLayer to broadcast online radio music, so the simple code for this is here: (Where StreamPlayer is a special implementation of JLayer >)

// Example URL of the radio station http://radio.flex.ru:8000/radionami

/** * Plays the Given Online Stream * * @param url * <b> The Specified url you want to connect </b> * @throws IOException * @throws JavaLayerException */ public void playRadioStream(URL spec) { try { // Connection URLConnection urlConnection = spec.openConnection(); // Connecting urlConnection.connect(); // Try to play it StreamPlayer player = new StreamPlayer(); player.open((urlConnection.getInputStream())); player.play(); } catch (StreamPlayerException | IOException e) { e.printStackTrace(); } } 

Problem:

I can’t understand how to extract information from this connection, how the song is playing now from this radio station or the name of the station, etc. Help is really appreciated!

Edit:

If you want to use JLayer instead of StreamPlayer , it will work, although you will have to run it on another Thread from the main Thread application.

+5
source share

All Articles