AVAudioSession errorcode : AVAudioSessionErrorCodeCannotInterruptOthers

Background

When I receive the InterruptionBegan notification (the interruption type is AVAudioSessionInterruptionTypeBegan) , I pause playing music.

When I receive the InterruptionEnded notification (the interruption type is AVAudioSessionInterruptionTypeEnded), I resume playing music.

however, sometimes i has got the error code: AVAudioSessionErrorCodeCannotInterruptOthers (560557684)

Some Solutions

I searched stackoverflow, there's some similar questions, and some solutions here are not very satisfying as :

  • I don't want my app to mix with others, and once again, it all works most of the time.
  • My app already uses remote control events so this doesn't solve anything.

Questions

1.Have someone ever encountered this problem ?

2.Can we solve this problem and how ?

3.In addition, I noticed that there's property named otherAudioPlaying in AVAudioSession, we can know there's another app is playing,the quetion is if we can know which app is playing ?

AVAudioSession errorcode : AVAudioSessionErrorCodeCannotInterruptOthers
 
 
Q