i am working on an application and my app support only portrait orientation.
Supported orientation :
Now i am using a MPMoviePlayerViewController inside a viewController . Now there is a need to display Video both in landscape and portrait mode. How can i achieve this. Code which i am using for MPMovieViewController is :
-(void) playVideo
{
movieplayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"abc" ofType:@"mp4"]]];
[[NSNotificationCenter defaultCenter] removeObserver:movieplayer
name:MPMoviePlayerPlaybackDidFinishNotification
object:movieplayer.moviePlayer];
// Register this class as an observer instead
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:movieplayer.moviePlayer];
// Set the modal transition style of your choice
movieplayer.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
movieplayer.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
for(UIView* subV in movieplayer.moviePlayer.view.subviews) {
subV.backgroundColor = [UIColor clearColor];
}
[[movieplayer view] setBounds:CGRectMake(0, 0, 480, 320)];
CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI/2);
movieplayer.view.transform = transform;
movieplayer.moviePlayer.fullscreen=YES;
[self presentModalViewController:movieplayer animated:NO];
self.view addSubview:movieplayer.view];
[movieplayer.moviePlayer play];
}
- (void)movieFinishedCallback:(NSNotification*)aNotification
{
NSNumber *finishReason = [[aNotification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
MPMoviePlayerController *moviePlayer = [aNotification object];
moviePlayer.fullscreen = NO;
[movieplayer dismissModalViewControllerAnimated:NO];
// Remove this class from the observers
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
}
Please give m a clue. Thanks in advance.