Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioSessionGetProperty 已被废弃,ios14以上每次打电话结束都会崩溃 #176

Open
dosedo opened this issue Aug 12, 2024 · 0 comments

Comments

@dosedo
Copy link

dosedo commented Aug 12, 2024

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];
    }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant