Emotional Feedback
Updated: 2025-02-28 14:41:01
聊天室模块(chat) provides an Emotional Feedback API for developers to integrate emotional feedback functionality.
1. Usage
1.1 Sending Emotional Feedback
API Method: sendEmotionalFeedback(type: EmotionalFeedbackType, count: number): void
Parameter Description:
type: Type,
EmotionalFeedbackTypetype, requiredcount: Count,
numbertype, required
Example:
import { EmotionalFeedbackType } from '@polyv/live-watch-sdk';
// 发送 5 个“明白了”
watchCore.chat.sendEmotionalFeedback(EmotionalFeedbackType.Yes, 5);
// 发送 5 个“没听懂”
watchCore.chat.sendEmotionalFeedback(EmotionalFeedbackType.No, 5);
1.2 Emotional Feedback Event
Description: Listen to the user's emotional feedback event through this event
Event: ChatEvents.ChatEmotionalFeedback
Callback Parameters: Object object, detailed type description as follows
| Property | Description | Type |
|---|---|---|
type |
Emotion type | EmotionalFeedbackType |
count |
Count | number |
Example:
watchCore.chat.eventEmitter.on(ChatEvents.ChatEmotionalFeedback, (data) => {
console.log('类型:', data.type); // EmotionalFeedbackType
console.log('数量:', data.count);
});
