1

谁能告诉我如何强制 MPMoviePlayerViewController 在开始播放视频后立即全屏播放。我试过 setFullScreen:animated: 函数,但它不起作用。那么有人可以帮我解决这个问题吗?提前致谢。

我也只使用我的应用程序包中的视频文件。

4

2 回答 2

5

这解决了我的问题。

NSURL *movieUrl = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"appVid"
                                                                          ofType:@"mp4"]];
moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:movieUrl];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
moviePlayer.shouldAutoplay = YES;
moviePlayer.view.frame = [[UIApplication sharedApplication]keyWindow].bounds;
[[[UIApplication sharedApplication]keyWindow] addSubview:moviePlayer.view];

[moviePlayer setFullscreen:YES animated:YES];

[moviePlayer play];
于 2013-10-18T08:53:24.090 回答
1

你好 Ashwani Sharma 使用这个

NSURL *url = [[NSBundle mainBundle] URLForResource:@"Robot" withExtension:@"m4v"];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
moviePlayer.view.transform = CGAffineTransformConcat(moviePlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2));
[moviePlayer.view setFrame: self.view.bounds];
[self.view addSubview: moviePlayer.view];
[moviePlayer play];

比+1

于 2013-10-16T10:31:30.617 回答