0
我有一个用户可以选择观看的视频列表。所有视频都包含在应用资源中并在本地播放。肖像中的视频列表;在景观中播放视频
我有一切工作很好,除了一件事。我无法弄清楚如何强制视频播放进入横向模式。
我使用这个代码时选择视频显示视频播放器:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
VideoPlayerViewController *detailViewController = [[VideoPlayerViewController alloc] init];
detailViewController.delegate = self;
detailViewController.contentPath = [[videos objectAtIndex:indexPath.row] objectAtIndex:1];
[self presentModalViewController:detailViewController animated:YES];
}
我的播放器类,VideoPlayerViewController加载使用的contentPath在上面的代码中设置播放器和播放视频。
我可以旋转我的手机并切换到风景,但如果我将手机旋转回肖像,视频也会旋转。我的播放器有以下代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
任何想法为什么它允许旋转回肖像以及如何在景观中开始播放?
我正在寻找与本机YouTube应用类似的功能。
感谢
这是真棒Safecase。它完美的作品。非常感谢你。 – kinadian