videoRotationAngleForHorizonLevelPreview
An angle the coordinator provides your app to apply to the preview layer so that it’s level relative to gravity.
Declaration
var videoRotationAngleForHorizonLevelPreview: CGFloat { get }Discussion
Your app can get immediate rotation angle updates from the rotation coordinator with key-value observation (KVO) for this property. You can immediately update your app’s UI from its key-value observation code because the rotation coordinator notifies your app on the main queue.
Apps typically apply the property’s value to an AVCaptureConnection instance’s videoRotationAngle property, such as displaying a camera preview with the correction for an AVCaptureVideoPreviewLayer instance.
Alternatively, if your app uses an AVCaptureVideoDataOutput instance to display a custom camera preview, such as with effects, don’t rotate the video with AVCaptureConnection. Instead, set the rotation in your CALayer instance’s transform property, such as with an AVSampleBufferDisplayLayer instance. This approach uses less energy than rotating each frame with the capture connection.