0

I want to play a radio shoutcast but its a pls file format by looking at the link: http://yp.shoutcast.com/sbin/tunein-station.pls?id=13361 It doesn't play at the moment,

I have got:

Initializing:

 player = new MediaPlayer();


        try {
            player.setDataSource("http://yp.shoutcast.com/sbin/tunein-station.pls?id=13361");
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

When play button is pressed:

player.setOnPreparedListener(new OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {

        player.start();

        }
    });

I have the code tested with another shoutcast link that ends with a port like www.example.com:8080 or something like that, it was working pretty fine, but when the link changed to a pls?id= it doesn't read the link and hence I can't hear the radio... Someone please help me with this :-/

Brad
  • 159,648
  • 54
  • 349
  • 530
Mirwais Maarij
  • 203
  • 1
  • 3
  • 15
  • so , you are facing problem to read file .which format of file are you using for read? – NovusMobile Dec 25 '12 at 07:16
  • possible duplicate of [android radio shoutcast link](http://stackoverflow.com/questions/14027342/android-radio-shoutcast-link) – Brad Dec 26 '12 at 02:56

1 Answers1

1

A .pls file is just a playlist. There is no media there. You will have the parse the file yourself to get the actual stream URLs. Open it up in a text editor to see what I mean.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • 2
    Cheers I figured it out that night but you have the right answer here, a bit too late but still helpful for others if they have the same question :D – Mirwais Maarij Dec 26 '12 at 16:45