public class AgoraMediaRecorder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AgoraMediaRecorder.MediaRecorderConfiguration
Configurations for the local audio and video recording.
|
Modifier and Type | Field and Description |
---|---|
static int |
CONTAINER_MP4
1: MP4 format.
|
static int |
RECORDER_REASON_CONFIG_CHANGED
4: The recording configuration changes.
|
static int |
RECORDER_REASON_NO_STREAM
2: 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 int |
RECORDER_REASON_NONE
0: No error occurs.
|
static int |
RECORDER_REASON_OVER_MAX_DURATION
3: The recording duration exceeds the upper limit.
|
static int |
RECORDER_REASON_WRITE_FAILED
1: The SDK fails to write the recorded data to a file.
|
static int |
RECORDER_STATE_ERROR
-1: An error occurs during the recording.
|
static int |
RECORDER_STATE_START
2: The audio and video recording is started.
|
static int |
RECORDER_STATE_STOP
3: The audio and video recording is stopped.
|
static int |
STREAM_TYPE_AUDIO
1: Record audio only.
|
static int |
STREAM_TYPE_BOTH
3: Record both audio and video.
|
static int |
STREAM_TYPE_VIDEO
2: Record video only.
|
Constructor and Description |
---|
AgoraMediaRecorder(io.agora.rtc2.internal.RtcEngineImpl engine,
RecorderStreamInfo info) |
Modifier and Type | Method and Description |
---|---|
void |
release() |
int |
setMediaRecorderObserver(IMediaRecorderCallback callback)
Registers the IMediaRecorderCallback object.
|
int |
startRecording(AgoraMediaRecorder.MediaRecorderConfiguration config)
Starts recording the local or remote audio and video.
|
int |
stopRecording()
Stops recording the audio and video.
|
public static final int RECORDER_STATE_ERROR
public static final int RECORDER_STATE_START
public static final int RECORDER_STATE_STOP
public static final int RECORDER_REASON_NONE
public static final int RECORDER_REASON_WRITE_FAILED
public static final int RECORDER_REASON_NO_STREAM
public static final int RECORDER_REASON_OVER_MAX_DURATION
public static final int RECORDER_REASON_CONFIG_CHANGED
public static final int STREAM_TYPE_AUDIO
public static final int STREAM_TYPE_VIDEO
public static final int STREAM_TYPE_BOTH
public static final int CONTAINER_MP4
public AgoraMediaRecorder(io.agora.rtc2.internal.RtcEngineImpl engine, RecorderStreamInfo info)
public int setMediaRecorderObserver(IMediaRecorderCallback callback)
callback
- The callbacks for recording audio and video streams. See IMediaRecorderCallback
.public int startRecording(AgoraMediaRecorder.MediaRecorderConfiguration config)
createMediaRecorder
to get the media recorder object, you can call this method to
enable the recording of the local audio and video.
This method can record the following content:
- The audio captured by the local microphone and encoded in AAC format.
- The video captured by the local camera and encoded by the SDK.
This method can record the following content:
- The audio received from remote users and encoded in AAC format.
- The video received from remote users.
The SDK can generate a recording file only when it detects the recordable audio and video
streams; when there are no audio and video streams to be recorded or the audio and video
streams are interrupted for more than five seconds, the SDK stops recording and triggers the
onRecorderStateChanged(RECORDER_STATE_ERROR, RECORDER_ERROR_NO_STREAM)
callback.config
- The recording configurations. See MediaRecorderConfiguration
.IMediaRecorderCallback
object is
registered.public int stopRecording()
getMediaRecorder
before
calling `startRecording`.public void release()