views:

394

answers:

1

I have a stream from an icecast server downloading, and I can grab the information in the headers by doing the following:

 URLConnection cn = new URL(mediaUrl).openConnection();   
    cn.connect();   

    int pos=1;
    String x;
    String y;

while (cn.getHeaderField(pos) != null) { x=cn.getHeaderFieldKey(pos); y = cn.getHeaderField(x); Log.e(":::::",""+x+" : "+y); pos++; }

When I do this all of the headers I receive are shown as:

content-type : audio/mpeg icy-br : 64 ice-audio-info : ice-samplerate=22050;ice-bitrate=64;ice-channels=2 icy-br : 64 icy-description : RadioStation icy-genre : Classical, New Age, Ambient icy-name : RadioStation Example icy-private : 0 icy-pub : 1 icy-url : http://exampleradio.com server : Icecast 2.3.2 cache-control : no-cache

However if I open my stream in mplayer I get:

 ICY Info: StreamTitle='artist - album - trackname' 

and with each time the song is changed, the new track information is sent appearing the same way in mplayer.

In android when I attempt to read the icy-info all I get returned is null. Also how would I go about retrieving the new information from the headers while I am buffering from the stream? Because even if I try to read the header of something I already know exists whilst buffering such as:

  Log.e(getClass().getName()," "+cn.getHeaderField("icy-br"));

All I get returned is null.

I hope this makes sense, I can post more code on request.

A: 

Hi,

I've not the answer to your question, but i'm very interested by the way you get and open the audio stream from an Icecast url in the MediaPlayer.

Thanks by advance for your help.

Duke