views:

12

answers:

0

Hi to all, i have tried the coding for interruption handling when i get a phone call on my iphone.

- (void) audioPlayerBeginInterruption: (AVAudioPlayer *) player {    
    if (playing) {

        playing = NO;

        interruptedOnPlayback = YES;

        [self updateUserInterface];    
    }   
}   

- (void) audioPlayerEndInterruption: (AVAudioPlayer *) player {

    if (interruptedOnPlayback) {

        [player prepareToPlay];

        [player play];

        playing = YES;

        interruptedOnPlayback = NO;    
    }    
}

when the call is came my iphone the song stops but the problem is that when i ignore or receive a call after that the song does not play automatically.i have to click the play button to play the song.Please help me in solving this problem so that the song should continue to play automatically from where it has stopped after i decline or accept a call