Skip to main content

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.

What is Basic Mode?

Basic Mode is the default integration mode. AvatarKit handles the client-side connection to Motion Server — you send avatar speech audio, and AvatarKit takes care of receiving motion data, synchronizing playback, and rendering.

When to Use

  • Real-time avatar speech audio — TTS or audio file playback driving an avatar
  • Simplest integration — minimal code, SDK handles networking
  • Server-side processing — motion data is generated by Motion Server

Requirements

RequirementDescription
App IDObtained from Spatius Studio
Session TokenObtained from your backend server (max 24 hours validity)
Audio FormatPCM16, mono, configurable sample rate (default 16000 Hz)
Authentication Flow:
Your Client → Your Backend → Motion Server → Session Token (24 hours max)
The Session Token must be set before calling start(). See the platform-specific guides below for details.

Platform Comparison

FeatureWebiOSAndroid
Package@spatialwalk/avatarkitAvatarKit.xcframework / SPMai.spatialwalk:avatarkit
RenderingWebGL / WebGPUMetalVulkan
UI FrameworkDOM CanvasUIKit + SwiftUI wrapperAndroid View + Compose wrapper
Audio InitinitializeAudioContext() in user gestureAutomaticAutomatic
Build ConfigVite plugin / Next.js wrapper requiredXcode linker flagsGradle dependency

Key Concepts

Fallback Mechanism

If the WebSocket connection fails within 15 seconds, the SDK automatically enters audio-only fallback mode — audio continues to play normally without animation. This ensures uninterrupted audio playback even when the server is unreachable.

ConversationId

Every send() call returns a conversationId that identifies the current conversation round. When end: true is passed, it marks the end of audio input — the avatar will continue playing remaining animation until finished, then automatically return to idle (notified via onConversationState). Sending new audio after that starts a new round and interrupts any ongoing playback.

Get Started

Web

JavaScript / TypeScript

iOS Demo

Use the GitHub demo as the iOS guide

Android Demo

Use the GitHub demo as the Android guide