利用IIS7编写了音频直播服务。音频直播服务器设置非常复杂,但已经成功。
我获得了这样一个流的URL (@“http://xxx.xxx.xx.xx/liveStream.isml/manifest(format=m3u8-aapl).m3u8")。
我的使用代码出乎意料地简单。
self.theURL = [NSURL URLWithString:@"http://xxx.xxx.xx.xx/liveStream.isml/manifest(format=m3u8-aapl).m3u8"];
if(moviePlayer == nil)
{
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
}
[moviePlayer play];嗯..。我不能按我的意愿控制音乐播放器。
问题就像这样。
即使是backgroundMode,我也不想停下来演奏音乐。
请告诉我一些建议。谢谢。
发布于 2012-02-28 12:27:35
请只检查设备,我在申请中也做过。下面给出了我的代码。我说的是iOS5
和plist中,我制作了一个名为“必需的后台模式”的数组,并在数组名“array”中插入了一个条目。
- (void)viewDidLoad
{
[super viewDidLoad];
NSError *setCategoryErr = nil;
NSError *activationErr = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryErr];
[[AVAudioSession sharedInstance] setActive: YES error: &activationErr];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
UIBackgroundTaskIdentifier newTaskId = UIBackgroundTaskInvalid;
newTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL];
}https://stackoverflow.com/questions/9292421
复制相似问题