let avatar = try await AvatarManager.shared.load(id: "AVATAR_ID") { progress in print("Loading: \(progress)")}
val avatar = AvatarManager.load("AVATAR_ID") { progress -> Log.d("Avatar", "Loading: $progress")}
Loaded assets are cached locally. Subsequent loads for the same avatar ID skip the download. Use AvatarManager.clear(id:) or clearAll() to manage cache.
Create an AvatarView with the loaded avatar. The view automatically creates an AvatarController you can access to manage the connection and send audio.
Web
iOS
Android
const avatarView = new AvatarView(avatar, containerElement);const controller = avatarView.controller;
let avatarView = AvatarView(avatar: avatar)let controller = avatarView.controller
val avatarView = AvatarView(context)avatarView.init(avatar, lifecycleScope)val controller = avatarView.controller
Call controller.start() to open the WebSocket connection. Once connected, send audio with controller.send() (SDK Mode) or controller.yield() (Host Mode).Call controller.interrupt() to stop the current playback immediately. Call controller.close() when done.
Clean up resources when the avatar is no longer needed.
Web
iOS
Android
avatarView.dispose();
// AvatarView automatically releases resources when removed from the view hierarchy.// No explicit cleanup call needed.
avatarView.dispose()
On Web and Android, always call avatarView.dispose() when the view is no longer needed. On iOS, resources are released automatically when the view is deallocated.