I am using AVAudioPlayer to play music (background support). My question is: if I want to call someone while I listen to music, how can I resume it after a conversation? I implement the AVAudioPlayer delegation method:
- (void)audioPlayerEndInterruption:(AVAudioPlayer *)thePlayer { [[AVAudioSession sharedInstance] setActive:YES error:nil]; [self.player play]; }
but this will not allow the music to continue.
I also tried using the AVAudioSessionDelegate method (just try):
- (void)viewDidLoad { [[AVAudioSession sharedInstance] setDelegate:self]; } - (void)endInterruption { [[AVAudioSession sharedInstance] setActive:YES error:nil]; [self.player play]; }
but again, this will not lead to the resumption of music. Any ideas on how to solve this problem?
Chilly zhong
source share