pullExternalAudioFrame method

FutureOr<int> pullExternalAudioFrame(
  1. ByteRTCAudioFrame audioFrame
)

@detail api @author huangshouqin @brief Pull remote audio data. You can use the data for audio processing or custom rendering.
After calling this method, the SDK will actively pull the audio data that is ready to be played, including the decoded and mixed audio data from remote end for external playback. @param audioFrame Audio data frame. See ByteRTCAudioFrame{@link #ByteRTCAudioFrame} @return - 0: Success - < 0: Failure @note - Before pulling custom audio data, you must call setAudioRenderType:{@link #ByteRTCEngine#setAudioRenderType} to enable custom audio capture and rendering. - You should pull audio data every 10 milliseconds since the duration of a RTC SDK audio frame is 10 milliseconds. Samples x call frequency = audioFrame's sample rate. Assume that the sampling rate is set to 48000, call this API every 10 ms, so that 480 sampling points should be pulled each time. - The audio sampling format is S16. The data format in the audio buffer is PCM, and its capacity size is audioFrame.samples × audioFrame.channel × 2.

Implementation

FutureOr<int> pullExternalAudioFrame(ByteRTCAudioFrame audioFrame) async {
  return await nativeCall('pullExternalAudioFrame:', [audioFrame]);
}