Open dosedo opened 2 months ago
AudioSessionGetProperty 已被废弃,ios14以上每次打电话结束都会崩溃
崩溃的原因就是取不到 interruptionType的值
(void)_handleAudioSessionInterruptionWithState:(UInt32)state { if (state == kAudioSessionBeginInterruption) { [_renderer setInterrupted:YES]; [_renderer stop]; [self _sendEvent:event_interruption_begin]; } else if (state == kAudioSessionEndInterruption) {
AudioSessionInterruptionType interruptionType = kAudioSessionInterruptionType_ShouldNotResume; UInt32 interruptionTypeSize = sizeof(interruptionType); OSStatus status; status = AudioSessionGetProperty(kAudioSessionProperty_InterruptionType, &interruptionTypeSize, &interruptionType); NSAssert(status == noErr, @"failed to get interruption type");
[self _sendEvent:event_interruption_end userData:(void *)(uintptr_t)interruptionType]; } }
AudioSessionGetProperty 已被废弃,ios14以上每次打电话结束都会崩溃
崩溃的原因就是取不到 interruptionType的值
(void)_handleAudioSessionInterruptionWithState:(UInt32)state { if (state == kAudioSessionBeginInterruption) { [_renderer setInterrupted:YES]; [_renderer stop]; [self _sendEvent:event_interruption_begin]; } else if (state == kAudioSessionEndInterruption) {
pragma clang diagnostic push
pragma clang diagnostic ignored "-Wdeprecated"
AudioSessionInterruptionType interruptionType = kAudioSessionInterruptionType_ShouldNotResume; UInt32 interruptionTypeSize = sizeof(interruptionType); OSStatus status; status = AudioSessionGetProperty(kAudioSessionProperty_InterruptionType, &interruptionTypeSize, &interruptionType); NSAssert(status == noErr, @"failed to get interruption type");
pragma clang diagnostic pop
[self _sendEvent:event_interruption_end userData:(void *)(uintptr_t)interruptionType]; } }