需求:要求横屏拍摄视频。
拍摄视频有两种方式:
方式1:UIImagePickerController
使用UIImagePickerController调用系统的相机来录制视频,进去后默认是竖屏的拍摄;查看了下苹果官方文档:
Important
The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.
说的是UIImagePickerController只支持竖屏拍摄模式。
so, 只能使用AVFoundation来定制一个只有横屏的拍摄模式。
方式2:AVFoundation