我正在尝试从 iPhone 设备上的服务器上播放视频。我正在使用以下方法来执行此操作,但是,它仅适用于模拟器;在我的 iPhone 4 上。它在 iPhone 3G 上不起作用?
如果我在 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];
}