Lifecycle
init()
Initializes the session and connects to the avatar room. Returns a Promise that resolves when the avatar’s video track is ready, or rejects on failure. If immediatelyJoin is true (default), init() calls join() automatically.
join()
Connects to the avatar room. Called automatically by init() unless immediatelyJoin: false. Use this when you want manual control over the moment of connection.
Start with microphone muted. Defaults to the SDK config’s
startAudioOff.dispose()
Terminates local SDK state — destroys the Daily call object and aborts pending requests. Does not close the backend session directly; the backend session ends via user_absent_timeout (default 60s) or an explicit DELETE /api/v1/sessions/{id}. Call this on unmount.
attachDOMNode(node)
Moves the avatar video into a different DOM element without re-initializing. Also use this when you constructed AvaturnHead without a DOM element and now want to render it. Takes effect after init() has resolved.
New container for the avatar video.
Events
on(event, callback) / off(event, callback)
Subscribe to or unsubscribe from SDK events. See Events for the full list.
Event name.
Handler invoked when the event fires.
Media devices
requestMediaDevices()
Returns the list of available media devices (microphones, speakers, cameras).
setInputDevices({ audioDeviceId?, videoDeviceId? })
Selects input devices for the session. Pass only the keys you want to change — both fields are optional at runtime. Use false or null to disable a device.
Microphone device id from
requestMediaDevices().Camera device id. Most integrations leave this unset — the avatar’s video comes from the server, not the user’s camera.
DailyDeviceInfos from the underlying transport.
setOutputDevice({ outputDeviceId })
Selects the speaker for avatar audio output. Always pass outputDeviceId.
Device id from
requestMediaDevices().If
outputDeviceId is omitted, the SDK silently returns the list of input devices instead of switching output. Always pass outputDeviceId explicitly.DailyDeviceInfos.
toggleLocalAudio(value?)
Mutes or unmutes the user’s microphone. With no argument, toggles the current state.
true = unmute, false = mute.Legacy: text-echo
task(text)
Sends text for the avatar to speak. If the avatar is already speaking, the fragment is queued. Returns { task_id: string }.
The text to speak.
cancelAllTasks()
Stops the current utterance and clears the queue.
changeVoice(config)
Switches the text-echo TTS voice for subsequent task() calls. Patches the session’s conversation engine config to a new text-echo config with the supplied TTS.
{ engine: "elevenlabs", voice_id: string }. Only elevenlabs is currently accepted by the backend.