startAudioRecording method

Future<int?> startAudioRecording(
  1. TRTCAudioRecordingParams param
)

Starts audio recording, mixing and recording all current audio into one file.

After this API is called, the SDK will record all audios (such as local audio, remote audio, and background music) in the current call to a file. No matter whether room entry is performed, this API will take effect once called. If audio recording is still ongoing when exitRoom is called, it will stop automatically.

Parameters:

TRTCAudioRecordingParams Audio recording parameters

Returned value:

0: success; -1: audio recording has been started; -2: failed to create file or directory; -3: the audio format of the specified file extension is not supported; -1001: incorrect parameter

Platform not supported:

  • web

Implementation

Future<int?> startAudioRecording(TRTCAudioRecordingParams param) async {
  return _cloudChannel!.invokeMethod('startAudioRecording', {
    "param": jsonEncode(param),
  });
}