Skip to content

Xcode27 adpot AVCaptureDevice.RotationCoordinator #5426

Description

@ChengzhiHuang

The app should adopt AVCaptureDevice.RotationCoordinator rather than deriving preview rotation itself. Apply its videoRotationAngleForHorizonLevelPreview to thevideoRotationAngle on the AVCaptureConnection feeding the preview layer, and its videoRotationAngleForHorizonLevelCapture to the connection feeding the capture output.

This change does not require building against the latest SDK. AVCaptureDevice.RotationCoordinator has been available since iOS 17, so the app can adopt it today, and doing so is safe across the app’s existing install base — it produces the correct rotation on currently shipping hardware and on earlier iOS releases as well as on new hardware.

AVCaptureDevice.RotationCoordinator documentation: https://developer.apple.com/documentation/avfoundation/avcapturedevice/rotationcoordinator

Sample code building a camera app: https://developer.apple.com/documentation/avfoundation/avcam-building-a-camera-app

从 iPhone 17Pro 开始 前置摄像头 sensor 有一定的改变,之前苹果有使用一些兜底方案来保证画面的角度是正确的,一旦 app 用 iOS27 或者更新的SDK 来 build ,这个兜底方案就不会生效了。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions