# startAudioRecording method Null safety

Future<int?> startAudioRecording(

1. TRTCAudioRecordingParams param

)

Start audio recording

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

## Implementation

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