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