我创建了一个使用 AVFoundation captureStillImageAsynchronouslyFromConnection 的应用程序,每隔0.2秒拍一张照片并分析照片 . 但是,我没有意识到它每次拍照都会产生快门声,直到我已经构建了应用程序 .
AVFoundation
captureStillImageAsynchronouslyFromConnection
Question: 是否有一个很好的替代品 AVFoundation captureStillImageAsynchronouslyFromConnection 没有发出快门声或是否有合法的方法来关闭声音?
拍照的替代解决方案是 AVCapturePhotoCaptureDelegate 方法 capturePhoto(with:delegate:) . 查看documentation了解 AVCapturePhotoOutput .
AVCapturePhotoCaptureDelegate
capturePhoto(with:delegate:)
AVCapturePhotoOutput
但正如我从你的问题中看到的那样,你想在拍照时将快门速度静音 . 根据Apple文档API,拍照时无法将快门声静音 . 除非用户关闭静音硬件按钮 .
作为解决方法,您可以使用 AVCaptureVideoDataOutputSampleBufferDelegate 开始分析连续视频的相机帧 . 以下是来自apple for How to capture video frames from the camera as images using AV Foundation on iOS的详细文档 . 使用此方法,您仍然可以获取图像并避免快门声音 .
AVCaptureVideoDataOutputSampleBufferDelegate
1 回答
拍照的替代解决方案是
AVCapturePhotoCaptureDelegate
方法capturePhoto(with:delegate:)
. 查看documentation了解AVCapturePhotoOutput
.但正如我从你的问题中看到的那样,你想在拍照时将快门速度静音 . 根据Apple文档API,拍照时无法将快门声静音 . 除非用户关闭静音硬件按钮 .
作为解决方法,您可以使用
AVCaptureVideoDataOutputSampleBufferDelegate
开始分析连续视频的相机帧 . 以下是来自apple for How to capture video frames from the camera as images using AV Foundation on iOS的详细文档 . 使用此方法,您仍然可以获取图像并避免快门声音 .