The IMediaRecorderCallback class.


Occurs when the recording state changes.

void onRecorderStateChanged(int state, int error);

When the local audio or video recording state changes, the SDK triggers this callback to report the current recording state and the reason for the change.


The current recording state:
  • RECORDER_STATE_ERROR(-1): An error occurs during the recording.
  • RECORDER_STATE_START(2): The audio and video recording starts.
  • RECORDER_STATE_STOP(3): The audio and video recording stops.
The reason for the state change.
  • RECORDER_ERROR_NONE(0): Everything is normal.
  • RECORDER_ERROR_WRITE_FAILED(1): The SDK fails to write the recorded data to a file.
  • RECORDER_ERROR_NO_STREAM(2): The SDK does not detect any audio and video streams, or audio and video streams are interrupted for more than five seconds during recording.
  • RECORDER_ERROR_OVER_MAX_DURATION(3): The recording duration exceeds the upper limit.
  • RECORDER_ERROR_CONFIG_CHANGED(4): The configurations of recording change.


Occurs when the recording information is updated.

void onRecorderInfoUpdated(RecorderInfo info);

After you successfully enable the local audio and video recording, the SDK periodically triggers this callback based on the value of recorderInfoUpdateInterval set in MediaRecorderConfiguration. This callback reports the file name, duration, and size of the current recording file.


The information about the file that is recorded. See RecorderInfo.