post https://apis.elai.io/api/v1/streams/render/
Once the connection is established, use RTCPeerConnection.ontract() event to obtain a video stream and attach it to your video HTML object:
const video = document.createElement('video')
peerConnection.ontrack = (event) => {
const [remoteStream] = event.streams
video.srcObject = remoteStream
}
The final step is to send a string with text that avatar will say:
const text = "Welcome to Elai real-time API"
await fetch(`https://apis.elai.io/api/v1/streams/render/${streamId}`, {
method: "POST",
headers: {
Authorization: `Bearer ${SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text })
})