【问题标题】:My iPhone Video Only Plays in Portrait Mode我的 iPhone 视频仅在纵向模式下播放
【发布时间】:2011-02-06 02:14:16
【问题描述】:

我正在使用 MPMoviePlayerController 播放电影。电影以纵向模式开始(因为这是应用程序使用的唯一模式),即使设备旋转也会停留在那里。我从未明确设置过 shouldAutoRotateetc。响应横向和纵向的功能,因为我不希望我的视图调整大小。有没有办法让视频响应纵向和横向旋转?任何帮助将不胜感激。

仅供参考:这是我的代码

NSString *filepath = [[NSBundle mainBundle] pathForResource:@"TestMovie" ofType:@"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];

//Listen so we can clean up after the movie is over
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

[self.view addSubview:moviePlayerController.view];
[moviePlayerController setFullscreen:YES animated:YES];
[moviePlayerController play];

【问题讨论】:

    标签: iphone ios ios4 mpmovieplayercontroller


    【解决方案1】:

    嗯。好的。在我被难住了半小时后想通了。

    现在显然有一个 MPMoviePlayerViewController 可以处理所有这些。这是我的新更新代码:

        MPMoviePlayerViewController *moviePlayerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:videoURL] autorelease];
    [self presentMoviePlayerViewControllerAnimated:moviePlayerView];
    

    这将允许它响应旋转事件等。很好!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-27
      • 1970-01-01
      相关资源
      最近更新 更多