我的iPhonevideo只能在肖像模式下播放
我正在使用MPMoviePlayerController播放电影。 电影以纵向模式启动(因为这是应用程序使用的唯一模式),即使设备旋转,也会保留在那里。 我从来没有明确设置shouldAutoRotateetc。 function来响应风景和肖像,因为我不希望我的意见resize。 有没有办法让video响应肖像和风景旋转? 任何帮助将不胜感激。
仅供参考:这是我的代码
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];
嗯。 好。 我被困住了半个小时后发现了它。
显然现在有一个MPMoviePlayerViewController来处理所有这些。 这是我的新的更新的代码:
MPMoviePlayerViewController *moviePlayerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:videoURL] autorelease]; [self presentMoviePlayerViewControllerAnimated:moviePlayerView];
这将允许它响应旋转事件等。很好!
- 为iOS设置Fastlane MATCH
- 我如何更改代码中的UIBarButtonItem风格
- iOS:Google Analytics和AdMob出现CocoaPods问题
- iOS Swift:如何使用TwitterKit将video发布到Twitter?
- ARKit怎么了? #9 —手势控制,USDZ生成器,电影预览IRL
- 有可能有一个游戏中心“LowestScore”排行榜?
- 在NSDocumentDirectory上禁用数据备份时CFURLSetResourcePropertyForKey失败
- 如何在GMSMapView上设置自定义标注标记(点附近的animation环)
- 计算上一个星期日DST在前一个星期日更改的时间