Skip to content

Commit

Permalink
#4090 - Activating the shared AVAudioSession before recording or play…
Browse files Browse the repository at this point in the history
…back.
  • Loading branch information
stefanceriu committed Jul 19, 2021
1 parent 0ead60f commit 39084b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class VoiceMessageAudioPlayer: NSObject {

do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
try AVAudioSession.sharedInstance().setActive(true)
} catch {
MXLog.error("Could not redirect audio playback to speakers.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class VoiceMessageAudioRecorder: NSObject, AVAudioRecorderDelegate {

do {
try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .default)
try AVAudioSession.sharedInstance().setActive(true)
audioRecorder = try AVAudioRecorder(url: url, settings: settings)
audioRecorder?.delegate = self
audioRecorder?.isMeteringEnabled = true
Expand Down

0 comments on commit 39084b0

Please sign in to comment.