无法在ios6中播放视频

时间:2012-10-23 09:10:36

标签: iphone

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

0 个答案:

没有答案