setAudioFrameListener method
- TRTCAudioFrameListener? listener
Set custom audio data callback
After this callback is set, the SDK will internally call back the audio data (in PCM format), including:
onCapturedAudioFrame
: callback of the audio data captured by the local mic
Note: Setting the callback to null indicates to stop the custom audio callback, while setting it to a non-null value indicates to start the custom audio callback.
Platform not supported:
- web
- macOS
- Windows
Implementation
Future<void> setAudioFrameListener(TRTCAudioFrameListener? listener) async {
if (_audioFrameListener == null) {
_audioFrameListener = TRTCAudioFrameListenerPlatformMethod(_cloudChannel!.name);
}
_audioFrameListener!.setAudioFrameListener(listener);
return _cloudChannel!.invokeMethod(
'setAudioFrameListener', {'isNullListener': listener == null});
}