Step 1: Install Dependencies
Install the SDK.Step 2: Initialize
Create an instance of theAvaturnHead
class and initialize it with an optional configuration.You need to pass a session token obtained from this endpoint (it must be used in the backend). Make sure to correctly pass a reference to the DOM element (
domElement
) depending on your framework (e.g., use ref
in React or Vue, @ViewChild
in Angular, etc.).
Step 3: Send Tasks
Use thetask
method to send speech requests. If the avatar is already speaking, the text fragment is queued to be spoken at a later time. Nothing is said while you’re disconnected.
Step 4: Subscribe to Events
Register event listeners to handle specific events during the session.Step 6: Dispose
When you are done with the session, make sure to call thedispose
method to clean up resources.