AVAssetWriter not working with videoChat mode of AVAudioSession (iPhone 14 Pro only)

I have a video conferencing app and we are setting up AVAudioSession to videoChat so that we can get echo cancellation.

let options: AVAudioSession.CategoryOptions = [.mixWithOthers , .defaultToSpeaker, .allowBluetooth]
try session.setCategory(.playAndRecord, mode: .videoChat, options: options)

I also want to do local recording of audio samples using AVAssetWriter API. Setup of AssertWriter is as follows:

let audioAssetWriter = try AVAssetWriter(outputURL: fileURL, fileType: .m4a)
     
let settings: [String: Any] = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: Int(audioParameters.samplingRate),
AVEncoderBitRateKey: Int(audioParameters.bitrate),
AVNumberOfChannelsKey: Int(audioParameters.channels),
AVEncoderAudioQualityKey: AVAudioQuality.max.rawValue
]
       
let assetWriterAudioInput = AVAssetWriterInput(mediaType: .audio, outputSettings: settings)
assetWriterAudioInput.expectsMediaDataInRealTime = true
audioAssetWriter.add(assetWriterAudioInput)

I am seeing that on the iPhone 14 Pro,

assetWriterAudioInput.append()

is failing. Everything works fine on iPhone 13 and older devices.

Is anyone else seeing this issue on the iPhone 14 Pro.

AVAssetWriter not working with videoChat mode of AVAudioSession (iPhone 14 Pro only)
 
 
Q