Updated on 2024-07-30 GMT+08:00

Querying Profile Pictures in the External Address Book

Notification Description

This API is used to display the customized profile picture when the camera is disabled in the video window. To use this API, set isUseExternalAddressBook to true in the Configuring the UI API, and return the image to be displayed to the SDK through the notification API.

Method Definition

1
virtual void OnQueryContactAvatar(const char account[HWM_MAX_ACCOUNT_LEN], const char thirdUserId[HWM_MAX_ACCOUNT_LEN], const char sipNumber[HWM_MAX_NUMBER_LEN], char* avatarPath,int pathLen) {};

Precautions

In the OnQueryContactAvatar notification method, the user needs to query the personal address book based on the account, thirdUserId, and sipNumber to obtain the avatarPath and assign the value to avatarPath. pathLen indicates the maximum length of the path.

Parameter Description

Table 1

Parameter

Type

Description

account

char[]

Account for logging in to Huawei Cloud Meeting.

thirdUserId

char[]

Third-party user ID for logging in to Huawei Cloud Meeting.

sipNumber

char[]

SIP number corresponding to the account.

avatarPath

char*

Path of the profile picture returned when the address book is queried.

pathLen

int

Maximum path length

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
/**
* Querying profile pictures in the external address book
*/
void demoNotifyProc::OnQueryContactAvatar(const char* account, const char* thirdUserId, const char* sipNumber, char* avatarPath, int pathLen)
{
    Cdemo* app = (Cdemo*)AfxGetApp();
    if (!app || (strlen(account) == 0 && strlen(thirdUserId) == 0 && strlen(sipNumber) == 0))
    {
// The window is closed or the data is empty.
        return;
    }
 
    string sAccount = account;
    string sThirdUserId = thirdUserId;
    string sSipNumber = sipNumber;
 
/* Obtain the profile picture path based on the logic of the user layer, account, thirdUserId, sipNumber and copy the path to the avatarPath char array.*/
// During the test, place an image in D:\\picture\\ and name it test.png.
    strcpy_s(avatarPath, pathLen, "D:\\picture\\test.png");
}