Handling iPhone Interruption in a Music Application

I tried the code to avoid interruption of the standby mode. It works, but now I have a problem with interruptions when a call or SMS arrives on the iPhone. The song in my music app was terminated at that time. I want to automatically resume a song when it was stopped after the call ended.

- (void) audioPlayerBeginInterruption: (AVAudioPlayer *) player { if (playing) { playing = NO; interruptedOnPlayback = YES; [self updateViewForPlayerState]; } } - (void) audioPlayerEndInterruption: (AVAudioPlayer *) player { if (interruptedOnPlayback) { [player prepareToPlay]; [player play]; playing = YES; interruptedOnPlayback = NO; } } 

But that will not work. Please help me, thanks in advance.

+4
source share
1 answer
0
source

All Articles