我正在尝试将介绍视频添加到我的 iOS 应用程序中。我希望视频在没有控件的情况下播放,并在我为它创建的盒子中播放。但我不知道该怎么做。它也没有以正确的尺寸播放,它非常小。如果你往下看,你会看到我的尝试,但它失败了。我如何实现这一目标?
-(void)initVideo{
MPMoviePlayerViewController *moviePlayerController=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"video" ofType:@"mp4"]]];
UIView * contain = [[UIView alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
[contain addSubview:moviePlayerController.view];
[self.view addSubview:contain];
MPMoviePlayerController *player = [moviePlayerController moviePlayer];
player.fullscreen = NO;
[player play];
}