首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置focusPointOfInterest后,AVCaptureOutput停止如何启动?

设置focusPointOfInterest后,AVCaptureOutput停止如何启动?
EN

Stack Overflow用户
提问于 2022-08-02 10:04:30
回答 1查看 29关注 0票数 0

我们正在设置focusPointOfInterest,但就在AVCaptureOutput停止后,尽管在iPhone屏幕上,我们仍然可以看到实时的摄像头馈送。

我们找不到原因,也找不到解决的办法。

顺便说一下,我们正在使用SwiftUI。

EN

回答 1

Stack Overflow用户

发布于 2022-08-02 21:23:11

您是否锁定/解锁您的设备以进行配置?像这样的东西通常对我有用:

代码语言:javascript
复制
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()
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73205655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档