我只知道ShoutCast的功能,它流电台列表。
但不知道如何在iphone应用程序中使用它。
现在我只是在看它的网站http://www.shoutcast.com/,因为我在谷歌上搜索它的网站并没有找到太多的东西
任何教程都会很有帮助。
我得到的回应是,
<?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];发布于 2012-01-08 03:44:06
我不太确定这是否会有帮助,但这是我想出的一个解决方案。你可以使用mattgallagher audio streamer,它可以帮助你从url中流式播放音乐。现在,为了得到“流媒体”的one ,你必须从我从shoutcast网站抓取的pls中解析出来。您可以通过简单地以文本形式打开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并在音频流中使用。
发布于 2012-01-18 07:29:03
我刚刚找到了一种在你的iPhone上播放Shoutcast流播放器的方法。在HTML5中。看这里,它起作用了!http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-the-html-5-audio-element/
https://stackoverflow.com/questions/8768643
复制相似问题