Initialize
Function Usage
Initializes the video stream engine client, including network communication components.
Restrictions
N/A
Prototype
uint32_t Initialize(OnVmiEngineEvent eventHandleFunc)
Parameters
Field Name |
Input/Output |
Field Type |
Description |
|---|---|---|---|
eventHandleFunc |
Input |
OnVmiEngineEvent |
Pointer to the input engine client event callback function. The prototype is as follows: using OnVmiEngineEvent = void (*)(EngineEvent event); EngineEvent is a video stream engine client event. The prototype is as follows: typedef struct EngineEvent { int event = 0; int para1 = 0; int para2 = 0; int para3 = 0; int para4 = 0; char additionInfo[4096] = {0}; } EngineEvent; event indicates the code of the video stream engine client event. The value can be: enum VmiEngineEvent { VMI_ENGINE_EVENT_SOCK_DISCONN = -2, // The connection is interrupted. VMI_ENGINE_EVENT_PKG_BROKEN = -3, // The data packet is broken. VMI_ENGINE_EVENT_VERSION_ERROR = -4, // The versions of the server and client do not match. VMI_ENGINE_EVENT_READY = -5, // The engine renders the first frame successfully. VMI_ENGINE_EVENT_ORIENTATION_CHANGED = -6, // The server orientation is changed. VMI_ENGINE_EVENT_CACHE_OVERFLOW = -7, // Cache overflow VMI_ENGINE_EVENT_BAD_LATENCY = -8, // Long network latency VMI_ENGINE_EVENT_NEW_CONNECTION = -9, // A new connection is received. VMI_ENGINE_EVENT_TRAFFIC_ABNORMAL = -10, // Abnormal network traffic VMI_ENGINE_EVENT_APP_TRAFFIC_ABNORMAL = -11, // The traffic from the app to the SIPC is abnormal. VMI_ENGINE_EVENT_GET_VERSION_TIMEOUT = -12, // Obtaining the version number timed out. VMI_ENGINE_EVENT_VERSION_MISMATCH = -13, // Version mismatch VMI_ENGINE_EVENT_ENGINE_MISMATCH = -14, // Engine mismatch }; When the value of event is VMI_ENGINE_EVENT_ORIENTATION_CHANGED, para1 indicates the rotation orientation. The options are as follows:
|
Returns
Data type: uint32_t
The value can be:
- VMI_SUCCESS: The video stream engine client is initialized successfully.
- VMI_CLIENT_EXEC_ORDER_FAIL: The execution order of the video stream engine client is invalid.
- VMI_CLIENT_INITIALIZE_FAIL: Failed to initialize the video stream engine client.
Example Call
void CallJavaOnVmiVideoEngineEvent(EngineEvent engineEvent)
{
}
void Test()
{
uint32 initResult = Initialize(CallJavaOnVmiVideoEngineEvent);
if (initResult != VMI_SUCCESS) {
// Failed to initialize the video stream engine client. An error message is displayed, and then the page exits.
...
Log.e(TAG, "Video engine initialize failed, result:" + initResult);
} else {
// Success
...
}
}