Avatar Control
stopSpeaking()
Immediately stops the avatar's current speech.
js
SDK.stopSpeaking();Calling speak() / sendMessage() right after stopping
If you call speak() or sendMessage() immediately after stopSpeaking(), the server may not process the request. Wait for the RESPONSE_ENDED signal first.
js
let pendingText = null;
SDK.onSignal((data) => {
if (data.signal === 'RESPONSE_ENDED' && pendingText) {
SDK.speak(pendingText);
pendingText = null;
}
});
function stopAndSpeak(text) {
pendingText = text;
SDK.stopSpeaking();
}setVolume(volume)
Sets the avatar's voice volume.
js
SDK.setVolume(50); // 0 ~ 100| Parameter | Type | Description |
|---|---|---|
volume | number | Volume (0 ~ 100) |
getStatus()
Returns the current SDK connection status.
js
const status = SDK.getStatus();
// 'IDLE', 'CONNECTED_FINISH', ...