---
title: videoRotationAngleForHorizonLevelPreview
framework: avfoundation
role: symbol
role_heading: Instance Property
path: avfoundation/avcapturedevice/rotationcoordinator/videorotationangleforhorizonlevelpreview
---

# videoRotationAngleForHorizonLevelPreview

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

## Declaration

```swift
var videoRotationAngleForHorizonLevelPreview: CGFloat { get }
```

## Discussion

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 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. note: Your app needs to convert the videoRotationAngleForHorizonLevelPreview value from degrees to radians for an asset writer layer’s transform, which is a CATransform3D.

## See Also

### Compensating for a device’s rotation

- [videoRotationAngleForHorizonLevelCapture](avfoundation/avcapturedevice/rotationcoordinator/videorotationangleforhorizonlevelcapture.md)
