我在我的iPad应用程序上将一个电影播放器绘制到我的视图控制器上。视图使用UIModalPresentationPageSheet以模态方式显示。
视频显示正确,但全屏时,“完成”和“比率”按钮似乎无效。如何启用这些按钮,以便在更改比率时退出全屏。
以下是我用于创建电影播放器的代码
NSString *url = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"];
NSURL *strURL =[NSURL URLWithString:url];
player = [[MPMoviePlayerController alloc] initWithContentURL:strURL];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullscreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredFullscreen:) name:MPMoviePlayerDidEnterFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[player setMovieSourceType:MPMovieSourceTypeFile];
//---play partial screen---
player.view.frame = CGRectMake(0, 42 , 780, 300);
[player prepareToPlay]; // this had to be in for it to work
[self.view addSubview:player.view];
player.shouldAutoplay = NO;
由于
丹