Video Saving in the wrong orientation AVCaptureSession

后端 未结 4 1014
情书的邮戳
情书的邮戳 2020-12-31 07:13

I\'m trying to record a video (without displaying the camera) and save it. But the video being saved is not saving in the right orientation. I\'ve tried forcing the UIViewCo

4条回答
  •  庸人自扰
    2020-12-31 07:43

    Thank you Destiny Dawn, incase anyone is looking for the code for Xamarin ios:

    AVCaptureConnection videoConnection = null;
    
    foreach(AVCaptureConnection connection in _videoOutput.Connections)
    {
        foreach ( AVCaptureInputPort port in connection.InputPorts)
        {
            if (port.MediaType == AVMediaType.Video)
            {
                videoConnection = connection;
                break;
            }
        }
    }
    
    if (videoConnection != null) {
        if (videoConnection.SupportsVideoOrientation) {
            videoConnection.VideoOrientation = AVCaptureVideoOrientation.LandscapeRight;
        }
    }
    

提交回复
热议问题