Skip to Content
JavaScript SDKExamplesThe call's last seconds

The call’s last seconds

A call has a longest: the maxSessionLengthSeconds your server asked for, else the character’s, else 2 hours — and never longer than your plan allows (on Free, 3 minutes). It is counted from the avatar’s first frame. In the last 15 seconds the SDK counts down over the top of the video — Call ends in 15 s, 14, 13… — and the call ends at 0. The numbers reach the SDK when it joins. The same countdown shows when your account’s credit is about to run out: AvatarGo tells the call 15 seconds before, and at 0 every call of yours going ends. The label is in the browser’s language, does not say why, covers no face and takes no focus. call_ending fires as it begins, with the reason.

Your own words, for label and short (used on a video narrower than 300 px); {seconds} becomes the seconds left:

await client.streamToVideoElement("avatar", { endingNotice: { label: "Wrapping up in {seconds} s" } });

Or draw your own: switch the label off and follow the event.

client.on("call_ending", ({ secondsLeft }) => { endingNote.hidden = false; endingNote.textContent = `This call ends in ${secondsLeft} s`; }); await client.streamToVideoElement("avatar", { endingNotice: false });