Reputation: 279
My app is locked to portrait mode in the General -> Device orientation setting.
I'm using AVCam to record the videos and i would like to record both in landscape and portrait video.
I have tried with the below approach and also i have tried the few more approaches but that doesn't help :
When the device is rotated , i have set the preview layer orientation and start recorded the video.
[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] setVideoOrientation:(AVCaptureVideoOrientation)toInterfaceOrientation];
Upvotes: 0
Views: 1189
Reputation: 873
Set video orientation of the video output connection before starting recording.
Swift 3
videoOutput.connection(withMediaType: AVMediaTypeVideo).videoOrientation = AVCaptureVideoOrientation(rawValue: UIDevice.current.orientation.rawValue)!
Upvotes: 0
Reputation: 543
Set the current device orientation while start recording the video.
// Update the orientation on the movie file output video connection before starting recording.
[[[self movieFileOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:(AVCaptureVideoOrientation)[UIDevice currentDevice].orientation];
Upvotes: 2