How to play my video in landscape mode

Joined
Oct 20, 2010
Messages
2
Reaction score
0
Points
1
Hi guys,

I have a video in my application but its portrait.

I want it Landscape but i really don't have any idea how to do that.

i used this code to make my video:

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

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:)name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

 [self.view addSubview:moviePlayerController.view];
 moviePlayerController.fullscreen = YES;
 //Uncomment om beeld formaat aan te passen
 //moviePlayerController.scalingMode = MPMovieScalingModeAspectFill;
 [moviePlayerController play];
}

- (IBAction)playSecondMovie:(id)sender{

 NSString *filepath = [[NSBundle mainBundle] pathForResource:@"00 01. Welcome" ofType:@"mov"];
 NSURL *fileURL = [NSURL fileURLWithPath:filepath];
 MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:)name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

 [self.view addSubview:moviePlayerController.view];
 moviePlayerController.fullscreen = YES;
 //Uncomment om beeld formaat aan te passen
 //moviePlayerController.scalingMode = MPMovieScalingModeAspectFill;
 [moviePlayerController play];

}

- (void)moviePlaybackComplete:(NSNotification *)notification
{
 MPMoviePlayerController *moviePlayerController = [notification object];
 [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

 [moviePlayerController.view removeFromSuperview];
 [moviePlayerController release];
}

-(void) tableView: (UITableView*) tableView 
didSelectRowAtIndexPath: (NSIndexPath*) indexPath
{


 NSString *filepath = [[NSBundle mainBundle] pathForResource:@"BAZO" ofType:@"m4v"];
 NSURL *fileURL = [NSURL fileURLWithPath:filepath];
 MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:)name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

 [self.view addSubview:moviePlayerController.view];
 moviePlayerController.fullscreen = YES;
 //Uncomment om beeld formaat aan te passen
 //moviePlayerController.scalingMode = MPMovieScalingModeAspectFill;
 [moviePlayerController play];

 /*-(void)loadVideo:(NSString *)name ofType:(NSString *)type{
  NSURL *url=[NSURL fileURLWithPath:[mainBundle pathForResource:@"BAZO"  ofType:@"m4V"]]
  if (!mp) mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
  [mp play];
 }*/
}

I used this code to set the orientation:

Code:
[MPMoviePlayerController setOrientation:UIDeviceOrientationLandscapeLeft animated:NO];

But i heard form people that this will be rejected form the app store?

and it gives me this warning:

'MPMoviePlayerController' may not respond to '-setOrientation:animated:'

Whats happening?

Thanks!

Bram
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top