谁能告诉我如何强制 MPMoviePlayerViewController 在开始播放视频后立即全屏播放。我试过 setFullScreen:animated: 函数,但它不起作用。那么有人可以帮我解决这个问题吗?提前致谢。
我也只使用我的应用程序包中的视频文件。
这解决了我的问题。
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];
你好 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