出入会通知能够使参会人清晰地看到会中人员变化。通过该功能,您可以:
实现 XYRTCEngineDelegate 接口,通过 onConfInOutNotification 回调接收参会者出入会通知。
通知信息包含在 XYSDKInOutInfo 数组中,包含:
/**
* 订阅事件
*/
subscribeXYEmitterEvent() {
const emitter = XYEmitter.getInstance();
// 订阅出入会通知事件
const inOutNotificationEmitter = emitter.on(
XYEventKeys.onConfInOutNotificationKey,
(xYInOutInfos: XYSDKInOutInfo[]) => {
this.handleOnConfInOutNotification(xYInOutInfos)
}
);
this.emitterArray.push(inOutNotificationEmitter);
}
/**
* 出入会通知回调
* @param xYInOutInfos 出入会信息数组
*/
onConfInOutNotification(xYInOutInfos: XYSDKInOutInfo[]) {
// 通过事件总线转发通知
XYEmitter.getInstance().emmit(
XYEventKeys.onConfInOutNotificationKey,
xYInOutInfos
);
}
/**
* 处理出入会通知
* @param xYInOutInfos 出入会信息数组
*/
handleOnConfInOutNotification(xYInOutInfos: XYSDKInOutInfo[]) {
// 保存通知信息
this.setXYInOutInfoTemp(xYInOutInfos);
// 根据通知数量决定更新方式
if (this.xYInOutInfoArray.length < 3) {
// 通知数量较少时直接更新
this.updateNotification();
} else {
// 通知数量较多时启动定时更新
this.startUpdateTimer();
}
}
/**
* 更新通知显示
*/
private updateNotification(): void {
// 实现通知UI更新逻辑
}
/**
* 启动定时更新
*/
private startUpdateTimer(): void {
// 实现定时更新逻辑
}