Live Video-Only Embedding
This section guides you on how to use embed just the live video component of the Digital Human experience. You'll learn to send events from your page directly into the video-only iframe, concealing all other frontend elements.
The video only mode allows customers running UNITH’s digital heads in an iframe to have a bi-directional communication with their digital humans. This means customers can now send events to the digital humans from their web applications and also listen for events from said heads.
This is made possible by our secure implementation of the window.postMessage() method which safely allows cross-origin communication between a page and an iframe embedded in it.
To see it in action, check out this example here: Link.
You must have the ADMIN role to access the following endpoints.
There are two necessary prerequisites to running video-only mode:
- Add the URL where the iframe will run inside the Allowed Iframe Origins section in your Unith Interface dashboard settings (coming soon)
- Add your URL using the following endpoint via our API: /head/{id}/allowed-origins and /head/{id}/iframe/allowed-origins
- Append the query param "&mode=video" to your iframe source. A correct implementation should look like this:
Communication between your app and the iframe is done by passing our custom event names to the "postMessage" method.
The table below outlines the events we support and respective parameters:
Event Name | Event Payload | Description |
---|---|---|
DH_READY | {
isReady: boolean
} | Originator : UNITH’s Iframe This event is sent to your app when the digital head has fully loaded and is ready to process messages. |
DH_MESSAGE | {
message:string
} | Originator: Your App Send this event and payload to prompt the digital head (DH) to process your input. |
DH_PROCESSING | {
processing: boolean
} | Originator: UNITH’s Iframe This event is sent to your app when the digital head is processing a your input. |
Registering your event listeners:
Sending a message to the digital human:
For a fully functioning example, please check out any of our sample applications on github: