我将 MPMoviePlayerController 放置在我的视图中的某个大小和位置。这工作正常。但是,在某些情况下,我希望视频全屏播放。我的视图是 UISPlitViewController 的一部分,所以如果我只是获得视图宽度,它就不是全屏的。我需要的是显示视频,就好像用户单击了播放器控件中的双端箭头以最大化视频一样。
到目前为止,这是我的代码。任何人都可以填写强制全屏播放的缺失位吗?
- (void)viewDidLoad
{
[super viewDidLoad];
// FIND OUT HOW MANY VIDEOS ARE AVAILABLE
int videoCount = [[self videos] count];
// GET THE FILE NAME OF THE FIRST AVAILABLE VIDEO
NSString* fileName = [NSString stringWithFormat:@"%@.mp4", [self videos] objectAtIndex:0]];
NSArray *arrayPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString *filePath = [path stringByAppendingPathComponent:fileName];
NSURL *url = [NSURL fileURLWithPath:filePath];
// PLACE THE MOVIE AT THE CORRECT LOCATION ON THE PAGE
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[moviePlayer view] setFrame:CGRectMake(100, 100, 600, 360)];
[[moviePlayer view] setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[[self view] addSubview:moviePlayer.view];
[moviePlayer play];
if(videoCount == 1)
{
-- MAXIMISE THE VIDEO TO FULL SCREEN AND LANDSCAPE --
}
}
谢谢