MediaRecorderConfiguration
用于配置音视频流的录制参数。
C++
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;
};
自从
自 v3.5.2 版本新增。
storagePath
信息
请确保指定路径存在且可写。
- 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
录制文件的格式。详见 MediaRecorderContainerFormat。
streamType
录制的内容类型。详见 MediaRecorderStreamType。
maxDurationMs
最大录制时长,单位为毫秒。默认值为 120000。
recorderInfoUpdateInterval
录制信息更新的时间间隔,单位为毫秒。有效范围为 [1000, 10000]。SDK 会根据该值触发 onRecorderInfoUpdated 回调以报告录制信息更新。
width
录制视频的宽度(像素)。宽度 × 高度的最大值不能超过 3840 × 2160。仅当调用 createMediaRecorder 且在 RecorderStreamInfo 中将
type 设置为 PREVIEW 时需要设置该参数。height
录制视频的高度(像素)。宽度 × 高度的最大值不能超过 3840 × 2160。仅当调用 createMediaRecorder 且在 RecorderStreamInfo 中将
type 设置为 PREVIEW 时需要设置该参数。fps
录制视频的帧率。最大值为 30,例如:5、10、15、24、30。仅当调用 createMediaRecorder 且在 RecorderStreamInfo 中将
type 设置为 PREVIEW 时需要设置该参数。sample_rate
录制音频的采样率(Hz)。支持的值包括:16000、32000、44100 或 48000。仅当调用 createMediaRecorder 且在 RecorderStreamInfo 中将
type 设置为 PREVIEW 时需要设置该参数。channel_num
录制音频的声道数:
- 1:单声道。
- 2:立体声。
type 设置为 PREVIEW 时需要设置该参数。videoSourceType
录制的视频源类型。详见 VIDEO_SOURCE_TYPE。仅当调用 createMediaRecorder 且在 RecorderStreamInfo 中将
type 设置为 PREVIEW 时需要设置该参数。