pushExternalAudioFrame method
@detail api
@author gongzhengduo
@brief Push custom captured audio data to the RTC SDK.
@param audioFrame Audio data frame. See AudioFrame{@link #AudioFrame}
- The audio sampling format must be S16. The data format within the audio buffer must be PCM, and its capacity size should be audioFrame.samples × audioFrame.channel × 2.
- Specific sample rates and the number of channels must be designated; automatic settings are not supported.
@return
- 0: Success.
- < 0: Failure. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- Before pushing external audio data, you must call setAudioSourceType{@link #RTCEngine#setAudioSourceType} to enable custom audio capture.
- You must push custom captured audio data every 10 milliseconds. The samples (number of audio sampling points) of a single push should be audioFrame.sample Rate/100. For example, when the sampling rate is set to 48000, data of 480 sampling points should be pushed each time.
Implementation
FutureOr<int> pushExternalAudioFrame(AudioFrame audioFrame) async {
return await nativeCall('pushExternalAudioFrame', [audioFrame]);
}