• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Interruption handling methods not called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interruption handling methods not called


  • Subject: Interruption handling methods not called
  • From: Xinhang Shao <email@hidden>
  • Date: Thu, 19 Sep 2013 12:17:03 -0700

I am developing an iOS app. Part of it is a metronome that plays an audio file (less than 1 second) repeatedly. It works fine on iOS 5, but sometimes crashes on iOS 6 after an incoming call. The behavior is unpredictable.

I used an AVAudioPlayer to play the beats. To handle interruptions, I tried several ways. One is to use AVAudioSessionInterruptionNotification, one is to implement audioPlayerBeginInterruption in AVAudioPlayerDelegate protocol, and the other is to handle interruption in applicationWillResignActive. The corresponding end-of-interruption methods are also implemented.

In iOS 5, applicationWillResignActive is sufficient to handle the incoming call interruption. However, in iOS 6, applicationWillResignActive (if this is the only interruption handling method) is never called when there's a phone call, and the app crashes afterwards. Then I implemented audioPlayerBeginInterruption. Only less than 10% times it gets called and the app survives. Finally, I used AVAudioSessionInterruptionNotification. This is much better. My app survives about 50% of incoming calls. The app crashes because the interruption handling methods are not called, and whether the methods are called is not predictable. In most times, the begin-interruption methods are not called, and sometimes, only the end-interruption methods are not called (more frequently when the called is declined).

If neither of the selector of AVAudioSessionInterruptionNotification nor audioPlayerBeginInterruption is called, then applicationWillResignActive is never called. Then the AVAudioPlayer is killed and enters an error state that it cannot recover from. Is it true that AVAudioSessionInterruptionNotification's selector and audioPlayerBeginInterruption are only called when the player is playing? Why applicatioinWillResignActive is not called?

This app has other functions that also use AVAudioPlayer to play some music (a few seconds). The app does not crash when other functions are being used and there's a phone call (no matter it's playing or not at that moment). I don't know why the metronome crashes (interruption methods are not called), and how to fix this.

Any help would be appreciated. Thank you.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: Re: HAL IO thread priority and glitching
  • Next by Date: audio problems in iOS7
  • Previous by thread: Re: HAL IO thread priority and glitching
  • Next by thread: audio problems in iOS7
  • Index(es):
    • Date
    • Thread