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.
The application has loaded and configuration validated. The session may now be started by calling uneeqStartSession()
Session state has been updated (Initial, WaitingToStart, AvatarUnavailable, MajorError, Live, Paused, Ended)
The layout mode has been updated: LayoutModeUpdate.layoutMode
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
JSON data that was provided by the NLP system in the 'instructions' field. This data can be used to pass custom instructions from the NLP system into your front end application. For example, you could set some customData of a product that you want to display on the website.
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
Digital human audio could not be played due to browsers auto play policy. Digital human was started with audio muted. You may call uneeqUnmuteDigitalHuman() following user click/key event to unmute the digital human.
An error occurred with the digital human video. Refer to contents of message for details.
The digital human video could not be played for some reason. Most likely blocked due to the browsers auto play policy (the user has not interacted with the page before attempting to play audio).