我在服务器上有一个视频文件。当我复制 URL 并在 safari 中运行时,它开始使用快速播放器在浏览器中播放视频,但它没有在模拟器中播放,它显示正在加载但没有任何反应。请帮我。我该如何解决这个问题?
谢谢。
-
(void)playMovieWithUrl:(NSString*)url{
moviePlayerViewController = [[MPMoviePlayerViewController alloc] init];
moviePlayerViewController.moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayerViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[self.view addSubview:moviePlayerViewController.moviePlayer.view];
[moviePlayerViewController.moviePlayer setFullscreen:YES];
[moviePlayerViewController.moviePlayer stop];
NSLog(@"playerUrl %@",url);
[moviePlayerViewController.moviePlayer setMovieSourceType:MPMovieSourceTypeStreaming];
[moviePlayerViewController.moviePlayer setContentURL:[NSURL URLWithString:url]];
[moviePlayerViewController.moviePlayer prepareToPlay];
//moviePlayerViewController.moviePlayer.initialPlaybackTime = interval;
[moviePlayerViewController.moviePlayer play];
}