Control the avatar and read its live status from your own components.
useAvatar gives you everything you need to build custom controls: methods to start, stop, and send speech, plus live status flags like isSpeaking and isConnected that update as the session changes.
Call it inside any component nested under <AvatarProvider>.
| Prop | Type | Default | Description |
|---|---|---|---|
isReadyOptional | boolean | No default | The avatar is on screen and animating. Independent of the call — a loaded avatar is ready before a call starts, and stays ready after one ends. |
isLoadingOptional | boolean | No default | The avatar is still coming up — being resolved, or resolved and still rendering. |
isFailedOptional | boolean | No default | The avatar could not be loaded, so nothing is on screen. start() tries again. |
isConnectingOptional | boolean | No default | start() is in flight — true for the whole window from the tap until the call is live. |
isConnectedOptional | boolean | No default | True while a session is in progress — the WebSocket is open and the server has acknowledged the session start. |
isSpeakingOptional | boolean | No default | The avatar is actively speaking and animating. |
isListeningOptional | boolean | No default | The avatar is listening for user input (call mode). |
isThinkingOptional | boolean | No default | The avatar is working out its reply, between listening and speaking. |
isResponseSlowOptional | boolean | No default | The current turn is taking unusually long. Advisory — the turn is fine, just slow. React Native ships no built-in indicator, so render your own "still working" hint from this. Auto-clears when speech starts. |
isIdleOptional | boolean | No default | No call in progress; start() is available. True while the avatar is still loading too — start() waits the load out for you. |
avatarIdOptional | string | undefined | No default | The currently loaded avatar's ID. |
errorOptional | AvatarError | null | No default | The most recent error, or null. Sticky — it stays until the next start(), and never clears on a timer. |
controlsOptional | { enabled: boolean; stopSpeaking?: boolean } | No default | Whether the built-in control bar is shown, and whether it includes the stop-speaking button. |
| Prop | Type | Default | Description |
|---|---|---|---|
isMicMutedOptional | boolean | No default | The user's mic is muted — outbound audio is dropped, so the server genuinely hears silence. Call mode. |
isSpeakerMutedOptional | boolean | No default | The avatar's audio is muted. Playback is silent but lip-sync keeps animating. |
setMicMutedOptional | (muted: boolean) => void | No default | Mute or unmute the user's microphone. |
setSpeakerMutedOptional | (muted: boolean) => void | No default | Mute or unmute the avatar's spoken audio. |
Set turnTaking: { mode: "push-to-talk" } on the config, then wire a
Pressable. Pressing cuts the avatar off if it was speaking, which is what
makes barge-in work.
| Prop | Type | Default | Description |
|---|---|---|---|
isPushToTalkOptional | boolean | No default | The session is running in push-to-talk. Static for the session. |
isTalkingOptional | boolean | No default | The user is holding the talk button, so their audio is reaching the server. |
startTalkingOptional | () => void | No default | The press: start uploading mic audio. No-op outside push-to-talk or with no live session. |
stopTalkingOptional | () => void | No default | The release: end the user's turn. No-op if no turn is open. |
| Prop | Type | Default | Description |
|---|---|---|---|
noticeOptional | SessionNotice | null | No default | The last server notice (plan limit, demo cap, expiring test key). Not an error — the session is ending gracefully, and notice.message is written for your users. |
healthOptional | ConnectionHealth | No default | Live connection health. health.concern is the blame-resolved state to render from (null when all is well). |
transcriptOptional | TranscriptEntry[] | No default | Conversation lines, oldest first. Empty unless transcript.enabled. |
availableActionsOptional | string[] | No default | Gesture names the loaded rig advertises. Pass one to triggerAction(). |
Start the avatar session. In call mode, this opens a WebSocket connection and requests microphone permission. In tts and audio modes, the connection is established automatically upon loading; start() can be used to re-connect if the session was manually stopped.
Close the session and disconnect from the server.
Immediately stop the avatar mid-sentence. The avatar returns to listening state.
tts mode only. Send a text string — the avatar speaks it with full lip-sync.
audio mode only. Feed raw audio data. The avatar lip-syncs to it.
player mode only. Play a pre-rendered AvatarSpeech job — no server connection needed.
call mode (requires an open WebSocket). Inject real-time context into the AI's conversation — useful for telling the avatar what the user is currently doing in the app.
Argument shape:
If there is no live session, the context is dropped and a non-fatal NOT_CONNECTED error is emitted. If context is empty or exceeds 2000 characters, a non-fatal INVALID_INPUT error is emitted. Neither ends the session.
For one-off subscriptions in a useEffect. For most cases, prefer useAvatarEvent — it cleans up automatically.
Mode-specific methods (speakText, speakAudio, play, addLiveContext) return undefined when called in the wrong mode. Always use optional chaining: speakText?.("hello").