Introduction

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

The Agora Unity 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.

To start audio recording, call the StartAudioRecording method after joining a channel.

// Starts audio recording.
mRtcEngine.StartAudioRecording(
    // Local path of the recording file specified by the user, including the filename and format. For example: "/sdcard/emulated/0/recording.acc".
    "filePath",
    // Sample rate (Hz) of the recording file.
    32000,
    // Audio quality of the recording: LOW, MEDIUM, and HIGH.
    AUDIO_RECORDING_QUALITY_TYPE.AUDIO_RECORDING_QUALITY_HIGH 
);

// Stops audio recording.
mRtcEngine.StopAudioRecording();

API reference

Considerations

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