I am rendering audio from received input as in code:
...
let bufferRenderSyncer = AVSampleBufferRenderSynchronizer()
let bufferRenderer = AVSampleBufferAudioRenderer()
...
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
bufferRenderer.enqueue(sampleBuffer)
if bufferRenderSyncer.rate == 0 {
bufferRenderSyncer.setRate(1, time: sampleBuffer.presentationTimeStamp)
}
}
...
and it works great with or without headset (I speak to mike on iPhone or on headset and hear myself from the related speaker eg on iPhone or headset)
but I need to use mike on headset and the output device to be switchable between headset, speaker or another connected headset (airpods)
I have not find any source saying how to change output device (from default) using bufferRenderer.. any suggestions?