我无法使用 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) 中的一些错误,如果任何机构对此有解决方案,请分享。