我无法使用MPMoviePlayerController播放视频,这是我的代码
NSString *url = [[NSBundle mainBundle] pathForResource:@"MLL_Video"ofType:@"mp4"];
MPMoviePlayerController *theMoviPlayer;
theMoviPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]];
theMoviPlayer.scalingMode = MPMovieScalingModeFill;
theMoviPlayer.view.frame = CGRectMake(0, 60, 320, 350);
self.myPlayer=theMoviPlayer;
[self.view addSubview:self.myPlayer.view];
[self.myPlayer prepareToPlay];
[self.myPlayer play];
但即使使用以下代码也无效:
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
moviePlayer.view.frame = self.view.frame;
moviePlayer.moviePlayer.shouldAutoplay=YES;
moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer.moviePlayer setFullscreen:YES animated:YES];
[self.view addSubview:moviePlayer.view];
[moviePlayer.moviePlayer play];
但它也不起作用,似乎是最新的xcode(4.4)中的一些错误,请分享,如果有任何机构有解决方案。