在我的应用程序中,我使用 AVCapture/AssetsLibrary 录制和保存视频。当我纵向录制时,录制视频的方向还可以,但是当我横向录制时,录制视频的方向是 90 度,这很糟糕。我需要帮助请问题。我的代码是..
在我的 appDelegate.m
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
NSUInteger orientations = UIInterfaceOrientationMaskAllButUpsideDown;
if(self.window.rootViewController){
UIViewController *presentedViewController = [[(UINavigationController *)self.window.rootViewController viewControllers] lastObject];
orientations = [presentedViewController supportedInterfaceOrientations];
}
return orientations;
}
并在 myViewController.m
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
捕获会话方向
AVCaptureConnection *CaptureConnection = [MovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
if ([CaptureConnection isVideoOrientationSupported])
{
AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationPortrait;
[CaptureConnection setVideoOrientation:orientation];
}
谢谢,