Skip to content

Adopt AVCaptureDeviceRotationCoordinator

MajorNeeds iOS 27.1 SDKcamera

What you see

Captured photos or video come out rotated, or preview orientation disagrees with the saved file.

AVCaptureDeviceRotationCoordinator keeps capture orientation correct, and on iPhone Duo it updates as your app moves between displays — a transition that did not exist on any previous iPhone.

Adopt the coordinator

Adopt it so your preview and photos stay upright, then turn off the compensation it makes unnecessary:

class AVCapturePhotoOutput: AVCaptureOutput {
    var isCameraSensorOrientationCompensationEnabled: Bool { get set }
}

Apple’s guidance is to adopt the rotation coordinator and then disable camera sensor orientation compensation to improve performance. The compensation is enabled on all of iPhone Duo’s front cameras.

Our advice on order: adopt the coordinator first and check the output is upright, then disable compensation, so you are never shipping a build with neither.

Preview layout

Two settings control how the preview fills a display that is a different shape from the sensor:

class AVCaptureVideoPreviewLayer {
    var videoGravity: AVLayerVideoGravity { get set }
}

class AVCaptureDevice {
    var dynamicAspectRatio: AVCaptureDevice.AspectRatio? { get }
}

When you stream the rear camera’s full field of view on the inner display, there is spare room around the preview. Apple suggests either offsetting the preview and grouping your controls in the remaining space, or letting the preview fill the display, using videoGravity.

Both front cameras have square sensors, so when streaming from them you can fill the display instead of letterboxing: use dynamicAspectRatio to select a landscape aspect ratio on the inner display.

Apple also recommends mirroring the preview when a rear camera is forward-facing, for example when the open device is flipped so the app is on the outer display, so a selfie taken with the rear cameras feels natural.

How to verify

Capture a photo and a video in every pose and on both displays. Check orientation in the preview, in the saved file, and after sharing to another app. Rotate mid-recording and confirm the result is still correct.

Applies to

← All checksFree evaluation