Package io.agora.rtc2
Class AgoraMediaRecorder
java.lang.Object
io.agora.rtc2.AgoraMediaRecorder
The `AgoraMediaRecorder` class, for recording the audio and video on the client.
`AgoraMediaRecorder` can record the following content:
- The audio captured by the local microphone and encoded in AAC format by the SDK.
- The video captured by the local camera and encoded by the SDK.
- Since:
- v3.5.2
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int1: MP4 format.static final int4: The recording configuration changes.static final int2: The SDK does not detect audio and video streams to be recorded, or audio and video streams are interrupted for more than five seconds during recording.static final int0: No error occurs.static final int3: The recording duration exceeds the upper limit.static final int1: The SDK fails to write the recorded data to a file.static final int-1: An error occurs during the recording.static final int2: The audio and video recording is started.static final int3: The audio and video recording is stopped.static final int1: Record audio only.static final int3: Record both audio and video.static final int2: Record video only. -
Constructor Summary
ConstructorsConstructorDescriptionAgoraMediaRecorder(io.agora.rtc2.internal.RtcEngineImpl engine, RecorderStreamInfo info) -
Method Summary
-
Field Details
-
RECORDER_STATE_ERROR
public static final int RECORDER_STATE_ERROR-1: An error occurs during the recording. See `error` message for the reason.- See Also:
-
RECORDER_STATE_START
public static final int RECORDER_STATE_START2: The audio and video recording is started.- See Also:
-
RECORDER_STATE_STOP
public static final int RECORDER_STATE_STOP3: The audio and video recording is stopped.- See Also:
-
RECORDER_REASON_NONE
public static final int RECORDER_REASON_NONE0: No error occurs.- See Also:
-
RECORDER_REASON_WRITE_FAILED
public static final int RECORDER_REASON_WRITE_FAILED1: The SDK fails to write the recorded data to a file.- See Also:
-
RECORDER_REASON_NO_STREAM
public static final int RECORDER_REASON_NO_STREAM2: The SDK does not detect audio and video streams to be recorded, or audio and video streams are interrupted for more than five seconds during recording.- See Also:
-
RECORDER_REASON_OVER_MAX_DURATION
public static final int RECORDER_REASON_OVER_MAX_DURATION3: The recording duration exceeds the upper limit.- See Also:
-
RECORDER_REASON_CONFIG_CHANGED
public static final int RECORDER_REASON_CONFIG_CHANGED4: The recording configuration changes.- See Also:
-
STREAM_TYPE_AUDIO
public static final int STREAM_TYPE_AUDIO1: Record audio only.- See Also:
-
STREAM_TYPE_VIDEO
public static final int STREAM_TYPE_VIDEO2: Record video only.- See Also:
-
STREAM_TYPE_BOTH
public static final int STREAM_TYPE_BOTH3: Record both audio and video.- See Also:
-
CONTAINER_MP4
public static final int CONTAINER_MP41: MP4 format.- See Also:
-
-
Constructor Details
-
AgoraMediaRecorder
-
-
Method Details
-
setMediaRecorderObserver
- Parameters:
callback- The callback for audio and video stream recording. See `IMediaRecorderCallback` for details.- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Codes` for details and troubleshooting suggestions.
- Since:
- v4.0.0
-
startRecording
- Parameters:
config- The configuration for audio and video stream recording. See `MediaRecorderConfiguration`.- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Codes` for details and troubleshooting. - -2: Invalid parameter. Make sure that: - The specified file path for saving the recording is correct and writable. - The specified recording file format is correct. - The maximum recording duration is set correctly. - -4: The current state of `RtcEngine` does not support this operation. This may occur if recording is already in progress or if it stopped due to an error. - -7: The method is called before `RtcEngine` is initialized. Make sure you have created the `AgoraMediaRecorder` object before calling this method.
-
stopRecording
public int stopRecording()- Returns:
- - 0: The method call succeeds. - < 0: The method call fails: - -7: The method is called before the `RtcEngine` is initialized. Make sure that the `Recorder` object has been created before calling this method.
-
release
public void release()
-