接打系统电话导致会议音频中断
在会议中接打系统电话,系统电话结束后返回会议,此时别人听不到自己说话或自己听不到别人说话
问题原因
iOS系统电话会强制中断小鱼音频单元,导致音频模块接收发送异常
解决方法
监听SDK提供的- (void)nemoSDKDidAudioInterrupt:(BOOL)began;接口,如果会议中音频被其他软件中断,会触发此回调,中断开始回调一次,中断结束回调一次,在收到中断结束时,重新调用开启音频的接口 “startAudio” 即可恢复音频。
如果您使用的SDK版本低于2.29.5,那么可能- (void)nemoSDKDidAudioInterrupt:(BOOL)began; 接口不能准确响应,您可以在上层自行监听音频中断通知,根据您的需求完成对应的业务逻辑,示例代码如下:
//添加AVAudioSession中断通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceivedInterruptionNotification:)
name:AVAudioSessionInterruptionNotification
object:nil];
- (void)didReceivedInterruptionNotification:(NSNotification*)notification {
//如果不在会议中,不用处理
if (![[NemoSDK sharedInstance] isInMeeting]) {
return;
}
NSInteger interrputionType = [notification.userInfo[AVAudioSessionInterruptionTypeKey] integerValue];
if (AVAudioSessionInterruptionTypeBegan == interrputionType) {
//会议音频被中断状态---开始,此处音频已经被中断,无需再调用“stopAudio”
}
if (AVAudioSessionInterruptionTypeEnded == interrputionType) {
//会议音频被中断状态---结束,调用“startAudio”恢复音频
}
}