HeyGen-Official / StreamingAvatarSDK

Streaming Avatar SDK
MIT License
17 stars 25 forks source link

How to find out when the avatar starts speaking. #5

Open kushakjafry opened 4 months ago

kushakjafry commented 4 months ago

Currently we are try to develop a one to one speaking avatar. I want to start speech recognition when the avatar stops saying. Currently we get a durationMs time when we call the streaming.task API with the text. It gives us the information of how much time will it take for AI avatar to speak the sentence.

By using setTineout i try to resumeSpeechRecognition after durationMs sent from the API setTimeout(async () => { await resumeSpeechRecognition(); }, data.data?.durationMs);

But I saw that due to initial delay in the start of speaking of avatar. The speech recognition library starts working earlier. Is there any way to get an event when the avatar gets the video and starts or stops speaking.