0

Is it possible to play videos of arbitrary ('exotic') aspect ratio, other than the usual 720p etc. (e.g., videos taken with an iPhone in portrait orientation, or videos cropped to be perfectly square, not rectangular)?

Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189

1 Answers1

2

The asker probably got his answer, but just in case anyone else stumbles upon this question, here's some code:

[[(MPMoviePlayerController *)videoPlayer view] setFrame:CGRectMake(x, y, w, h)];
[(MPMoviePlayerController *)videoPlayer setScalingMode:MPMovieScalingModeFill];
[(MPMoviePlayerController *)videoPlayer setFullscreen:NO];

Where setScalingMode:MPMovieScalingModeFill will distort the movie to fit the (x, y, w, h) region.

crstn.udrea
  • 103
  • 1
  • 8
  • Thank you. I never got an answer, but rather than distorting to fill, I was talking about displaying videos that originally have aspects other than 4/3, 16/9, etc... at their native resolution or uniformly scaled, no squeezing... – Nicolas Miari Sep 04 '12 at 02:23
  • What is m_pNativeVideoSurface ?? I am not getting. I have the same question asked above.Can you please help me out !! – Parvez Belim Sep 03 '13 at 07:05
  • 1
    My dumb mistake.To fit and scale the aspect `[[(MPMoviePlayerController *)m_pNativeVideoSurface view] setFrame:((UIView *)m_pNativeVideoContainer).bounds]; [(MPMoviePlayerController *)m_pNativeVideoSurface setScalingMode:MPMovieScalingModeAspectFit];` To fill the view with your video `[[(MPMoviePlayerController *)m_pNativeVideoSurface view] setFrame:((UIView *)m_pNativeVideoContainer).bounds]; [(MPMoviePlayerController *)m_pNativeVideoSurface setScalingMode:MPMovieScalingModeFill];` – crstn.udrea Sep 24 '13 at 09:51