Public Member Functions

 RecordingSDK ()
 
void registerOberserver (RecordingEventHandler recordingEventHandler)
 
void unRegisterOberserver (RecordingEventHandler recordingEventHandler)
 
native boolean createChannel (String appId, String channelKey, String name, int uid, RecordingConfig config, int logLevel)
 
boolean leaveChannel (long nativeHandle)
 
native boolean nativeLeaveChannel (long nativeHandle)
 
int setVideoMixingLayout (long nativeHandle, VideoMixingLayout layout)
 
int startService (long nativeHandle)
 
int stopService (long nativeHandle)
 
RecordingEngineProperties getProperties (long nativeHandle)
 
int setUserBackground (long nativeHandle, int uid, String image_path)
 
void setLogLevel (long nativeHandle, int level)
 

Constructor & Destructor Documentation

◆ RecordingSDK()

io.agora.recording.RecordingSDK.RecordingSDK ( )

Main methods that can be invoked by your app.

Member Function Documentation

◆ registerOberserver()

void io.agora.recording.RecordingSDK.registerOberserver ( RecordingEventHandler  recordingEventHandler)

To register observer to receive Recording event notification.

◆ unRegisterOberserver()

void io.agora.recording.RecordingSDK.unRegisterOberserver ( RecordingEventHandler  recordingEventHandler)

To remove previously registered observer.

◆ createChannel()

native boolean io.agora.recording.RecordingSDK.createChannel ( String  appId,
String  channelKey,
String  name,
int  uid,
RecordingConfig  config,
int  logLevel 
)

This method creates a channel and enables the recording application to join the channel.

Parameters
appIdSet appId of the recording application the same as that of the Native/Web SDK. For more information, see Getting an App ID.
channelKeyThe dynamic key for authentication. Set channelKey of the recording application the same as that of the Native/Web SDK. If the Native/Web SDK uses a token, channelKey must be set as the token. For more information, see Use Security Keys. In the Recording SDK, requestToken and renewToken are private interfaces. Therefore, ensure that you set expireTimestamp as 0 when generating a token, which means that the privilege, once generated, never expires.
nameThe name of the channel to be recorded.
uidThe unique identifier of a user. A channel does not accept duplicate uids. Otherwise, there will be unpredictable behaviors.
  • If you set uid as 0, the SDK randomly assigns a uid and returns it in the onJoinChannelSuccess.
  • If you set your own uid, it should be a 32-bit unsigned integer ranging from 1 to (232-1).User ID.
configDetailed recording configuration. See RecordingConfig.
logLevelSets the log level. Only logs in the selected level and levels preceding the selected level are generated.
  • 1: Fatal.
  • 2: Error.
  • 3: Warn.
  • 4: Notice.
  • 5: Info.
  • 6: Debug.
Returns
  • 0: Success.
  • < 0: Failure.

◆ leaveChannel()

boolean io.agora.recording.RecordingSDK.leaveChannel ( long  nativeHandle)

This method allows the recording application to leave the channel and release the thread resources.

Parameters
nativeHandleThe recording engine.
Returns
  • 0: Success.
  • < 0: Failure.

◆ nativeLeaveChannel()

native boolean io.agora.recording.RecordingSDK.nativeLeaveChannel ( long  nativeHandle)

◆ setVideoMixingLayout()

int io.agora.recording.RecordingSDK.setVideoMixingLayout ( long  nativeHandle,
VideoMixingLayout  layout 
)

This method sets the video mixing layout.

Note
If you record video in composite recording mode, you must call this method to set the video layout.
Parameters
nativeHandleThe recording engine.
layoutLayout setting. See VideoMixingLayout.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startService()

int io.agora.recording.RecordingSDK.startService ( long  nativeHandle)

This method manually starts a recording.

The method is only valid when you set triggerMode in RecrordingConfig as 1 (manually) when joining the channel.

Parameters
nativeHandleThe recording engine.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopService()

int io.agora.recording.RecordingSDK.stopService ( long  nativeHandle)

This method manually pauses the recording.

The method is only valid when you set triggerMode in RecrordingConfig as 1 (manually) when joining the channel.

Parameters
nativeHandleThe recording engine.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getProperties()

RecordingEngineProperties io.agora.recording.RecordingSDK.getProperties ( long  nativeHandle)

This method allows you to retrieve the recording properties.

Note
  • Call this method after joining the channel.
  • The recording properties only include the relative path of the recording files.
  • Both the getProperties method and the onUserJoined callback report the relative path of the recorded files and recording log. The difference between these two functions is that the recording SDK only triggers the onUserJoined callback when a remote user joins the channel.
Parameters
nativeHandleThe recording engine.
Returns
RecordingEngineProperties. See RecordingEngineProperties.

◆ setUserBackground()

int io.agora.recording.RecordingSDK.setUserBackground ( long  nativeHandle,
int  uid,
String  image_path 
)

This method sets the background image of a specified user.

When the user is online but does not send any video stream, the background image is displayed.

Note
The background image is not displayed for users using the Agora Web SDK.
Parameters
nativeHandleThe recording engine.
uidThe UID of the user for whom the background image to be set.
image_pathThe path of the image file. Only supports local images in JPEG format.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLogLevel()

void io.agora.recording.RecordingSDK.setLogLevel ( long  nativeHandle,
int  level 
)

This method sets the log level.

Only logs in the selected level and levels preceding the selected level are generated. The default value of the log level is 5.

Parameters
nativeHandleThe recording engine.
levelThe log level:
  • 1: Fatal.
  • 2: Error.
  • 3: Warn.
  • 4: Notice.
  • 5: Info.
  • 6: Debug.
Returns
  • 0: Success.
  • < 0: Failure.