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_ERROR_CONFIG_CHANGED
4: The recording configuration changes.
|
static int |
RECORDER_ERROR_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_ERROR_NONE
0: No error occurs.
|
static int |
RECORDER_ERROR_OVER_MAX_DURATION
3: The recording duration exceeds the upper limit.
|
static int |
RECORDER_ERROR_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.
|
Modifier and Type | Method and Description |
---|---|
static AgoraMediaRecorder |
getMediaRecorder(RtcEngine engine)
Gets the `AgoraMediaRecorder` object.
|
void |
release()
Releases the `AgoraMediaRecorder` object.
|
int |
setMediaRecorderObserver(RtcConnection connection,
IMediaRecorderCallback callback) |
int |
startRecording(RtcConnection connection,
AgoraMediaRecorder.MediaRecorderConfiguration config)
Starts recording the local audio and video.
|
int |
stopRecording(RtcConnection connection)
Stops recording the local 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_ERROR_NONE
public static final int RECORDER_ERROR_WRITE_FAILED
public static final int RECORDER_ERROR_NO_STREAM
public static final int RECORDER_ERROR_OVER_MAX_DURATION
public static final int RECORDER_ERROR_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 static AgoraMediaRecorder getMediaRecorder(RtcEngine engine)
engine
- The `RtcEngine` object. See RtcEngine
.callback
- The `IMediaRecorderCallback` instance. See IMediaRecorderCallback
.public int setMediaRecorderObserver(RtcConnection connection, IMediaRecorderCallback callback)
public int startRecording(RtcConnection connection, AgoraMediaRecorder.MediaRecorderConfiguration config)
onRecorderStateChanged(RECORDER_STATE_ERROR, RECORDER_ERROR_NO_STREAM)
callback.config
- The recording configurations. See MediaRecorderConfiguration
.getMediaRecorder
before
calling `startRecording`.public int stopRecording(RtcConnection connection)
getMediaRecorder
before
calling `startRecording`.public void release()
getMediaRecorder
to get the `AgoraMediaRecorder`
object.