Wednesday, November 21, 2012

MPMoviePlayerController play the movie landscape mode only while rotating devie also




-(IBAction)playMovie:(id)sender
{
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"big-buck-bunny-clip" ofType:@"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];

[moviePlayerController.view setFrame:CGRectMake(0, 0, 320, 480)];
moviePlayerController.view.transform = CGAffineTransformConcat(moviePlayerController.view.transform, CGAffineTransformMakeRotation(M_PI/360)); // to rotate the movie palyer controller
[moviePlayerController.view setFrame: self.view.bounds];
[self.view addSubview: moviePlayerController.view];
[moviePlayerController play];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
[self.view addSubview:moviePlayerController.view];
[moviePlayerController play];
}







No comments:

Post a Comment