我们正在设置focusPointOfInterest,但就在AVCaptureOutput停止后,尽管在iPhone屏幕上,我们仍然可以看到实时的摄像头馈送。
我们找不到原因,也找不到解决的办法。
顺便说一下,我们正在使用SwiftUI。
发布于 2022-08-02 21:23:11
您是否锁定/解锁您的设备以进行配置?像这样的东西通常对我有用:
func setFocusPointOfInterest(device: AVCaptureDevice, focusPoint: CGPoint) throws {
if !device.isFocusPointOfInterestSupported ||
!device.isFocusModeSupported(.autoFocus) ||
device.isAdjustingFocus ||
device.isAdjustingExposure {
return
}
try device.lockForConfiguration()
device.focusPointOfInterest = focusPoint
device.focusMode = .autoFocus
device.unlockForConfiguration()
}https://stackoverflow.com/questions/73205655
复制相似问题