pushExternalAudioFrame method
@detail api
@brief Push PCM audio frame data for mixing.
@param audioFrame 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.
- A specific sample rate and the number of channels must be specified. Setting them to automatic is not supported.
@return
- 0: Success.
- < 0: Failed.
@note
- Before calling this method, the raw audio data mixing must be enabled through openWithCustomSource{@link #IMediaPlayer#openWithCustomSource}.
- 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(AudioFrame audioFrame) async {
return await nativeCall('pushExternalAudioFrame', [audioFrame]);
}