更新时间:2024-04-22 GMT+08:00
分享

场景3:预约会议

描述

在使用华为云会议账号登录后,可以调用预约会议接口预约会议。预约会议时,除了填写预约会议所需的会议参数以外,还可以添加与会者。

业务流程

调用bookConf接口预约会议,然后处理接口回调函数onBookConfResult和订阅的onConfListChanged通知。

若要预约个人会议ID的会议或者云会议室的会议,则需要先调用getVmrList接口查询个人会议ID和云会议室信息,然后处理接口回调函数onGetVmrListResult返回的数据,该数据可用于预约会议。

  1. 接口调用

    1. 组装数据结构BookConfParam(包含结构内Array<AttendeeBaseInfo>)和接口回调函数onBookConfResult。
    2. 调用bookConf开始创建预约会议,第1步中的数据作为参数。

  2. 处理回调函数

    处理回调函数onBookConfResult。

  3. 处理消息通知

    处理消息通知onConfListChanged。

示例代码

 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
/**
* 预约会议
*/
async goToBookConf() {
    let _attendees = [{ 
        nickName: "Mike", 
        number: "+991116003543", 
        email: "", 
        sms: "", 
        thirdUserId: "",
        isMute: true, 
        isAutoInvite: true,   
    }];
    let param = {
        startTime: 1598398920; //utc时间戳,单位秒,如果获取的时间是本地时间,需要转换成utc时间
        duration: 30; //会议持续时长(分钟)
        isSendCalendar: true,
        confCommonParam: {
            subject: "我的预约会议", // 此处应是utf-8编码字符串
            mediaType: MediaType.HWM_MEDIA_TYPE_VIDEO,
            needPassword: true,
            timezone: 56, // 时区,56表示东八区
            confAllowJoinUser: ConfAllowJoinUserType.CONF_ALLOW_JOIN_ANYONE,
            isSendSms: true,
            isSendEmail: true,
            attendees: _attendees,
            isAutoRecord: false, //默认会议不开启自动录制
        }
    }
    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
/**
* ApiService中bookConf接口定义
*/
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
/**
* 订阅会议列表信息onConfListChanged通知
*/
uisdkService.getConfMgrApi().setOnConfListChangedCB(NotifyService.handleOnConfListChanged);

/**
* NotifyService中handleOnConfListChanged定义
*/
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);
}
分享:

    相关文档

    相关产品