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 41fc4d755a
commit 95f9c5b3cb
@@ -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 {