文档首页> 华为云会议 Meeting> 客户端SDK参考> Electron SDK> 典型场景> 场景10:定制会中“邀请”按钮
更新时间:2024-01-24 GMT+08:00
分享

场景10:定制会中“邀请”按钮

描述

考虑到大部分使用SDK二次开发的场景下,第三方App不会使用华为云会议的通讯录,因此Electron SDK提供的会议界面上“邀请”按钮,只提供了一个按钮界面,并没有提供完整邀请与会者的功能,需要开发者自己实现。

业务流程

使用SDK实现“邀请”功能时,在SDK初始化完成后先调用config接口,然后处理接口回调函数onConfigResult。会议中,在“邀请”按钮单击后,再处理订阅的消息通知onClickInjectBtnNotify。

  1. 接口调用

    1. 组装包含配置信息的字符串和接口回调函数onConfigResult。
    2. 调用config接口,第1步中的数据作为参数。

  2. 处理回调函数

    处理回调函数onConfigResult。

  3. 处理消息通知

    当“邀请”按钮单击后,再处理订阅的消息通知onClickInjectBtnNotify

示例代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* 配置邀请按钮
*/
async setInvite(){
    let param = {
        "frame": {
            "confMenu": {
                "toolBar": {
                    "button": [{
                        "buttonId": "invite",
                        "showAsAction": "ifRoom",
                        "isCustomizedClick": true
                    }]
                }
            }
        }
    }
    const apiService = new ApiService();
    let setResult = await apiService.config(JSON.stringify(param));
    if(setResult.ret != 0){
        window.electron.ipcRenderer.send("show-error-alert", "config error = " + setResult.ret);
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* ApiService中config接口定义
*/
async config(uiConfig) {
  return new Promise((resolve) => {
    let resultCallback = (ret, reason) => {
      console.log("config, out data = ", { ret, reason });
      resolve({ ret, reason });
    };
    console.log("config, in param = ", uiConfig);
    this.uisdkService.getUIConfigApi().config(uiConfig, resultCallback);
  });
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* 订阅按钮点击消息onClickInjectBtnNotify通知
*/
uisdkService.getUIConfigApi().setOnClickInjectBtnNotifyCB(NotifyService.handleOnClickInjectBtnNotify);

/**
* NotifyService中handleOnClickInjectBtnNotify定义
*/
static handleOnClickInjectBtnNotify(injectBtnInfo) {
    console.log('OnClickInjectBtnNotify', ', injectBtnInfo = ', injectBtnInfo);
    switch (injectBtnInfo.injectBtn) {
        // “邀请”按钮点击消息通知
        case ClickInjectBtn.HWM_CLICK_INJECT_BTN_INVITE:
           // 显示添加与会人界面
            window.location.hash = "#/confCtrlPage/addAttendee";
            window.electron.ipcRenderer.send('show-add-attendee-window');
            break;
        default:
            break;
    }
}
分享:

    相关文档

    相关产品