Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

B-ram

macrumors newbie
Original poster
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 make it landscape:

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

but it gives me the warning : 'MPMoviePlayerController' may not respond to '-setOrientation:animated:'

Whats happening? Is it a wrong method? please help me out of this.

Thanks!

Bram
 
...but it gives me the warning : 'MPMoviePlayerController' may not respond to '-setOrientation:animated:'

Whats happening? Is it a wrong method? please help me out of this.

Why do you think MPMoviePlayerController should respond to that method?

One way to force landscape is apply a rotation (CGAffineTransformMakeRotation) to self.view.
 
Why do you think MPMoviePlayerController should respond to that method?

One way to force landscape is apply a rotation (CGAffineTransformMakeRotation) to self.view.

I don't know somebody told me that.

ok thanks for the tip. But all the tools like play and the done button. Doe they turn to?

tx
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.