On-premise Recording SDK v3.0.6 API Reference for Linux (Java)
Public Member Functions | Static Public Attributes | List of all members
io.agora.recording.RecordingSDK Class Reference

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)
 
native boolean createChannelWithUserAccount (String appId, String channelKey, String name, String userAccount, RecordingConfig config, int logLevel)
 
long getUidByUserAccount (String userAccount)
 
String getUserAccountByUid (int uid)
 
synchronized boolean leaveChannel ()
 
int setVideoMixingLayout (VideoMixingLayout layout)
 
int updateWatermarkConfigs (LiteraWatermarkConfig[] literaWms, TimestampWatermarkConfig[] timestampWms, ImageWatermarkConfig[] imgWms)
 
int updateSubscribeVideoUids (int[] uids)
 
int updateSubscribeAudioUids (int[] uids)
 
int startService ()
 
int stopService ()
 
RecordingEngineProperties getProperties ()
 
int setUserBackground (int uid, String imagePath)
 
void setLogLevel (int level)
 

Static Public Attributes

static int MAX_USER_ACCOUNT_LENGTH = 256
 

Constructor & Destructor Documentation

◆ RecordingSDK()

io.agora.recording.RecordingSDK.RecordingSDK ( )

Main methods that can be invoked by your application.

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 server to join the channel.

Parameters
appIdSet appId of the recording server 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 server 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.

◆ createChannelWithUserAccount()

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

This method creates a channel and enables the recording server to join with the user account.

After the recording server successfully joins the channel, the SDK triggers the onLocalUserRegistered and onJoinChannelSuccess callbacks on the local client.

Note
To ensure smooth communication, use the same parameter type to identify the users in the same channel. Hence, the parameter type of the recording server's identifier should be the same as that of the other users joining the channel with the Agora Native/Web SDK.
Parameters
appIdSet appId of the recording server the same as that of the Native/Web SDK. A channel does not accept duplicate uids. Otherwise, there will be unpredictable behaviors. For more information, see Getting an App ID.
channelKeyThe dynamic key for authentication. Set channelKey of the recording server 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.
userAccountThe user account of the recording server. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
  • The 26 lowercase English letters: a to z.
  • The 26 uppercase English letters: A to Z.
  • The 10 numbers: 0 to 9.
  • The space.
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
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.

◆ getUidByUserAccount()

long io.agora.recording.RecordingSDK.getUidByUserAccount ( String  userAccount)

Gets the user ID by passing in the user account.

After a remote user joins the channel, the SDK gets the user ID and user account of the remote user and triggers the onUserInfoUpdated callback on the local client.

After receiving the onUserInfoUpdated callback, you can call the getUidByUserAccount method to get the user ID of the remote user by passing in the user account.

Parameters
userAccountThe user account of the remote user. Ensure that you set this parameter.
Returns
The user ID of the remote user.

◆ getUserAccountByUid()

String io.agora.recording.RecordingSDK.getUserAccountByUid ( int  uid)

Gets the user account by passing in the user ID.

After a remote user joins the channel, the SDK gets the user ID and user account of the remote user and triggers the onUserInfoUpdated callback on the local client.

After receiving the onUserInfoUpdated callback, you can call the getUserAccountByUid method to get the user account of the remote user from the UserInfo object by passing in the user ID.

Parameters
uidThe user ID of the remote user. Ensure that you set this parameter.
Returns
The user account of the remote user.

◆ leaveChannel()

synchronized boolean io.agora.recording.RecordingSDK.leaveChannel ( )

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

Returns
  • 0: Success.
  • < 0: Failure.

◆ setVideoMixingLayout()

int io.agora.recording.RecordingSDK.setVideoMixingLayout ( VideoMixingLayout  layout)

This method sets the video layout in composite recording mode.

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

◆ updateWatermarkConfigs()

int io.agora.recording.RecordingSDK.updateWatermarkConfigs ( LiteraWatermarkConfig[]  literaWms,
TimestampWatermarkConfig[]  timestampWms,
ImageWatermarkConfig[]  imgWms 
)

This method adds, updates, or deletes the watermark configurations.

The Agora Recording SDK supports three types of watermarks: text watermarks, timestamp watermarks, and image watermarks.

  • If you do not set LiteraWatermarkConfig, TimestampWatermarkConfig, or ImageWatermarkConfig to add watermarks when calling the setVideoMixingLayout method, you can directly call the updateWatermarkConfigs method to add watermarks.
  • If you set LiteraWatermarkConfig, TimestampWatermarkConfig, or ImageWatermarkConfig to add watermarks when calling the setVideoMixingLayout method, you can call the updateWatermarkConfigs method to add, update, or delete watermarks. If you pass null as parameters in the updateWatermarkConfigs method, you delete watermarks that have been added.
Note
Watermarks apply only to the videos recorded in composite recording mode (the isMixingEnabled parameter in the RecordingConfig is set as true).
Parameters
literaWmsAdds text watermarks. Pointer to an array of LiteraWatermarkConfig. You can add up to ten text watermarks.
timestampWmsAdds a timestamp watermark. Pointer to TimestampWatermarkConfig. You can only add one timestamp watermark.
imgWmsAdds image watermarks. Pointer to an array of ImageWatermarkConfig. You can add up to four image watermarks.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateSubscribeVideoUids()

int io.agora.recording.RecordingSDK.updateSubscribeVideoUids ( int[]  uids)

This method updates the UIDs of the users whose video streams you want to record.

Note
Ensure that you set the autoSubscribe parameter in the RecordingConfig as false before calling this method.
Parameters
uidsAn array of UIDs whose video streams you want to record in the string format, such as {"1","2","3"}.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateSubscribeAudioUids()

int io.agora.recording.RecordingSDK.updateSubscribeAudioUids ( int[]  uids)

This method updates the UIDs of the users whose audio streams you want to record.

Note
Ensure that you set the autoSubscribe parameter in the RecordingConfig as false before calling this method.
Parameters
uidsAn array of UIDs whose audio streams you want to record in the string format, such as {"1","2","3"}.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startService()

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

This method manually starts a recording.

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

Returns
  • 0: Success.
  • < 0: Failure.

◆ stopService()

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

This method manually pauses the recording.

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

Returns
  • 0: Success.
  • < 0: Failure.

◆ getProperties()

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

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.
Returns
See RecordingEngineProperties.

◆ setUserBackground()

int io.agora.recording.RecordingSDK.setUserBackground ( int  uid,
String  imagePath 
)

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
uidThe UID of the user for whom the background image to be set.
imagePathThe path of the image file. Only supports local images in JPEG format.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLogLevel()

void io.agora.recording.RecordingSDK.setLogLevel ( int  level)

This method sets the log level.

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

Parameters
levelThe log level:
  • 1: Fatal.
  • 2: Error.
  • 3: Warn.
  • 4: Notice.
  • 5: Info.
  • 6: Debug.

Member Data Documentation

◆ MAX_USER_ACCOUNT_LENGTH

int io.agora.recording.RecordingSDK.MAX_USER_ACCOUNT_LENGTH = 256
static

The maximum length of the user account.