#StackBounty: #swift #agora.io Mixing Audio without ducking audio

Bounty: 50

I’m trying to mix audio sources such that there is no audio ducking. I’m using Agora, and the use case I’m trying to solve is having an audio call ongoing in the background while also playing music and/or listening to app audio, without any audio ducking. Audio ducking is when the audio is lowered and distorted slightly to help with the listening of another audio session. Can I have unducked audio and audio mixing with Agora (or iOS for that matter)?

I have tried the following code after beginning an Agora audio session. I have also tried wrapping it in a DispatchQueue.main.async closure, but still no luck.


// I have also tried this code with this block uncommented
// do {
//     try audioSession.setActive(false, options: .notifyOthersOnDeactivation)
//
// } catch let activationError {
//     print(activationError)
//     print(activationError.localizedDescription)
// }


let audioSession = AVAudioSession.sharedInstance()
do {
    try audioSession.setCategory(
        AVAudioSession.Category.playAndRecord,
        mode: AVAudioSession.Mode.voiceChat,
        options: [.allowBluetoothA2DP, .allowBluetooth, .mixWithOthers, .allowAirPlay]
    )
} catch let setCategoryError {
    print(setCategoryError)
    print(setCategoryError.localizedDescription)
}

do {
    try audioSession.setActive(true, options: .notifyOthersOnDeactivation)

} catch let activationError {
    print(activationError)
    print(activationError.localizedDescription)
}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.