-
Notifications
You must be signed in to change notification settings - Fork 550
Description
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];
}
}