How to fix camera orientation when rotate device

时间:2016-02-03 03:50:37

标签: ios camera avfoundation

I use AVFoundation to record video. I set video orientation: [captureConnection setVideoOrientation:AVCaptureVideoOrientationPortrait]; When i record video, the output video looks like this:
enter image description here

But then when I rotate my device it looks like this:
enter image description here

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

3 个答案:

答案 0 :(得分:0)

I think this might be help

supportsVideoOrientation = NO

for more refer this Link

答案 1 :(得分:0)

Did u try this:

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

答案 2 :(得分:0)

相机捕获的像素缓冲区仍然以捕获它们的方向布局。许多视频播放器不会检查首选方向元数据标签,只会以原始像素方向播放文件。使用AVCaptureSession它可能会帮助你.. 请查看以下链接..

  

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