我试图在屏幕刚刚启动时以全屏模式播放视频,但有些我怎么也无法播放视频。我使用下面的代码来播放视频但视频没有播放请告诉我我怎么能以全屏模式播放。
NSURL *fileURL = [NSURL URLWithString:[IMAGE_BASE_URL stringByAppendingString:self.image_url]];
[self.moviePlayerController.view setFrame:CGRectMake(0, 70, self.view.frame.size.width, self.view.frame.size.height)];
self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
CGRect movieFrame;
movieFrame.size = self.view_video.frame.size;
[self.moviePlayerController.view setFrame:movieFrame];
[self.moviePlayerController setControlStyle:MPMovieControlStyleEmbedded];
[self.moviePlayerController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.moviePlayerController setScalingMode:MPMovieScalingModeFill];
[self.view_video addSubview:self.moviePlayerController.view];
[self.view_video bringSubviewToFront:self.moviePlayerController.view];
[self.moviePlayerController play];
[self.moviePlayerController setFullscreen:TRUE animated:TRUE];
[self.moviePlayerController setScalingMode:MPMovieScalingModeAspectFill];
[self.moviePlayerController setControlStyle:MPMovieControlStyleFullscreen];
答案 0 :(得分:0)
self.moviePlayerController = [[MPMoviePlayerController alloc] init];
[self.moviePlayerController.view setFrame:CGRectMake(0, 70,self.view.frame.size.width, self.view.frame.size.height)];
[self.moviePlayerController setShouldAutoplay:NO];
[self.moviePlayerController setContentURL:self.videoURL];
[self.moviePlayerController setFullscreen:YES animated:YES];
self.moviePlayerController.controlStyle=MPMovieControlStyleFullscreen;
[self.moviePlayerController play];
[self.view addSubview:self.videoController.view];