pushExternalAudioFrame method
@detail api
@author huangshouqin
@brief Push custom captured audio data to the RTC SDK.
@param audioFrame Audio data frame. 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 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details.
@note
- Before pushing external audio data, you must call setAudioSourceType:{@link #ByteRTCEngine#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(ByteRTCAudioFrame audioFrame) async {
return await nativeCall('pushExternalAudioFrame:', [audioFrame]);
}