Waiting for a renderer
The avatar is drawn by a GPU machine. When none is free — every one busy with other calls, or one still starting — the call waits in line until one is. While the avatar has not appeared, the SDK tells the user, over the video:
- after 15 s, Service busy — how long they have waited, and Keep waiting?, with Keep waiting and Call later;
- after Keep waiting, it asks again every 30 s;
- at 5 minutes, We couldn’t connect you right now. Please try again later. with OK, and it hangs up.
The times are AvatarGo’s, the same for every tenant, and reach the SDK when it joins. The wait is not
billed. The prompt is in the browser’s language — Chinese or English, otherwise English — and stays
out of the way: it takes no keyboard focus, and Esc does not close it. Call later ends the session
(endSession()) and the element is as it was before it; after the longest wait the message stays on the blurred face until
the user presses OK. Each step fires start_waiting; a session that ends during the wait says so in
session_ended (startWait: "cancelled" or "timed_out").
Your own words, for any of title, body ({waited} becomes the time waited), keepWaiting,
tryLater, timedOut and ok:
await client.streamToVideoElement("avatar", { waitingPrompt: { title: "Hang on", tryLater: "Not now" } });Or draw your own: switch the prompt off and follow the event. Giving up is endSession(); at the
longest wait the SDK hangs up by itself, as with the prompt on.
client.on("start_waiting", ({ waitedSeconds, final }) => {
busyNote.hidden = false;
busyNote.textContent = final ? "No one is free right now. Please try again later." : `Still connecting… ${waitedSeconds} s`;
});
client.on("video_play_started", () => { busyNote.hidden = true; });
await client.streamToVideoElement("avatar", { waitingPrompt: false });