Could you please show an example of shouldAutorotateToInterfaceOrientation
method usage as a part of MPMoviePlayerViewController? As far as I know, using shouldAutorotateToInterfaceOrientation
method is available not only for UIView but also for MPMoviePlayerViewController since SDK 3.2. I've been using it in UIView, in 3.1, but I don't understand how to use it in MPMoviePlayerViewController class.
This is what I have for now:
-(IBAction) playMovie {
//declaring path to file and stuff...
MPMoviePlayerViewController *playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:[playerViewController moviePlayer]];
MPMoviePlayerController *player = [playerViewController moviePlayer];
[self.view addSubview:playerViewController.view];
player.controlStyle = MPMovieControlStyleDefault;
player.shouldAutoplay = YES;
[player setFullscreen:YES animated:YES];
}
- (void)moviePlayBackDidFinish:(NSNotification*)notification {
MPMoviePlayerViewController *moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[moviePlayer.view removeFromSuperview];
[moviePlayer release];
}
It works just fine but I need to know how to implement video autorotation. The method used for it in UIView does not help.
Thanks.