iOS: 视频输出 `outputOrientation` 返回设置的值,而不是连接状态; `currentResolution` 返回 undefined
1. outputOrientation is effectively write-only on a video output
ios/Hybrid Objects/Outputs/HybridCameraVideoOutput.swift:
var outputOrientation: CameraOrientation = .up {
didSet {
guard let connection = output.connection(with: .video) else { return }
try? connection.setOrientation(outputOrientation)
}
}It is a stored property whose didSet writes to the connection. Reading it returns the stored value, never the connection state. The preview output does implement the getter properly, which is what makes this look like an oversight rather than a deliberate choice — HybridCameraPreviewOutput.swift:
var outputOrientation: CameraOrientation {
get { return previewLayer.connection?.orientation ?? .up }
set { /* ... */ }
}AVCaptureConnection.orientation already exists in this repo (AVCaptureConnection+orientation.swift), so the video output could use the same accessor. I want to be precise about what this would and would not fix: since configure(config:) already calls connection.setOrientation(outputOrientation) with the default .up, a corrected getter would return .up — the connection genuinely is .portrait. It would make the getter honest, but it still would not tell a caller how the resulting file is oriented, which is what I was actually after (see below).
内容来源: mrousavy/react-native-vision-camera