简体   繁体   中英

How to use Shoutcast in iphone app?

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];

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

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM