0

当我的应用程序运行时,视频和手机被评为横向模式,然后我的视频在右下角播放,有没有办法让视频在用户旋转时位于屏幕中间?

4

1 回答 1

0

我不确定您是如何运行视频的,但请尝试这样做(在导入 MediaPlayer/MediaPlayer.h 之后):

NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"ExampleVideo" ofType:@"m4v"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *testMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
testMovie.scalingMode = MPMovieScalingModeAspectFit;
[testMovie play];
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];

当我播放电影时,我称之为它,它适用于旋转。

于 2012-06-22T04:39:00.417 回答