pushExternalAudioFrame method

FutureOr<int> pushExternalAudioFrame(
  1. ByteRTCAudioFrame audioFrame
)

@detail api @brief Push PCM audio frame data for mixing. @param audioFrame See ByteRTCAudioFrame{@link #ByteRTCAudioFrame}. - The audio sampling format must be S16. The data format within the audio buffer must be PCM, and its capacity should be audioFrame.samples × audioFrame.channel × 2. - A specific sample rate and the number of channels must be specified; it is not supported to set them to automatic. @return - 0: Success. - < 0: Failed. @note - Before calling this method, the raw audio data mixing must be enabled through openWithCustomSource:config:{@link #ByteRTCMediaPlayer#openWithCustomSource:config}. - Suggestions: Before pushing data for the first time, please cache a certain amount of data (like 200 ms) on the application side, and then push it at once. Schedule subsequent push operation every 10 ms with audio data of 10 ms. - To pause the playback, just pause the push.

Implementation

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