4

I am only aware of funcationality of ShoutCast that it streams radio list.

But not knowing how to use that in iphone app.

Right now I am just looking on its website http://www.shoutcast.com/ becaues I didn't find much stuff of this by googling execpt for its website

Any tutorials will be helpful.

I am getting response as,

<?xml version="1.0" encoding="UTF-8"?>

<stationlist>

<tunein base="/sbin/tunein-station.pls" />

<station name="PJ Nicky SuperRequest - a SHOUTcast.com member station" mt="audio/mpeg" id="172748" br="64" genre="Various" ct="(Ost. ) -" lc="9946" />

<station name="   TOP 100  ReaLCasT - a SHOUTcast.com member station" mt="audio/mpeg" id="242423" br="128" genre="" ct="- Be My Baby" lc="7485" />

<station name="Alex Jones - Infowars.com - a SHOUTcast.com member station" mt="audio/mpeg" id="1026951" br="32" genre="Talk News Political" ct="Sunday Show Replay - Hr 2 (PrisonPlanet.tv)" lc="4216" />

<station name="  .  - a SHOUTcast.com member station" mt="audio/mpeg" id="119368" br="128" genre="" ct="[db]" lc="3453" />

<station name="Auto PJ. RequestRadio - a SHOUTcast.com member station" mt="audio/mpeg" id="30375" br="128" genre="" ct="- The Star 7" lc="2453" />

</stationlist>

Successfully parse this and get /sbin/tunein-station.pls

Now how do I get

NSString *data = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:"http://yp.shoutcast.com/sbin/tunein-station.pls?id=21585&play_status=1"]];

as I am only getting /sbin/tunein-station.pls

NSString *strEscapedValue = (__bridge_transfer NSString * )CFURLCreateStringByAddingPercentEscapes(nil, (__bridge CFStringRef)data, NULL, NULL, kCFStringEncodingUTF8);

    NSLog(@"escaped value : %@",strEscapedValue);

strEscapedValue gives (null)

NSURL *url = [NSURL URLWithString:strEscapedValue];

    streamer = [[AudioStreamer alloc] initWithURL:url];
Jonas
  • 121,568
  • 97
  • 310
  • 388
Heena
  • 2,348
  • 3
  • 32
  • 58

2 Answers2

2

I am not quite sure if this will help but here is a solution I have come up with.. you can use mattgallagher audio streamer that will help you stream music from a url. now in order to get the "streaming" url you will have to parse it from a pls like this one I grabbed from the shoutcast website. You can get the aac url from the pls file by simply opening it as a text. for iPhone you can go something like this

 NSString *data = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:"http://yp.shoutcast.com/sbin/tunein-station.pls?id=21585&play_status=1"]];

note the url is of pls file which will get all the text in the pls file. now you can simply parse out the acc url and use in the audio streamer

Tushar Chutani
  • 1,522
  • 5
  • 27
  • 57
  • here you used id 21585 is your API key right? that you found after signing up with shoutcast website from AOL.but i am not able to register. AOL becomes non responsive when i try – Heena Jan 09 '12 at 04:15
  • This is not my userid I got this link from embedded code you have to figure out how to get the link your self. I mean you can't expect other people to the work for you – Tushar Chutani Jan 09 '12 at 06:13
  • I am not expecting the people to do my task.I was not able to register with shoutcast and so not getting my devID and without devID i wont be able to get any response.SO just asking you how did you got that id. – Heena Jan 09 '12 at 06:21
  • What I did was pretty much get the embed code from a station and then I found the pls link – Tushar Chutani Jan 09 '12 at 06:40
  • can you provide a link from where you got your code? because i am not able to find that rather still not getting how to get it work – Heena Jan 09 '12 at 07:11
  • just open up a radio station and copy its embedded code and find the pls link – Tushar Chutani Jan 09 '12 at 07:17
  • sorry to ask you too basic questions but i am totally not aware so..Where i can get embedded code? – Heena Jan 09 '12 at 07:21
  • How did you get this string `http://yp.shoutcast.com/sbin/tunein-station.pls?id=21585&play_status=1` because after getting response I am getting `/sbin/tunein-station.pls` only – Heena Jan 09 '12 at 09:23
0

I just found a way to have a Shoutcast stream player on your iPhone. In HTML 5. Look here, it works! http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-the-html-5-audio-element/