setAudioFrameListener method

Future<void> setAudioFrameListener(
  1. 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


Future<void> setAudioFrameListener(TRTCAudioFrameListener? listener) async {
  if (_audioFrameListener == null) {
    _audioFrameListener = TRTCAudioFrameListenerPlatformMethod(_cloudChannel!.name);
  return _cloudChannel!.invokeMethod(
      'setAudioFrameListener', {'isNullListener': listener == null});