我试图从iPhone设备上的服务器上播放视频。我使用下面的方法来实现,但是,它只能在模拟器中使用;和我的iPhone 4上。它不适用于iPhone 3G?MPMoviePlayerViewController意外退出
如果我在iPhone 3G上调用此方法,它会打开视频模式屏幕,开始加载视频,然后突然关闭模式屏幕。在控制台中不显示错误。
iPhone 3G已安装4.0版本。我的iPhone 4有4.1版本。
有没有其他人经历过这个?
-(IBAction)playMedia{
NSString* url = [self.data objectForKey:@"url"];
//initialize the movie player
self.moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
//show a background image while the user waits
moviePlayerViewController.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
//show the movie
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
[moviePlayerViewController release];
}
您是否可以通过iOS 4获得iPhone 3G以通过其他应用播放远程视频?一些人(包括我自己)在3G设备上运行iOS 4时遇到了很多问题。如果您在其他应用中遇到稳定性问题,请尝试重新启动设备,然后重试? – pix0r 2010-09-13 22:26:03