On-premise Recording SDK v3.0.6 API Reference for Linux (C++)
Public Member Functions | Static Public Member Functions | List of all members
agora::recording::IRecordingEngine Class Referenceabstract
Inheritance diagram for agora::recording::IRecordingEngine:
agora::server::IServerEngine

Public Member Functions

virtual  ~IRecordingEngine ()
 
virtual int  joinChannel (const char *channelKey, const char *channelId, uid_t uid, const RecordingConfig &config)=0
 
virtual int  joinChannelWithUserAccount (const char *token, const char *channelId, const char *userAccount, const RecordingConfig &config)=0
 
virtual int  getUserInfoByUserAccount (const char *userAccount, agora::linuxsdk::UserInfo *userinfo)=0
 
virtual int  getUserInfoByUid (uid_t uid, agora::linuxsdk::UserInfo *userInfo)=0
 
virtual int  setVideoMixingLayout (const agora::linuxsdk::VideoMixingLayout &layout)=0
 
virtual int  stoppedOnError ()=0
 
virtual int  leaveChannel ()=0
 
virtual int  release ()=0
 
virtual const RecordingEngineProperties getProperties ()=0
 
virtual int  startService ()=0
 
virtual int  stopService ()=0
 
virtual int  setUserBackground (uid_t uid, const char *img_path)=0
 
virtual int  setLogLevel (agora::linuxsdk::agora_log_level level)=0
 
virtual int  updateSubscribeVideoUids (uid_t *uids, uint32_t num)=0
 
virtual int  updateSubscribeAudioUids (uid_t *uids, uint32_t num)=0
 
virtual int  updateWatermarkConfigs (uint32_t wm_num, linuxsdk::WatermarkConfig *config)=0
 

Static Public Member Functions

static IRecordingEngine createAgoraRecordingEngine (const char *appId, IRecordingEngineEventHandler *eventHandler)
 

Detailed Description

The IRecordingEngine class provides the main methods that can be invoked by your application.

Constructor & Destructor Documentation

◆ ~IRecordingEngine()

virtual agora::recording::IRecordingEngine::~IRecordingEngine ( )
inlinevirtual

Member Function Documentation

◆ createAgoraRecordingEngine()

static IRecordingEngine* agora::recording::IRecordingEngine::createAgoraRecordingEngine ( const char *  appId,
IRecordingEngineEventHandler eventHandler 
)
static

This method creates an IRecordingEngine instance.

Parameters
appId The App ID used in the communications to be recorded. For more information, see Get an App ID.
eventHandler The Agora Recording SDK notifies the application of the triggered events by callbacks in the IRecordingEngineEventHandler.
Returns
An IRecordingEngine instance.

◆ joinChannel()

virtual int agora::recording::IRecordingEngine::joinChannel ( const char *  channelKey,
const char *  channelId,
uid_t  uid,
const RecordingConfig config 
)
pure virtual

This method allows the recording server to join a channel and start recording.

Note
  • In the Recording SDK, requestToken and renewToken are private methods. Make sure that you set privilegeExpiredTs as 0 when generating a token, which means that the privilege, once generated, never expires.
  • A channel does not accept duplicate uids. Otherwise, there will be unpredictable behaviors.
Parameters
channelKey The channelKey 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.
channelId The name of the channel to be recorded.
uid The unique identifier of the recording server.
  • If you set uid as 0, the SDK randomly assigns a uid and returns it in the onJoinChannelSuccess callback.
  • If you set your own uid, it should be a 32-bit unsigned integer ranging from 1 to (232-1).
config Detailed recording configuration. See RecordingConfig.
Returns
  • 0: Success.
  • < 0: Failure.

◆ joinChannelWithUserAccount()

virtual int agora::recording::IRecordingEngine::joinChannelWithUserAccount ( const char *  token,
const char *  channelId,
const char *  userAccount,
const RecordingConfig config 
)
pure virtual

This method enables the recording server to join the channel 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
token The dynamic key for authentication. Set the dynamic key of the recording server the same as that of the Native/Web SDK. If the Native/Web SDK uses a token, the recording server must use a token and the token of the recording server cannot be set as null. For more information, see Use Security Keys.
channelId The name of the channel to be recorded.
userAccount The 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.
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
config Detailed recording configuration. See RecordingConfig.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getUserInfoByUserAccount()

virtual int agora::recording::IRecordingEngine::getUserInfoByUserAccount ( const char *  userAccount,
agora::linuxsdk::UserInfo userinfo 
)
pure virtual

Gets the user information 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, caches them in mapping table object (UserInfo), and triggers the onUserInfoUpdated callback on the local client.

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

Parameters
userAccount The user account of the remote user. Ensure that you set this parameter.
userinfo [in/out] A UserInfo object that identifies the user:
  • Input: A UserInfo object.
  • Output: A UserInfo object that contains the user account and user ID of the remote user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getUserInfoByUid()

virtual int agora::recording::IRecordingEngine::getUserInfoByUid ( uid_t  uid,
agora::linuxsdk::UserInfo userInfo 
)
pure virtual

Gets the user information 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, caches them in mapping table object (UserInfo), and triggers the onUserInfoUpdated callback on the local client.

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

Parameters
uid The user ID of the remote user. Ensure that you set this parameter.
userInfo [in/out] A UserInfo object that identifies the user:
  • Input: A UserInfo object.
  • Output: A UserInfo object that contains the user account and user ID of the remote user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setVideoMixingLayout()

virtual int agora::recording::IRecordingEngine::setVideoMixingLayout ( const agora::linuxsdk::VideoMixingLayout layout )
pure virtual

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
layout Layout setting. See VideoMixingLayout.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stoppedOnError()

virtual int agora::recording::IRecordingEngine::stoppedOnError ( )
pure virtual

This method stops onError handler.

It is called in onError handler when meeting an error which cannot be handled.

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

◆ leaveChannel()

virtual int agora::recording::IRecordingEngine::leaveChannel ( )
pure virtual

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

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

◆ release()

virtual int agora::recording::IRecordingEngine::release ( )
pure virtual

This method destroys the IRecordingEngine instance.

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

◆ getProperties()

virtual const RecordingEngineProperties* agora::recording::IRecordingEngine::getProperties ( )
pure virtual

This method allows you to retrieve the recording properties.

Note
  • Call this method after joining the channel.
  • The recording properties only include the information of the path where the recording files and log are stored.
  • 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 onUserJoined callback is only triggered when a remote user joins the channel.
Returns
RecordingEngineProperties.

Implemented in agora::server::IServerEngine.

◆ startService()

virtual int agora::recording::IRecordingEngine::startService ( )
pure virtual

This method manually starts recording.

This method is valid only when you set triggerMode in RecordingConfig as 1 (manually).

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

◆ stopService()

virtual int agora::recording::IRecordingEngine::stopService ( )
pure virtual

This method manually stops recording.

This method is valid only when you set triggerMode in RecordingConfig as 1 (manually).

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

◆ setUserBackground()

virtual int agora::recording::IRecordingEngine::setUserBackground ( uid_t  uid,
const char *  img_path 
)
pure virtual

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

◆ setLogLevel()

virtual int agora::recording::IRecordingEngine::setLogLevel ( agora::linuxsdk::agora_log_level  level )
pure virtual

This method sets the log level.

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

Parameters
level See agora_log_level.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateSubscribeVideoUids()

virtual int agora::recording::IRecordingEngine::updateSubscribeVideoUids ( uid_t *  uids,
uint32_t  num 
)
pure virtual

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
uids An array of UIDs whose video streams you want to record in string format, such as {"1","2","3"}.
num The number of UIDs.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateSubscribeAudioUids()

virtual int agora::recording::IRecordingEngine::updateSubscribeAudioUids ( uid_t *  uids,
uint32_t  num 
)
pure virtual

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
uids An array of UIDs whose audio streams you want to record in string format, such as {"1","2","3"}.
num The number of UIDs.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateWatermarkConfigs()

virtual int agora::recording::IRecordingEngine::updateWatermarkConfigs ( uint32_t  wm_num,
linuxsdk::WatermarkConfig config 
)
pure virtual

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 the wm_num and wm_configs parameters to add watermarks when calling the setVideoMixingLayout method, you can directly call the updateWatermarkConfigs method to add watermarks.
  • If you set the wm_num and wm_configs parameters 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 all watermarks that have been added.
Note
Watermarks apply only to the videos recorded in composite recording mode (isMixingEnabled is set as true).
Parameters
wm_num The number of watermarks. The Agora Recording SDK supports up to 15 watermarks, including one timestamp watermark, four image watermarks, and ten text watermarks.
config The configuration of the watermarks. Pointer to an array of WatermarkConfig.
Returns
  • 0: Success.
  • < 0: Failure.