
The figure below shows the same movie as played back in landscape and portrait:

Play Movies in Portrait Mode
The code below is from the previous post and shows how to configure the movie player view to display in landscape:MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; ... - (void) moviePlayerLoadStateChanged:(NSNotification*)notification { ... // Rotate the view for landscape playback [[self view] setBounds:CGRectMake(0, 0, 480, 320)]; [[self view] setCenter:CGPointMake(160, 240)]; [[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; // Set frame of movieplayer [[mp view] setFrame:CGRectMake(0, 0, 480, 320)]; ... }
- (void) moviePlayerLoadStateChanged:(NSNotification*)notification { ... // Rotate the view for landscape playback // [[self view] setBounds:CGRectMake(0, 0, 480, 320)]; // [[self view] setCenter:CGPointMake(160, 240)]; // [[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; // Set frame of movieplayer // [[mp view] setFrame:CGRectMake(0, 0, 480, 320)]; [[mp view] setFrame:CGRectMake(0, 160, 320, 160)]; // Scale uniformly, maintaining aspect ratio [mp setScalingMode:MPMovieScalingModeAspectFill]; ... }
No comments:
Post a Comment