Question

I am currently using an AVAudioPlayer to play looped music in the background of my app. However, when siri is opened in my application it turns it off. I am farly experienced with objective c but I cant seem to get this to work. Is there any way I can tell when a user opens siri so that I can start the AVAudioPlayer again after it stops. Please help! P.S I have attempted continuously playing the audio but then siri wont work.

Was it helpful?

Solution

You can use AVAudioPlayerDelegate's audioPlayerEndInterruption:withOptions:

- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player withOptions:(NSUInteger)flags {
      [player play];
}

OTHER TIPS

For anyone else coming to this, the endInterruption delegate isn't getting called from me when my app gets interrupted by Siri. I had to make the app resume playing when it becomes active again (using a notification).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top