I am adding sound when user clicks on call button/joinChanne(Agora) in my app.
[self.agoraKit joinChannelByToken:self.userManager.agoraToken channelId:self.userManager.channelName info:nil uid:[self.userManager.UID integerValue] joinSuccess:^(NSString *channel, NSUInteger uid, NSInteger elapsed) {
NSString *path = [[NSBundle mainBundle] pathForResource:@"ringing-sound-jalebi" ofType:@"mp3"];
NSURL *soundFileURL = [NSURL fileURLWithPath:path];
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
self.audioPlayer.delegate = self;
[self.audioPlayer play];
}];
But I am getting "AVAudioSession.mm:997:-[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session" error. Can someone please help me to solve this