iOS App中斷處理
阿新 • • 發佈:2018-11-06
- (void)handleInterruption:(NSNotification *)noti
{
AVAudioSessionInterruptionType type = [noti.userInfo[AVAudioSessionInterruptionTypeKey] intValue];
if (AVAudioSessionInterruptionTypeBegan == type) {
_appIsInterrupt = YES;
[_livePush pausePush];
NSLog(@"AVAudioSessionInterruptionTypeBegan ");
}
if (AVAudioSessionInterruptionTypeEnded == type) {
_appIsInterrupt = NO;
if (!_appIsBackground && !_appIsInActive && !_appIsInterrupt) {
[_livePush resumePush];
}
NSLog(@"AVAudioSessionInterruptionTypeEnded");
}
}