2012-01-07 51 views
4

我只知道ShoutCast的功能,它流式无线电列表。如何在iphone应用程序中使用Shoutcast?

但不知道如何使用iPhone应用程序。

现在,我只是希望在其网站上http://www.shoutcast.com/ becaues我没有使用Google通过对execpt其网站

任何教程将有助于找到这么多东西。

我得到的响应为,

<?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> 

成功解析这一点,并得到/sbin/tunein-station.pls

现在我如何才能

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

,因为我只得到/sbin/tunein-station.pls

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

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

strEscapedValue(null)

NSURL *url = [NSURL URLWithString:strEscapedValue]; 

    streamer = [[AudioStreamer alloc] initWithURL:url]; 
+0

您需要获取他们的aac链接 – 2012-01-07 09:44:45

+0

什么是aac链接?我在这个链接上找到了文档,http://dev.aol.com/SHOUTcast/documentation – Heena 2012-01-07 09:46:37

+0

你应该能够在shoutcast站点上指向一个AVPlayer。 – 2012-01-07 09:55:48

回答

1

我不太清楚这是否会帮助,但这里是一个解决方案,我想出了..你可以使用mattgallagher audio streamer这将帮助你从一个URL串流音乐。现在为了获得“流媒体”的网址,你将不得不从这样的网站上抓取这样的one来解析它。只需将其作为文本打开,即可从pls文件获取aac url。对于iPhone你可以去这样的事情

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

请注意url是pls文件,它将获得pls文件中的所有文本。现在你可以简单地解析出acc url并在音频流中使用

+0

获得播放流,在这里你使用的ID 21585是你的API密钥的权利?您在与AOL注册shoutcast网站后发现的问题,但我无法注册。 AOL在我尝试使用时无法响应 – Heena 2012-01-09 04:15:00

+0

这不是我的用户标识我从嵌入代码中获得此链接,您必须弄清楚如何获取链接。我的意思是你不能指望其他人为你工作 – 2012-01-09 06:13:47

+0

我不期望人们做我的任务。我无法注册shoutcast,所以没有得到我的devID,没有devID我不能得到任何只是问你你是怎么得到这个ID的。 – Heena 2012-01-09 06:21:20

相关问题