5.1 中是否有任何更改会影响MPMoviePlayerViewController在设备方向方面的工作方式?
我今天开始收到用户报告说视频仅以纵向模式播放。我发现他们使用的是 5.1,我迅速升级了一个设备来重现这种情况。我的代码没有改变并且在 4.x、5.0 和 5.01 中完美运行。
我的应用程序中的所有视图都以纵向模式显示,除非用户单击视频,否则电影播放器应该会占据整个屏幕并更多地进入横向模式。该应用使用 5.0 SDK 但面向 4.0。这是我用来显示视频的代码:
VideoPlayer *vp = [[VideoPlayer alloc] initWithContentURL:movieURL];
vp.moviePlayer.movieSourceType = src;
vp.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
vp.moviePlayer.shouldAutoplay = TRUE;
[self presentMoviePlayerViewControllerAnimated:vp];
VideoPlayer是MPMoviePlayerViewController的子类,其中shouldAutorotateToInterfaceOrientation被覆盖,如下所示:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIDeviceOrientationLandscapeLeft);
}
整个 Internet 甚至 Apple 都推荐这种模式。我不明白为什么它不能在 iOS 5.1 下运行,或者为什么没有更多人对此抱怨。
任何帮助将不胜感激。