Introduction

You can record the audio of all the users in a call and save it on the client for future replays.

The Agora Native SDK supports recording the audio of all the users in a channel and saves the recording into one file in the following formats:

  • WAV: Large file (lossless compression)
  • AAC: Small file (lossy compression)

Implementation

Before proceeding, ensure that you have implemented basic real-time functions in your project. See Start a Call or Start Live Interactive Streaming for details.

// Start local audio recording. 
#ifdef UNICODE
 CHAR aFilePath[MAX_PATH];
 ::WideCharToMultiByte(CP_UTF8, 0, filePath, -1, aFilePath, MAX_PATH, NULL, NULL);
int nRet = rtcEngine.startAudioRecording(aFilePath, // Valid path to the local recording file.
    AUDIO_RECORDING_QUALITY_TYPE::AUDIO_RECORDING_QUALITY_HIGH // AUDIO_RECORDING_QUALITY_HIGH|MEDIUM|LOW
    );
#else
int nRet = rtcEngine.startAudioRecording(filePath, AUDIO_RECORDING_QUALITY_TYPE::AUDIO_RECORDING_QUALITY_HIGH);
#endif

// Stop audio recording. 
int nRet = rtcEngine.stopAudioRecording();

API reference

Considerations

  • Start the recording after joining a channel.
  • The recording automatically stops if the local user leaves the channel.