无法检索Shoutcast .pls流

时间:2012-11-21 20:18:21

标签: ios objective-c shoutcast

我正在尝试从shoutcast服务器获取.pls流,以便在我的ios应用中播放。到目前为止,我一直没有成功。我在stackoverflow上发布了很多帖子但是没有这些帖子有任何帮助。

任何人都可以向我解释,如果可能的话,如何让.pls流式传输?

2 个答案:

答案 0 :(得分:7)

你需要的只是列出你的无线电端口,这是一个有效的例子:   in - (void)viewDidLoad

NSURL *vibes = [NSURL URLWithString:@"http://website.com:8002"];
vPlayer = [[AVPlayer alloc] initWithURL:vibes];
self.myViewVolume = [[MPVolumeView alloc] initWithFrame:CGRectMake(20, 330, 280, 50)];
[self.myViewVolume sizeToFit];
[self.view addSubview:self.myViewVolume];

您需要在.m文件中创建一个AVPlayer实例,这里是vPlayer 别忘了为你的项目添加AVFoundation框架,你可以用[玩家游戏]和[玩家停止]播放和停止游戏

AVPlayer的一个问题是缺乏简单的音量控制,你可以添加一个mpViewVolume。 我也在开发无线电应用程序,到目前为止AVPlayer是最好的播放shoutcast流。

答案 1 :(得分:2)

@Walid Hussain 它适用于我使用AVPlayer

AVFoundation.framework

相关联
//import needed
#import <AVFoundation/AVFoundation.h>

// declaration for the player  
AVPlayer * radioPlayer;

// play
NSURL * url = [NSURL URLWithString:@"http://energy10.egihosting.com:9636"];
radioPlayer = [[AVPlayer playerWithURL:url] retain];
[radioPlayer play];