Skip to main content
AvatarKit follows the same client lifecycle across integrations. What changes is who owns the connection and audio path, not how the Avatar is loaded and rendered.

Initialize

Initialize AvatarKit once when the application starts. This establishes shared configuration before any Avatar is loaded.

Load

Load the selected avatar-id before creating its view. AvatarKit downloads and caches the avatar assets; loading the same Avatar again can reuse that cache. See Avatar for the asset mental model.

Render

Mount the loaded Avatar into an Avatar view. The view owns the render surface and its controller, and can show idle animation before a conversation begins. Treat the view and its controller as one lifecycle unit. Recreate or release them together when the Avatar changes. new AvatarView(...) starts asynchronous renderer initialization. The constructor returning does not mean that the view can accept motion data yet. Set onFirstRendering immediately after construction and wait for that callback before starting a controller, creating an RTC player, or joining an RTC room.

Connect

Connect only after onFirstRendering has fired and the Avatar is ready to render. The selected integration determines the connection owner:
  • In Direct Mode, AvatarKit connects to Motion Server.
  • In the recommended integrations, the client joins the configured RTC room while the agent runtime owns the Motion Server session.
  • In Backend Mode, your backend owns the Motion Server session and delivers data to the client.
Follow the setup and Client pages for your path from Integrations. Do not reuse a Direct Mode connection sequence in another integration.

Interact

During a response, AvatarKit keeps avatar speech audio and motion data synchronized. Your UI can observe conversation state and control playback, including pause, resume, and interruption. See Audio for input timing and Client State & Events for observable state.

Cleanup

Release the Avatar view, controller, and any transport listeners when the screen or session ends. Cleanup behavior differs slightly by client platform; use the platform reference for the exact API: Web · iOS · Android · Flutter
Do not leave an old view or transport subscription alive after switching Avatars. Stale callbacks can update a view that is no longer visible.