iOS AVAudioSession interruption notification not working as expected

前端 未结 3 1969
感动是毒
感动是毒 2020-12-17 09:58

I want to know when my AVAudioRecorder is inaccessible (e.g when music starts playing).

As audioRecorderEndInterruption will be deprecated

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-17 10:09

    I try this and find InterruptionTypeEnded may called after music pause in some app, but other not called when pause.

    My solution is update the UI to let user know record has stopped and do some related work such as file operation. When interruption ends, active AVAudioSession, if doesn't have error, start a new record.

    If you want to join the file before and after interrupt, the answer to this question: AVAudioRecorder records only the audio after interruption may be helpful to you.

提交回复
热议问题