情绪反馈
更新时间:2025-02-28 14:41:01
聊天室模块(chat) 提供情绪反馈功能 Api,用于开发者集成情绪反馈功能。
一、使用方式
1.1 发送情绪反馈
Api 方法: sendEmotionalFeedback(type: EmotionalFeedbackType, count: number): void
参数说明:
type:类型,
EmotionalFeedbackType类型,必传count:数量,
number类型,必传
示例:
import { EmotionalFeedbackType } from '@polyv/live-watch-sdk';
// 发送 5 个“明白了”
watchCore.chat.sendEmotionalFeedback(EmotionalFeedbackType.Yes, 5);
// 发送 5 个“没听懂”
watchCore.chat.sendEmotionalFeedback(EmotionalFeedbackType.No, 5);
1.2 情绪反馈事件
说明: 通过该事件监听用户的情绪反馈事件
Event 事件: ChatEvents.ChatEmotionalFeedback
回调参数: Object 对象,详细类型说明如下
| 属性名 | 说明 | 类型 |
|---|---|---|
type |
情绪类型 | EmotionalFeedbackType |
count |
数量 | number |
示例:
watchCore.chat.eventEmitter.on(ChatEvents.ChatEmotionalFeedback, (data) => {
console.log('类型:', data.type); // EmotionalFeedbackType
console.log('数量:', data.count);
});
