AVFoundation · class
AVCaptureDeviceRotationCoordinator
Keeps capture rotation correct as an app moves between iPhone Duo's inner and outer displays, and replaces manual sensor-orientation compensation.
Rotation has to stay correct while an app moves between two displays that are not the same shape. The coordinator is how.
Adopting it
Create one per preview, then disable sensor orientation compensation — leaving both on is double-correcting, and the symptom is video that is right in preview and wrong in the file.
Its sibling
AVCaptureDeviceDirectionCoordinator is a different job: keeping the right
front camera active as the device folds. iPhone Duo has two front cameras
— an outer ultrawide up to 4K/120, and an under-display inner ultrawide
at 1080p/60 — and which one is “the front camera” changes with the pose.
It is main-actor isolated, and it lives in AVKit rather than AVFoundation.
If you render both displays
Use a separate coordinator for each view. One coordinator describing two displays is the bug this API exists to prevent.
The virtual front camera
Asking for the generic front camera gets you the capabilities both physical cameras share: 1080p/60, no depth. Request the individual device types when you want what each is actually capable of.
Doing the work
This page describes the symbol. For the task, see adopt AVCaptureDeviceRotationCoordinator.