<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/videoRotationAngleForHorizonLevelPreview",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureDeviceRotationCoordinator(py)videoRotationAngleForHorizonLevelPreview"
  },
  "title" : "videoRotationAngleForHorizonLevelPreview"
}
-->

# videoRotationAngleForHorizonLevelPreview

An angle the coordinator provides your app to apply to the preview layer so that it’s level relative to gravity.

```
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.

> Important:
> Avoid unnecessary delays and visual artifacts by updating your app’s UI directly from an observer that monitors the property.

Apps typically apply the property’s value to an [`AVCaptureConnection`](/documentation/AVFoundation/AVCaptureConnection) instance’s [`videoRotationAngle`](/documentation/AVFoundation/AVCaptureConnection/videoRotationAngle) property, such as displaying a camera preview with the correction for an [`AVCaptureVideoPreviewLayer`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer) instance.

Alternatively, if your app uses an [`AVCaptureVideoDataOutput`](/documentation/AVFoundation/AVCaptureVideoDataOutput) instance to display a custom camera preview, such as with effects, don’t rotate the video with [`AVCaptureConnection`](/documentation/AVFoundation/AVCaptureConnection). Instead, set the rotation in your <doc://com.apple.documentation/documentation/QuartzCore/CALayer> instance’s <doc://com.apple.documentation/documentation/QuartzCore/CALayer/transform> property, such as with an [`AVSampleBufferDisplayLayer`](/documentation/AVFoundation/AVSampleBufferDisplayLayer) instance. This approach uses less energy than rotating each frame with the capture connection.

> Note:
> Your app needs to convert the ``doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/RotationCoordinator/videoRotationAngleForHorizonLevelPreview`` value from degrees to radians for an asset writer layer’s transform, which is a <doc://com.apple.documentation/documentation/QuartzCore/CATransform3D>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)