Agora Java API Reference for Android
Public Member Functions | Public Attributes | List of all members
io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration Class Reference

Audio and video stream recording configuration. More...

Public Member Functions

 MediaRecorderConfiguration (String storagePath, int containerFormat, int streamType, int maxDurationMs, int recorderInfoUpdateInterval)
 
 MediaRecorderConfiguration (String storagePath, int containerFormat, int streamType, int maxDurationMs, int recorderInfoUpdateInterval, int width, int height, int fps, int sample_rate, int channel_num, int videoSourceType)
 

Public Attributes

String storagePath
 
int containerFormat = CONTAINER_MP4
 
int streamType = STREAM_TYPE_BOTH
 
int maxDurationMs = 120000
 
int recorderInfoUpdateInterval = 0
 
int width
 
int height
 
int fps
 
int sample_rate
 
int channel_num
 
int videoSourceType
 

Detailed Description

Audio and video stream recording configuration.

Since
v3.5.2

Member Data Documentation

◆ storagePath

String io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.storagePath

The absolute path where the recording file is saved locally. The path must include the file name and extension. For example:

  • Android: /storage/emulated/0/Android/data/<package name>/files/example.mp4
    Note
    Make sure the specified path exists and is writable.

◆ containerFormat

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.containerFormat = CONTAINER_MP4

The format of the recording file. Currently, only CONTAINER_MP4 is supported.

◆ streamType

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.streamType = STREAM_TYPE_BOTH

Recording content:

  • STREAM_TYPE_AUDIO: Audio only.
  • STREAM_TYPE_VIDEO: Video only.
  • STREAM_TYPE_BOTH: (Default) Both audio and video.

◆ maxDurationMs

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.maxDurationMs = 120000

Maximum recording duration in milliseconds. The default value is 120000.

◆ recorderInfoUpdateInterval

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.recorderInfoUpdateInterval = 0

Interval for updating recording information, in milliseconds. The valid range is [1000, 10000]. The SDK triggers the onRecorderInfoUpdated callback based on this value to report the updated recording information.

◆ width

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.width

Width (px) of the recorded video. The maximum value of width × height must not exceed 3840 × 2160. This parameter is required only when you call createMediaRecorder and set the recorderStreamType of RecorderStreamInfo to 0.

◆ height

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.height

Height (px) of the recorded video. The maximum value of width × height must not exceed 3840 × 2160. This parameter is required only when you call createMediaRecorder and set the recorderStreamType of RecorderStreamInfo to 1.

◆ fps

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.fps

Frame rate for recording video. The maximum value must not exceed 30, such as: 5, 10, 15, 24, 30, etc. You only need to pass this parameter when calling createMediaRecorder and setting the recorderStreamType of RecorderStreamInfo to 1.

◆ sample_rate

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.sample_rate

Sampling rate (Hz) for recording audio. You can set it to 16000, 32000, 44100, or 48000. This parameter is required only when you call createMediaRecorder and set the recorderStreamType of RecorderStreamInfo to 1.

◆ channel_num

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.channel_num

Number of channels for audio capturing:

  • 1: Mono
  • 2: Stereo This parameter is required only when you call createMediaRecorder and set the recorderStreamType in RecorderStreamInfo to 1.

◆ videoSourceType

int io.agora.rtc2.AgoraMediaRecorder.MediaRecorderConfiguration.videoSourceType

The type of the video source for recording. See VideoSourceType. You only need to specify this parameter when calling createMediaRecorder and setting the recorderStreamType of RecorderStreamInfo to 1.