Discussions
Why my avatar not speaking the welcome message?
about 24 hours ago by Stalin Raj
In the knowledge base, I have added a welcome message in the "Opening Intro" section.
When I start the session, avatar is not speaking it. It is waiting for me to speak.
type
const sessionData = await avatar.createStartAvatar({
avatarName: "Bryan_IT_Sitting_public",
knowledgeId: "c400f6804eb143f386ac0549965ea60f",
quality: "high",
language: "en",
});
avatar.on(StreamingEvents.AVATAR_STOP_TALKING, () => {
setVoiceStatus("Waiting for you to speak...");
});
const handleStreamReady = (event) => {
if (event.detail && videoEl) {
videoEl.srcObject = event.detail;
videoEl.onloadedmetadata = () => {
videoEl.play().catch(console.error);
};
setLoading(false);
const avatar = avatarRef.current;
if (avatar) {
startVoiceChat();
}
}
};
const startVoiceChat = async () => {
const avatar = avatarRef.current;
console.log("startVoiceChat avatar", avatar)
if (!avatar) return;
try {
await avatar.startVoiceChat({
useSilencePrompt: false
});
console.log("Voice chat started successfully.");
setVoiceStatus("Waiting for you to speak...");
} catch (error) {
console.error("Error starting voice chat:", error);
setVoiceStatus("Error starting voice chat");
}
};