0
我已经创建了一个应用程序能够实时流式传输,但是我目前无法测试视频是否处于活动状态。我正在尝试创建一个if if语句来测试视频是否处于活动状态。我正在使用返回“d”结果的JSON Web服务。我目前使用的代码块下面的IB动作设计,播放视频文件:iPhone测试视频链接是否有效
-(IBAction) playVideo:(id)sender {
NSString *baseVideoUrl = @"http://streaming5.calvaryccm.com:1935/live/iPhone/playlist.m3u8";
NSLog(@" finalUrl is : %@",baseVideoUrl);
//EXPERIMENTAL
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.calvaryccm.com/ServiceTimes.asmx/IsServiceTime/path"]];
[request setHTTPMethod:@"POST"];
if (NSString *postString = @"d";) {
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
}
else{
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:baseVideoUrl]];
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
// Use the 3.2 style API
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
}
}
}
我不知道我做错了。我需要帮助创建测试流是否处于活动状态的语句。
它的工作原理!谢谢! – 2011-06-16 13:11:36