<dxr-npc>

DeepXRLab AI NPC Web Component

API

<dxr-npc>

DeepXRLab AI NPC Component

Attributes

NameDescriptionTypeDefault
api-originAPI Originstring"https://dxrainpc.aiware.io"
room-idThe value obtained through `POST /api/rooms` API callstring""
auto-connectWhether the dxr-npc component should start connecting as soon as it is initialized.booleanfalse
spinner-sizeSize of the loading spinner.number64
show-unmuteShow the unmute button when muted.booleanfalse

Methods

NameParametersDescriptionReturn
disconnectDisconnect from the server. Video and audio will be stopped. Calling this method will immediately release server's resources and make reconnection impossible. It is recommended to call it when leaving the page.
updateRoom
NameDescriptionType
dataThe parameters to update the room. (e.g. `{"npc": {"template": "woman"}}`)string
Send room modification data to NPC Studio. The data should be a valid JSON string.
speak
NameDescriptionType
msgThe text to speakstring
Let NPC speak the `msg` so that generated audio will be played with lip-sync animation.
unmuteUnmute the audio. (When the webpage is initially loaded, it is muted by default, and it can be unmuted after user interaction.) Call this method only after the user interaction, otherwise it will not work.
connectConnect to the server. apiOrigin and roomId must be set before calling this method.

Events

NameDescription
connectedFires when the connection made (Video will start playing soon)
chatFires when a chat message received
warnFires when unexpected situation happened which can be ignored
errorFires when something went wrong