Nicolas Miari
Nicolas Miari

Reputation: 16256

iOS - Playing videos with arbitrary aspect ratio

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)?

Upvotes: 0

Views: 1472

Answers (1)

crstn.udrea
crstn.udrea

Reputation: 128

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.

Upvotes: 2

Related Questions