You are using MPMoviePlayerController
in fullscreen mode, hence the rotation/s applied to its view (and/or its superview) are not being effective.
When using fullscreen mode, MPMoviePlayerController
is actually using a different approach by adding its rendering layer directly to a UIWindow - that is, it does effectively not use its view
property.
For getting the current UIWindow
when a movie is playing in fullscreen, you may use the following snippet;
UIWindow *window = [UIApplication sharedApplication].keyWindow;
if (!window)
{
window = [[UIApplication sharedApplication].windows objectAtIndex:0];
}
Once you got that window, apply your rotation/s directly to it.
This however will result in many possible issues that are hard to overcome (trust me, been there, got a collection of Tshirts). As an alternative way, I would strongly suggest you to use a fake-fullscreen mode.
Instead of initializing the player like you did
[moviePlayer setFullscreen:YES animated:YES];
Why not simply initializing its view's frame size to the entire screen - or the bounds of its superview like this
moviePlayer.view.frame = myParentViewController.view.bounds;
Then, for getting the fullscreen interface, use the following control style:
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
That way, your resulting playback will adhere to any transformation done on the superview and you will be free of side effects.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…