【问题标题】:Alternative to AVFoundation captureStillImageAsynchronouslyFromConnection替代 AVFoundation captureStillImageAsynchronouslyFromConnection
【发布时间】:2016-12-28 23:41:35
【问题描述】:

我创建了一个应用程序,它使用AVFoundationcaptureStillImageAsynchronouslyFromConnection 每 0.2 秒拍照并分析图片。但是,直到我已经构建了应用程序,我才意识到它每次拍照时都会发出快门声。

问题:除了不发出快门声的AVFoundation captureStillImageAsynchronouslyFromConnection 之外,有没有好的替代方法,或者是否有合法的方法可以关闭声音?

【问题讨论】:

    标签: ios swift camera avfoundation


    【解决方案1】:

    拍照的替代解决方案是AVCapturePhotoCaptureDelegate 方法capturePhoto(with:delegate:)。查看documentation 以获取AVCapturePhotoOutput

    但是从您的问题中我可以看出,您想在拍照时将快门速度静音。根据苹果文档 API,您无法在拍照时静音快门声音。直到用户关闭静音硬件按钮。

    作为一种解决方法,您可以使用AVCaptureVideoDataOutputSampleBufferDelegate 开始分析连续视频的相机帧。这是来自苹果的How to capture video frames from the camera as images using AV Foundation on iOS 的详细文档。使用这种方法,您仍然可以获得图像并避免快门声。

    【讨论】:

      猜你喜欢
      • 2011-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多