当我的Avcapture会话正在运行并准备录制视频时,我无法播放音频文件、振动或播放任何触觉反馈?我只找到了目标c的解决方案,但找不到斯威夫特。
目标C溶液:Using vibrate and AVCaptureSession at the same time
当我的Avcapture会话正在运行并准备录制视频时,我无法播放音频文件、振动或播放任何触觉反馈?我只找到了目标c的解决方案,但找不到斯威夫特。
目标C溶液:Using vibrate and AVCaptureSession at the same time
3条答案
按热度按时间kuhbmx9i1#
您可以使用iOS13及更高版本中的
setAllowHapticsAndSystemSoundsDuringRecording
。字符串
xytpbqjk2#
只要您在
AVCaptureSession
中使用麦克风,触觉反馈就不会播放。苹果试图防止振动干扰麦克风捕获。这在https://developer.apple.com/documentation/audiotoolbox/1405202-audioservicesplayalertsound中有说明
如果您还没有从麦克风录音(正如您所说,您只是处于“就绪状态”),那么解决方案是延迟添加麦克风,直到您想开始录音。
当然,在录制时,您可能仍然不播放任何触觉反馈。
disho6za3#
session.setAllowHapticsAndSystemSoundsDuringRecording(true)对我来说很好!!
我正在使用AudioQueueServices + CHHapticEngine