@spatius/avatarkit-rtc feeds motion data from a supported RTC room into AvatarKit for local rendering. In its managed path, it also creates the RTC client and plays the remote audio.
Package boundary
The RTC Adapter is part of the Web SDK family. Native Agora clients use
AvatarKitRTC on iOS or ai.spatius:avatarkit-rtc on Android.
Install
Install the peer for the provider your application uses.- LiveKit
- Agora
Package compatibility
@spatius/avatarkit-rtc declares peer dependencies on AvatarKit and the selected RTC client. Install the packages together, and treat peer-dependency warnings as compatibility errors. For exact current ranges, check the package’s published peerDependencies instead of relying on a version copied into this page.
Runtime contract
Initialize AvatarKit in RTC mode before constructingAvatarPlayer.
AvatarView and wait for its onFirstRendering callback before constructing or connecting an AvatarPlayer. AvatarView initializes its renderer asynchronously; the constructor returning is not a readiness signal.
yieldAudioData() or yieldFramesData() while it is active.
Providers
LiveKitProviderOptions
Most applications use new LiveKitProvider() without options. Use these options only when the room publishes motion data under custom track names.
Connection configuration
AvatarPlayer
Constructor
AvatarPlayerOptions
Properties
Treat the shape of
sessionSummary as diagnostics data, not application state.
Methods
Audio publishing
UsestartPublishing() for the microphone or supply any browser audio track with publishAudio().
unpublishAudio() does not stop a host-supplied track. The application that created it must release it.
State and events
The package exportsConnectionState:
Host-owned RTC clients
The defaultconnect() path lets the adapter create and own the RTC client. Use attach() only when your application already owns that client.
LiveKit Room
Create the room withsinglePeerConnection: false, attach before connecting, and use detach() before your application disconnects the room. In this flow, your application also owns remote audio playback.
Agora client
Attach before joining the channel. The host-owned client must use the H.264 codec and remains responsible for joining, subscribing, audio playback, and leaving. Do not mixconnect() with attach() on the same player.
Native client access
For provider-specific features in the managed path, read the client owned by the provider:player.getNativeClient() returns the same object as unknown; keep the provider reference when you want the provider-specific type.
Browser requirements
The package targets browser applications. AvatarKit’s WebAssembly and rendering requirements still apply; see Web Toolchain Setup.LiveKitProvider additionally requires RTCRtpScriptTransform to receive motion data. Check for the capability at runtime instead of relying on a fixed browser-version table:

