Discussions
Avatar Constantly Repeats Itself
6 months ago by Becca
I am currently implementing the avatar but it repeats itself multiple times and doesn't clear out the text variable every time I try. I'm using the react.js sdk to implement it into the code base.
I've tried within the streamingevents as such:
avatarRef.current.on(StreamingEvents.AVATAR_STOP_TALKING, (e) => {
console.log("Avatar stopped talking");
dispatch(stopSpeaking());
dispatch(setAvatarScript(''));
});
And within a try/catch block:
try {
await avatarRef.current.speak({
text: text,
taskType: TaskType.REPEAT,
taskMode: TaskMode.SYNC,
})
} catch (error) {
console.error("Speech error:", error);
} finally {
dispatch(stopSpeaking()); //stop speaking
dispatch(setAvatarScript('')); //wipe out the text to stop the avatar from speaking
}
Neither one of these implementations work to stop the avatar from repeating the current text