onCapturedAudioFrame property

(void Function(TRTCAudioFrame audioFrame)?) onCapturedAudioFrame
final

Callback for audio data collected locally and pre-processed by the audio module

After the user has set up the audio data customization callback, the SDK will internally callback the newly captured and pre-processed (ANS, AEC, AGC) data to the user in PCM format via this interface.

  • This interface calls back the audio with a fixed time frame length of 0.02s in PCM format.
  • The formula for converting time frame length to byte frame length is sample rate × time frame length × number of channels × sample point bit width.
  • Using TRTC's default audio recording format of 48000 sample rate, mono, and 16 bit width, the byte frame length is 48000 × 0.02s × 1 × 16bit = 15360bit = 1920 bytes.

Implementation

final void Function(TRTCAudioFrame audioFrame)? onCapturedAudioFrame;