


The On-Premises-Recording SDK supports recording an individual stream (Including audio and video) in the room. After integrating the SDK, you can start to use the Individual-Stream-Recording function.
Before initialization, you need to inherit the interface named 'icallback' and set the listenner of the callback.
Interface Prototype:
ZEGO_API bool SetCallback(ICallback* pCB)
Parameter:
pCB
:Pointer to the object of callback.
Note:
Before initializing the SDK, you can call the following interfaces as needed:
SetLogDirAndSize
Set the path and size of the log file
SetUseTestEnv
Decide whether to use a test environment.
Use the obtained AppID and AppSign of ZEGO to initialize the SDK. If the SDK is not initialized, the related interface will be abnormal.If you have no AppID and AppSign, please apply in ZEGO Admin Console; You can refer to User Manual for help.
Interface Prototype:
ZEGO_API bool InitSDK(unsigned int uiAppID, unsigned char* pBufAppSignature, int nSignatureSize)
Parameters:
uiAppID
:The digital ID obtained from ZEGO, it is unique for each developer.
pBufAppSignature
:The Signature obtained from ZEGO, it is used to verify the validity of the your appid.
nSignatureSize
:Size of the Signature (byte).
Asynchronous Callback Interface:
class ICallback
{
public:
virtual void OnInitSDK(int errorCode) {}
}
errorCode == 0 # Initialization succeeded.
When initialize successfully, you also need to login the room before recording.
Interface Prototype:
ZEGO_API bool LoginRoom(const char* pszRoomID)
Parameters:
pszRoomID
:Room ID, for the Room with a pushing-stream.
Asynchronous Callback Interface:
class ICallback
{
public:
virtual void OnLoginRoom(int errorCode, const char *pszRoomID) = 0;
}
- Before you call the interface, the SDK must be initialized successfully.
- It is recommended to start recording according to the stream-add information, which you can get from the stream information update callback
OnStreamUpdate
After login the room.- You can get the maximum number of simultaneous recording stream that the SDK allows, by calling the interface
GetMaxRecordCount
.
Interface Prototype:
ZEGO_API bool StartRecordSingleStream(const char* pszStreamID, const char *pszPathAndName, MuxerStreamType nMuxerStreamType = MuxerStreamTypeBoth, int nFragmentSeconds = 2)
Parameters:
pszStreamID
: Stream ID to be recorded.
pszPathAndName
:The full path of the recording file (including the file name) must end with ". MP4". SDK will create the path automatically. If there is a file with the same name, the original one will be overwritten directly.
nMuxerStreamType
:The type of recording stream, please refer to MuxerStreamType
, By default, audio and video will be recorded at the same time.
nFragmentSeconds
:The Fragmentation interval of the recorded file (0~10s), 0 means no fragmentation, >0 means fragmentation interval; the default interval is 2s. When problems such as abnormal interruption happen during the recording process, Fragmentation can ensure that the recording file already saved work well; Note that the Fragmentation here is a logical concept for SDK's internal processing of recording files, rather than dividing the recorded files into multiple small files according to the interval time.
Asynchronous Callback Interface:
class ICallback
{
public:
virtual void OnStreamRecordBegin(const char* pszStreamID, const char *pszPathAndName) = 0;
}
When the recording starts successfully, you will receive a callback named OnStreamRecordBegin.
Interface Prototype:
ZEGO_API bool StopRecordSingleStream(const char* pszStreamID)
Parameters:
pszStreamID
:Stream ID。
Asynchronous Callback Interface:
class ICallback
{
public:
virtual void OnStreamRecordEnd(const char* pszStreamID, const char *pszPathAndName, RecordEndReason reason) = 0;
}
Notes:
When recording is no longer needed, it is recommended to do the following:
LogoutRoom
to logout the room.LIVEROOM::SetCallback(nullptr);
to Remove the callback listener.UnInitSDK
to deinitialization the SDK。Interface | Description |
---|---|
SetUseTestEnv | Set whether to use the test environment or not, you can use the test environment for testing during the development. |
SetCallback | Set the callback listener |
InitSDK | Initialize SDK |
LoginRoom | Login Room |
GetMaxRecordCount | Get the maximum number of simultaneous recording stream that the SDK allows |
StartRecordSingleStream | Start individual stream recording |
StopRecordSingleStream | Stop individual stream recording |
SetMuxerOutType | Set recording data output type. |
SetLogDirAndSize | Set the path and size of the log file, size for a single log. |
SetConfig | Set configuration |
SetMuxerCacheSize | Set the cache size before the file is created.(64KB~1MB) |
GetSDKVersion | Get the SDK version |
UploadLog | Upload log file to ZEGO Server. |
UnInitSDK | Deinitialization the SDK |
LogoutRoom | Logout the room |
Free trial
Contact us
Cont-act us