简体   繁体   中英

How to fix camera orientation when rotate device

I use AVFoundation to record video. I set video orientation: [captureConnection setVideoOrientation:AVCaptureVideoOrientationPortrait]; When i record video, the output video looks like this:
在此处输入图片说明

But then when I rotate my device it looks like this:
在此处输入图片说明

I want my video always like the first image even when rotate device. What I have to do? Thanks in advance

I think this might be help

supportsVideoOrientation = NO

for more refer this Link

Did u try this:

if ([captureConnection isVideoOrientationSupported])
{
    [captureConnection setVideoOrientation: AVCaptureVideoOrientationPortrait];
}

The pixel buffers captured by the camera are still laid out in the orientation in which they were captured. Many video players will not check for the preferred orientation metadata tag and will just play the file in the native pixel orientation. use AVCaptureSession it may be help you.. please check below link..

https://developer.apple.com/library/ios/qa/qa1744/_index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM