Updated on 2023-03-23 GMT+08:00

Scenario 3: Scheduling a Meeting

Description

After logging in to the system using a Huawei Cloud Meeting account, you can call the meeting scheduling API to schedule a meeting. When scheduling the meeting, you can add participants in addition to setting mandatory meeting parameters.

Service Process

Call the bookConf API to schedule a meeting and implement the API callback function onBookConfResult and the subscribed-to notification onConfListChanged.

To schedule a meeting using a personal meeting ID or a cloud meeting room, call the getVmrList API to query the personal meeting ID and cloud meeting room information, and then process the data returned by the onGetVmrListResult function. The data can be used to schedule the meeting.

  1. Call an API.

    1. Assemble the data structure BookConfParam (including Array<AttendeeBaseInfo> in the structure) and the API callback function onBookConfResult.
    2. Call the bookConf API to schedule a meeting. The data in the preceding step is used as input parameters.

  2. Implement the callback function.

    Implement the onBookConfResult function.

  3. Implement the notification function.

    Implement the onConfListChanged function.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Schedule a meeting.
*/
async goToBookConf() {
    let _attendees = [{ 
        nickName: "Mike", 
        number: "+991116003543", 
        email: "", 
        sms: "", 
        thirdUserId: "",
        isMute: true, 
        isAutoInvite: true,   
    }];
    let param = {
        startTime: 1598398920; // UTC timestamp, in seconds. If the obtained time is the local time, the time needs to be converted to the UTC time.
        duration: 30; // Meeting duration, in minutes.
        isSendCalendar: true,
        confCommonParam: {
            subject: "My Scheduled Meeting", // The value must be a UTF-8 character string.
            mediaType: MediaType.HWM_MEDIA_TYPE_VIDEO,
            needPassword: true,
            timezone: 56, // Time zone. 56 indicates GMT+08:00.
            confAllowJoinUser: ConfAllowJoinUserType.CONF_ALLOW_JOIN_ANYONE,
            isSendSms: true,
            isSendEmail: true,
            attendees: _attendees,
            isAutoRecord: false, // By default, automatic recording is disabled for the meeting.
        }
    }
    const apiService = new ApiService();
    let setResult = await apiService.bookConf(param);
    if (setResult.ret != 0) {
        window.electron.ipcRenderer.send("show-error-alert", "bookConf error = " + setResult.ret);
    }
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* Definition of bookConf API in ApiService
*/
async bookConf(bookConfParam) {
  return new Promise((resolve) => {
    let resultCallback = (ret, reason, confDetail) => {
      console.log("bookConf, out data = ", { ret, reason, confDetail });
      resolve({ ret, reason, confDetail });
    };
    console.log("bookConf, in param = ", bookConfParam);
    this.uisdkService.getConfMgrApi().bookConf(bookConfParam, resultCallback);
  });
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
/**
* Subscribe to the onConfListChanged notification of the meeting list information.
*/
uisdkService.getConfMgrApi().setOnConfListChangedCB(NotifyService.handleOnConfListChanged);

/**
* Definition of handleOnConfListChanged in NotifyService
*/
static handleOnConfListChanged(confListInfo) {
    console.log('OnConfListChanged', ', confListInfo = ', confListInfo);
    let _confListInfo = window.sessionStorage.getItem("confListInfo");
    _confListInfo = _confListInfo ? JSON.parse(_confListInfo) : [];
    console.log("sessionStorage confList:", _confListInfo);
    let conflistNew = confListInfo.confListItem;
    let _data = JSON.stringify(conflistNew ? conflistNew : []);
    window.sessionStorage.setItem("confListInfo", _data);
}