Mixing ScreenCaptureKit audio with microphone audio

Hi,

I'm new to AVAudioEngine(and macOS programming in general).

I'm trying to mix microphone audio with ScreenCaptureKit audio using AVAudioEngine without playing it back. I've created a AVAudioPlayerNode and scheduling buffers in my SCStream handler:

                playerNode.scheduleBuffer(samples)

and have connected the playerNode to the mainMixerNode.

        audioEngine.connect(audioEngine.inputNode, to: audioEngine.mainMixerNode, format: micFormat)
        audioEngine.connect(playerNode, to: audioEngine.mainMixerNode, format: format)

The problem is that mainMixerNode plays the audio to the speaker creating a feedback loop. How can I prevent the mixer output from being played back.

Also: Is this the best way of mixing microphone input with some other input? I ran into AVAudioEngine's manual rendering mode, which seems like the way to go for mixing audio without playing it back. However, I couldn't figure out how to connect microphone input to the AVAudioEngine in manual rendering mode?