Audio recording stops when sound in other app is playing

0 votes
asked Sep 12, 2017 by rushabh

We have functionality for background recording in app. It is working fine when app in background mode but it is stop when we open other app and play sound in it.How can we continue recording even without stop recording when other app play sound.

Note: When Recording start at that time out app in background mode.

1 Answer

+1 vote
answered Sep 12, 2017 by ashokpolu

Call this method in appDelegate,

func audioSessionSettings() {
        do {
            try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryRecord, with: AVAudioSessionCategoryOptions.mixWithOthers)
            try AVAudioSession.sharedInstance().setActive(true)
        } catch let error {
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter