MediaRecorderConfiguration

Used to configure recording parameters for audio and video streams.

struct MediaRecorderConfiguration {
  const char* storagePath;
  MediaRecorderContainerFormat containerFormat;
  MediaRecorderStreamType streamType;
  int maxDurationMs;
  int recorderInfoUpdateInterval;
  int width;
  int height;
  int fps;
  int sample_rate;
  int channel_num;
  agora::rtc::VIDEO_SOURCE_TYPE videoSourceType;
};
Since
Added since v3.5.2.

Properties

storagePath
Note: Make sure the specified path exists and is writable.
The absolute path to save the recorded file locally, including the file name and format. For example:
  • Windows: C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.mp4
  • iOS: /App Sandbox/Library/Caches/example.mp4
  • macOS: /Library/Logs/example.mp4
  • Android: /storage/emulated/0/Android/data/<package name>/files/example.mp4
containerFormat
The format of the recorded file. See MediaRecorderContainerFormat.
streamType
The type of content to record. See MediaRecorderStreamType.
maxDurationMs
The maximum recording duration in milliseconds. The default value is 120000.
recorderInfoUpdateInterval
The time interval for updating recording information, in milliseconds. Valid range is [1000, 10000]. The SDK triggers the onRecorderInfoUpdated callback based on this value to report recording information updates.
width
The width of the recorded video (in pixels). The maximum value for width × height must not exceed 3840 × 2160. This parameter is required only when calling createMediaRecorder and setting type to PREVIEW in RecorderStreamInfo.
height
The height of the recorded video (in pixels). The maximum value for width × height must not exceed 3840 × 2160. This parameter is required only when calling createMediaRecorder and setting type to PREVIEW in RecorderStreamInfo.
fps
The frame rate of the recorded video. The maximum value is 30, e.g., 5, 10, 15, 24, 30. This parameter is required only when calling createMediaRecorder and setting type to PREVIEW in RecorderStreamInfo.
sample_rate
The sampling rate (Hz) of the recorded audio. Supported values include: 16000, 32000, 44100, or 48000. This parameter is required only when calling createMediaRecorder and setting type to PREVIEW in RecorderStreamInfo.
channel_num
The number of audio channels:
  • 1: Mono.
  • 2: Stereo.
This parameter is required only when calling createMediaRecorder and setting type to PREVIEW in RecorderStreamInfo.
videoSourceType
The type of video source to record. See VIDEO_SOURCE_TYPE. This parameter is required only when calling createMediaRecorder and setting type to PREVIEW in RecorderStreamInfo.