react-native-vision-camera/ios/Extensions/AVAudioSession+trySetAllowHaptics.swift

24 lines
562 B
Swift
Raw Normal View History

//
// AVAudioSession+trySetAllowHaptics.swift
// VisionCamera
//
// Created by Marc Rousavy on 26.03.21.
// Copyright © 2021 mrousavy. All rights reserved.
//
import AVFoundation
2021-03-26 09:28:08 -06:00
import Foundation
extension AVAudioSession {
/**
Tries to set allowHapticsAndSystemSoundsDuringRecording and ignore errors.
*/
func trySetAllowHaptics(_ allowHaptics: Bool) {
if #available(iOS 13.0, *) {
if !self.allowHapticsAndSystemSoundsDuringRecording {
2021-03-26 09:28:08 -06:00
try? self.setAllowHapticsAndSystemSoundsDuringRecording(allowHaptics)
}
}
}
}