保利威文档中心

幫助中心

情緒回饋

更新時間: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);
});
联系客服,在线咨询