AgoraIO / API-Examples

Play with AgoraSDK and have fun! Everything you need to start learning Agora.
296 stars 218 forks source link

Audio Issue on iPhone 14 with Agora SDK #342

Closed adeelabbas closed 1 year ago

adeelabbas commented 1 year ago

We are experiencing an audio issue on iPhone 14 when using Agora SDK with custom audio recording using AVCaptureSession and AVAssetWriter. There is no problem on iPhone 13 and older devices. Also interesting to note is that when an iPhone 14 device is the only device in the call, no error happens. The error happens when there is another device in the call sending audio to iPhone 14. We think that the problem happens when iPhone 14 speakerphone is open and at the same time as microphone from another AVCaptureSession is trying to capture samples.

Here is a link to a sample app and detailed steps to reproduce issue.

plutoless commented 1 year ago

@adeelabbas we will take a look into your demo. have you changed anything or you are using the original demo?

adeelabbas commented 1 year ago

I added code to use AVAssetWriter and AVAudioSession to write a local audio file

plutoless commented 1 year ago

i would suggest you to stick to agora audio capture, and use onRecordedAudioFrame callback to process the audio recording file writing. If you are starting your own AVAudioSession, it would be easy to conflict with agora sdk.

adeelabbas commented 1 year ago

Do you folks have a sample app that we can use to record local audio file using onRecordedAudioFrame callbacks?

plutoless commented 1 year ago

@adeelabbas if you only need to record local mic, you can refer to this demo https://github.com/AgoraIO/API-Examples/blob/main/iOS/APIExample/APIExample/Examples/Advanced/RawMediaData/RawMediaData.swift

if you want to record all audios in the channel, you may look into this to learn to how process raw audio data. https://github.com/AgoraIO/API-Examples/blob/main/iOS/APIExample/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift