Q&A
Updated: 2024-06-03 15:19:28
Overview
This module is primarily used to display the Q&A module.
Initialization and Destruction
Before instantiating and using this module, you need to initialize and configure the SDK. For details, see the reference documentation.
Online File Import Method
// script 标签引入,根据版本号引入JS版本。
<script src="https://websdk.videocc.net/interactions-receive-sdk/0.24.0/lib/polyv-ir.umd.js"></script>
<script>
const { QuestionAnswer } = window.PolyvIRSDK;
</script>
Import Method (Recommended)
import { QuestionAnswer } from '@polyv/interactions-receive-sdk';
const questionAnswerSdk = new QuestionAnswer();
Usage Flow
Listening for Reply Messages
questionAnswerSdk.on(questionAnswerSdk.events.ANSWER, (msg)) => {
console.log('讲师回复消息' msg.data);
})
Listening for Message Deletion
questionAnswerSdk.on(questionAnswerSdk.events.DELETE_ANSWER, (msg)) => {
console.log('删除消息' msg.data);
})
Listening for sessionId Changes to Determine Live Streaming Status
questionAnswerSdk.on(questionAnswerSdk.events.UPDATE_SESSIONID, ()) => {
console.log('sessionId改变');
})
Submitting a Question
// content 问题内容
questionAnswerSdk.sendQuestion(content);
