iOS App中断处理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/blackeynes/article/details/79880970
- (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");
    }
}

猜你喜欢

转载自blog.csdn.net/blackeynes/article/details/79880970