Stage 1: Initialize
CallAvatarSDK.initialize(appId, configuration) once when your app starts. This sets process-level configuration such as App ID, region, audio format, driving mode, and log level.
AvatarKit must be initialized before you load an Avatar or create a view.
Reference: Web | iOS | Android | Flutter
Stage 2: Load Avatar
AvatarManager.load(id, onProgress?) downloads avatar assets by avatar-id and returns an Avatar instance. In-flight loads for the same ID are reused, and successful loads are cached.
The
onProgress callback has three states: downloading, completed, and failed. progress ranges from 0 to 1.
Reference: Web | iOS | Android | Flutter
Stage 3: Render
Mount the loadedAvatar into an AvatarView. The view creates the render surface and automatically creates the associated AvatarController. Do not construct the controller directly.
After mounting:
- The Avatar can play idle animation.
- Your app can access the
AvatarController. - Once the connection path is online and motion data arrives, playback can start.
Reference: Web | iOS | Android | Flutter
Stage 4: Authentication
Authentication differs by integration path. Only Direct Mode requires the client to hold a Spatius Session Token; the other paths authenticate inside their own transport.
The API Key must only ever live on your backend.
Direct Mode reconnect: if a
sessionTokenExpired / sessionTokenInvalid error fires during reconnect, fetch a fresh Session Token from your backend and call AvatarSDK.setSessionToken() again before restarting the connection. RTC / Platform Integration / Backend Mode reconnects don’t go through this flow — the Spatius client never sees a Motion Server token in those paths.Stage 5: Connect & Interact
UseAvatarController to start connections, send and receive data, and control playback. Connection ownership differs by mode in this stage:
For audio source and timing guidance, see Audio.
For state observation, see State & Events.
Reference: Web | iOS | Android | Flutter
Cleanup
Release resources when the Avatar is no longer used.- Web
- iOS
- Android
- Flutter
AvatarView | iOS AvatarView | Android AvatarView | Flutter
