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

Scenario 8: Joining a Meeting

Description

You can call this API to join a meeting using a meeting ID and password regardless of whether you have logged in to Huawei Cloud Meeting or not.

Service Process

When using the SDK to join an existing meeting, call the joinConfById API and implement the API callback function onJoinConfByIdResult and subscribed-to message notifications onConfStateChanged and onConfInfoNotify.

  1. Call an API.

    1. Assemble the data structure JoinConfByIdInfo and the API callback function onJoinConfByIdResult.
    2. Call the joinConfById API. The data in the preceding step is used as input parameters.

  2. Implement the callback function.

    Implement the onJoinConfByIdResult function.

  3. Implement the notification function.

    Implement the onConfStateChanged function.

  4. Implement the notification function.

    Implement the onConfInfoNotify function.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
async goToJoinConfById() {
  let { confId, password, nickName, isSpeakerOff, isMicOn, isCameraOn } = this.state;
  let param = {
    confId: "989156631",
    password: "807766",
    nickName: "Hangzhou site",
    isSpeakerOff: false, // The speaker is not muted by default after a user joins the meeting.
    isMicOn: true, // The microphone is enabled by default after a user joins the meeting.
    isCameraOn: false, // The camera is disabled by default after a user joins the meeting.
  }
  const apiService = new ApiService();
  let setResult = await apiService.joinConfById(param);
  if(setResult.ret != 0){
    window.electron.ipcRenderer.send("show-error-alert", "joinConfById error = " + setResult.ret);
  }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* Definition of joinConfById API in ApiService
*/
async joinConfById(joinConfByIdInfo) {
  return new Promise((resolve) => {
    let resultCallback = (ret, reason) => {
      console.log("joinConfById, out data = ", { ret, reason });
      resolve({ ret, reason });
    };
    console.log("joinConfById, in param = ", joinConfByIdInfo);
    this.uisdkService.getConfCtrlApi().joinConfById(joinConfByIdInfo, resultCallback);
  });
}

The onConfStateChanged and onConfInfoNotify event notification scenarios are the same as the meeting creation scenario. For details, see Scenario 6: Creating a Meeting.