Hi, I replaced MPMoviePlayerController with AVPlayerViewController, since MPMoviePlayerController is deprecated. I'm almost there, but I have one question. My film begins as a presentation in a presentation. When you play in full screen mode, I want it to return to NO in full screen mode when I finish the game. But I do not know how to do this. Here is my code:
- (void)viewDidLoad {
NSURL *videoURL = [[NSBundle mainBundle]URLForResource:@"movie" withExtension:@"m4v"];
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
self.controller = [[AVPlayerViewController alloc]init];
controller.player = player;
[player play];
[self addChildViewController:controller];
[self.view addSubview:controller.view];
controller.view.frame = CGRectMake(0,25, 750, 422);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:player];
}
With MPMoviePlayer, he worked with this code:
- (void) playerPlaybackDidFinish:(NSNotification*)notification{
[moviePlayerController setFullscreen:NO];
}
What code do I need to replace?
-(void)itemDidFinishPlaying:(NSNotification *) notification {
???????????}
Thanks Meg
source
share