A session is one running instance of an Avatar in your app. It starts when you configure AvatarKit and ends when you close the connection and release the view. The client-side path is:Documentation Index
Fetch the complete documentation index at: https://docs.spatius.ai/llms.txt
Use this file to discover all available pages before exploring further.
Initialize
AvatarSDK.initialize() sets process-wide AvatarKit configuration:
- App ID and environment.
- Audio format.
- Driving mode.
- Logging.
Calling
initialize() again updates configuration in place. It does not automatically close existing connections, unload Avatars, or destroy views. Use AvatarSDK.cleanup() only when you need a clean process-level reset.AvatarSDK · iOS AvatarSDK · Android AvatarSDK
Load Avatar
Load the Avatar before you try to display it:AvatarManager, and cache behavior.
Mount AvatarView
Mount the loadedAvatar in an AvatarView. The view creates the render surface and owns the AvatarController for that surface.
After mount:
- The Avatar can display idle motion.
- Your app can access the
AvatarController. - Playback can start once the connection path is online and motion data arrives.
AvatarController directly; it belongs to the view because it needs the same render context.
→ Reference: Web AvatarView · iOS AvatarView · Android AvatarView
Connect
Connect brings the path between avatar speech audio, Motion Server, and AvatarKit online. This is the step where modes differ.| Mode | Connection owner | What your app does |
|---|---|---|
| Basic Mode | AvatarKit on the client connects to Motion Server. | Set a valid Session Token, then start the controller. |
| Custom Mode | Your backend connects to Motion Server through the Spatius Server SDK. | Start the backend session and deliver audio and motion data to AvatarKit through your transport. |
| LiveKit Plugin | Your agent worker starts the plugin; Motion Server publishes audio and motion data into the LiveKit room. | Join the room from the client and let AvatarKit render from room data. |
AvatarController.start · iOS AvatarController.start · Android AvatarController.start
Cleanup
Tear down in the reverse direction:- Close the active connection for your mode.
- Destroy or unmount the
AvatarView. - Release cached Avatar assets only if nothing else is using them.
- Call
AvatarSDK.cleanup()only for a full process-level reset.
AvatarController.close · iOS AvatarController.close · Android AvatarController.close
What can go wrong
| Symptom | Likely cause |
|---|---|
| Avatar never appears | Avatar was not loaded, the view was not mounted, or rendering resources were released too early. |
| Connection fails immediately | Missing, expired, or invalid Session Token in Basic Mode; server-side connection issue in Custom Mode or LiveKit Plugin. |
| Audio plays but avatar does not move | Motion data is not reaching AvatarKit, or the wrong transport path is online. |
| Resources leak after navigation | View cleanup was skipped, especially on Android. |
Go next
- Avatars if the session is blocked before the view mounts.
- Audio and Motion Data if the session is online and you need to deliver avatar speech audio and motion data.
- State & Events if connection or playback state is failing at runtime.

