registerAudioProcessor method
@detail api
@author gongzhengduo
@brief Register a custom audio preprocessor.
After that, you can call enableAudioProcessor{@link #RTCEngine#enableAudioProcessor} to process the audio streams that either captured locally or received from the remote side. RTC SDK then encodes or renders the processed data.
@param processor Custom audio processor. See IAudioFrameProcessor{@link #IAudioFrameProcessor}。
SDK only holds weak references to the processor, you should guarantee its Life Time. To cancel registration, set the parameter to nullptr.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- When this interface is repeatedly called, only the last call takes effect.
- Refer to Custom Audio Processing for more information.
Implementation
Future<int?> registerAudioProcessor(IAudioFrameProcessor processor) async {
$a() => ($instance as $p_a.RTCEngine).registerAudioProcessor(
packObject(processor, () => android_IAudioFrameProcessor()));
$i() => ($instance as $p_i.ByteRTCEngine).registerAudioProcessor(
packObject(processor, () => ios_IAudioFrameProcessor()));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}