Properly end the active AVAudioSession when recording finishes.

This commit is contained in:
Robin Kipp 2022-06-24 18:30:24 +02:00 committed by Stefan Ceriu
parent 730eafcefe
commit 96b3c093b2

View file

@ -75,6 +75,13 @@ class VoiceMessageAudioRecorder: NSObject, AVAudioRecorderDelegate {
func stopRecording() {
audioRecorder?.stop()
do {
try AVAudioSession.sharedInstance().setActive(false)
} catch {
delegateContainer.notifyDelegatesWithBlock { delegate in
(delegate as? VoiceMessageAudioRecorderDelegate)?.audioRecorder(self, didFailWithError: VoiceMessageAudioRecorderError.genericError) }
}
}
func peakPowerForChannelNumber(_ channelNumber: Int) -> Float {