Question

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 :-/

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top