Our client wants to display a video in a view on the screen. The code creates an MPMoviePlayerController and installs it's view as a subview of it's container view, just like the docs say to do:
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: myVideoURL];
[moviePlayer prepareToPlay];
[moviePlayer.view setFrame: _videoPlaybackContainerView.bounds];
moviePlayer.controlStyle = MPMovieControlStyleNone;
[_videoPlaybackContainerView addSubview: moviePlayer.view];
I have the container view set up to resize when the view controller's content view resizes due to auto-rotation.
If I rotate the device while the video is playing you can see that the container view resizes, but the video does not. It gets clipped, doesn't center in the view, etc.
I guess I could try to set up the resizing masks on the player's view (we're not using AutoLayout for this project) but the docs do say to treat the player's view as an opaque structure, and I'm not sure if mucking with it's resize masks violates that or not.
I did a fair amount of searching for help on the net, but all the other discussions I could find either dealt with the movie player view CONTROLLER (a different animal) or with full-screen display, which is also different.
I've solved it.
I set the fill mode to aspect fit:
moviePlayer.scalingMode = MPMovieScalingModeAspectFit
Then when I get a didRotateFromInterfaceOrientation call in my view controller, I resize my container view and simply change the frame of the movie player's view explicitly.
I had to do some fairly gnarly math to get my video container view to resize to the largest size that exactly preserves the aspect ratio though. That probably would have been straightforward if we were using AutoLayout.