0

I want to create UX like iOS14 video camera. It have vibration when record button is tapped.

I know the way to vibrate short time using UINotificationFeedbackGenerator()

Swift : Make a very short vibration

But it is not worked if captureSession have audio input.

How can I play a haptic feedback while AvCapture Session is running?

This code is worked but it have blackout phase when it working. So not good enough.

UIImpactFeedbackGenerator Not Working When Audio Device Added to AVCaptureSession

self.session.stopRunning()
    // Play haptic
    UINotificationFeedbackGenerator().notificationOccurred(.warning)
    // Not completely sure if this delay is needed but you might need to wait until the run loop after the haptic plays to resume capture session
    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
        self.session.startRunning()
}

It is really helpful if let me know how to work Haptic Feedback on AVcaptureSession.

  • You already shared the answer, yes? https://stackoverflow.com/a/57743674/3231194 – Glenn Posadas Oct 23 '20 at 08:15
  • 1
    Thanks! But no.. I understood as AVCaptureSession prevent haptic feedback. And if microphone is not recording haptic will work. But microphone is automatically woking if I add AudioInput on AVCaptureSession. And it will be blackout if I remove AudioInput from AVCaptureSession. I don't know how to stop microphone recording on AVCaptureSession without blackout.. – Gaku Morita Oct 25 '20 at 03:51

0 Answers0