This Java API is a data encapsulation of the C++ sample code with JNI, and is therefore slightly different from that of the C++ API in structure. The Agora SDK (sample code shared by C++ and Java) implements the C++ recording APIs and callbacks, goes through data encapsulation in the JNI layer, and then works as the Java interface and class of the Native SDK through the JNI proxy.

RecordingSDK Class

Method Description
createChannel Creates a channel.
setVideoMixingLayout Sets the video mixing layout.
leaveChannel Allows the app to leave the channel.
getProperties Retrieves the recording properties.
startService Starts a recording.
stopService Pauses the recording.

RecordingEventHandler Class

Callback Description
nativeObjectRef Returns the JNI instance.
onWarning Occurs when a warning occurs.
onError Occurs when an error occurs.
onConnectionLost Occurs when the SDK loses connection to the server.
onConnectionInterrupted Occurs when the connection between the SDK and the server is interrupted.
onJoinChannelSuccess Occurs when the recording app joins a channel.
onLeaveChannel Occurs when the recording app leaves the channel.
onUserJoined Occurs when a user joins the channel.
onUserOffline Occurs when a user leaves the channel or goes offline.
audioFrameReceived Occurs when the raw audio data is received.
videoFrameReceived Occurs when the raw video data is received.
onAudioVolumeIndication Reports the list of users who are speaking and their volumes.
onActiveSpeaker Occurs when a speaker is detectesd in the channel.
onFirstRemoteAudioFrame Occurs when the first remote audio frame is received.
onFirstRemoteVideoDecoded Occurs when the first remote video frame is decoded.
onReceivingStreamStatusChanged Occurs when the status of receiving the audio or video stream changes.
stopCallBack Occurs when the SDK cannot call the JNI function.
recordingPathCallBack Reports the directory of the recorded files.