Control over Text to Speech audio properties in WebChat
Feature Request
Is your feature request related to a problem? Please describe. I am using WebChat to interface with my Bot, and the mode of interaction in primarily through voice. I have also implemented a solution which sends an inactive event after 'n' seconds of user inactivity to re-prompt a user. In a speech driven scenario, this usually fails since the message playback time is not considered, and hence the inactive event sent is not in sync with the bot reply message.
Describe the suggestion or request in detail In a speech first scenario, the above mentioned approach fails since the time taken for the message to be voiced out is not considered, and hence the inactive prompt is sometimes sent while the previous message is still being voiced out, and a user has not yet had a chance to reply. The solution I would be looking for would allow me to access the TTS response audio properties, such as duration, hence allowing me to add the Text-to-Speech response audio duration to my fixed inactive timer, so that the inactive prompt from the bot is not sent too early, or too late - in the case the response is a very short one.
[Enhancement]
@compulim can you please take a look at this? thanks.
Can you try writing an activity renderer that do the following?
- On render of activity:
- If the function is rendering the last activity and it is from the bot
- Check if
activity.channelData.speakturns fromtruetofalse- You can use
useStatehook to remember the last value
- You can use
- If it become
false, that means the last activity in the transcript is being spoken - Then you can start your inactivity timer and send message
- Check if
- If the function is rendering the last activity and it is from the bot
@compulim Is this using React Hooks?
@compulim Is this using React Hooks?
Yes
Hey @manish-95 I'm closing this thread due to inactivity, if still experience this issue please feel free to open a new one.
You need to write an activity renderer, which is not hook. But inside the renderer, you need to keep the state, which I would recommend using hooks. I believe it is not required to use hooks if you are not used to it, but it will simplify your code. All our samples are using hooks so it will be easier to copy code from our samples too. 😊