There may be times when you want even more fine tuned control of your client application, and to synchronise your website with the state of the digital human. For this, we provide message events from the digital human application that may be consumed by your web client. To do this, you may listen to window event UneeqMessage.
The below code example demonstrates how you can listen for messages, and in this case update the class list of the body element when the session becomes live. There are many more message events you may want to listen for, these are listed in the table below.
Session state has been updated (Initial, WaitingToStart, AvatarUnavailable, MajorError, Live, Paused, Ended)
The digital human session ID
At least one digital human is available to be started
No digital humans are available to be started
A question was asked to the Digital Human
Digital human has a response
Content has been provided by the NLP system to be rendered
Full JSON instructions that were provided to the NLP. This data can be used to pass custom instructions from the NLP system into your front end application
Digital human has begun speaking
Digital human has finished speaking
Permission to use recording devices has been granted by the user.
A voice recording has been initiated
A voice recording has been ended