Add to your site
Talking avatar
Show your agent as a lip-synced face, in a ready-made panel or in your own layout.
A flow with a face can appear as a talking avatar. The face is lip-synced to the agent's voice on Voxio's GPU servers.
Before you begin
You need:
- A flow with a face. Set one on the flow's Avatar tab in the dashboard.
environment: "gpu"in your code: faces are rendered on the GPU servers.
Add the avatar panel
Mount the panel with your flow key and the GPU environment:
<script src="https://cdn.jsdelivr.net/npm/voxioagent@2.0.0/dist/voxio.js" data-flow-key="YOUR_FLOW_KEY" data-widget="avatar" data-environment="gpu" data-title="Ask Asha" defer></script>Replace YOUR_FLOW_KEY with your flow key, from the flow's Overview in the dashboard.
A panel appears with the poster image. When the visitor starts the call, the face replaces it and talks.
Options
The panel takes the same session, look and placement options as the voice button, and these:
sizenumber | string- The panel width. Numbers are pixels. Default: 240.
shape"card" | "circle"- Default:
card. titlestring- The title over the panel.
posterURL- The image shown before the call starts.
pictureInPictureboolean- Shows a picture-in-picture button where the browser supports it. Default: true.
showCameraboolean- Shows the visitor’s own camera in a corner, and sends it to the agent. Default: false.
Show the face in your own layout
To place the face yourself, ask a session for video and put the stream in your own <video> element:
import { createSession } from "voxioagent/client";
const session = createSession({ flowKey: "YOUR_FLOW_KEY", environment: "gpu", media: { audio: true, video: true },});
session.on("agentVideo", (stream) => { const video = document.querySelector("#face"); video.srcObject = stream; video.play();});
document.querySelector("#start").onclick = () => session.start();The face appears in #face a moment after the call connects. These media options control what is sent and received:
media.videoboolean- Receives the agent’s lip-synced face.
media.cameraboolean- Sends the visitor’s camera, for flows that can see.
While a call is live, session.localStream holds the visitor's own microphone and camera.
Describe the participants
To decide yourself who sees and hears whom, pass participants. The voice server receives it as given. A participant with a video: true connection to the ai_participant gets the avatar.
This interview has the candidate and the interviewer seeing and hearing each other:
createSession({ flowKey: "YOUR_FLOW_KEY", environment: "gpu", participants: { ai_participant: "interviewer", participants: [ { name: "candidate", connections: [{ name: "interviewer", audio: true, video: true }] }, { name: "interviewer", connections: [{ name: "candidate", audio: true, video: true }] }, ], },});Next steps
- Headless sessions: see every session option and event.
- Servers and environments: learn what the GPU environment changes.