i
hi
t
Thanks for reaching out, Raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — thanks for reaching out. How can I help you today with LiveKit? You can tell me: • what you're trying to build (web, iOS, Android, server), • any error messages or unexpected behavior, or • if you need help with setup, SDKs, rooms, or tokens.
i
what project url used for
t
You're asking what the LiveKit "project URL" is used for — here's the short answer. The project URL is the WebSocket address clients use to connect to your LiveKit project (for example
wss://your-project.livekit.cloud
). It's used to: • Connect participants to rooms via client SDKs. • Route real‑time audio, video, and data to the correct LiveKit server instance. • Be the value for environment variables like
LIVEKIT_URL
in your apps and server code. • Be paired with an access token when authenticating/joining a room. If you want, tell me where you plan to use it (web, iOS, Android, or server) and I’ll give the exact example or config line. Sources: Mini tutorial: setting up a LiveKit Cloud project | Rust SDKs | livekit/livekit_composite | DeepWiki | LiveKit CLI Setup | LiveKit Docs
i
when creating a room i wud be needing that i guess?
t
Yes — you will need the project URL when creating or joining rooms. • If you create rooms via the REST API or server SDK, use the project URL as the base endpoint to call the room creation endpoints. • If clients (web/iOS/Android) join a room, they connect to the project URL (e.g.,
wss://your-project.livekit.cloud
) and present an access token to authenticate and join. Tell me which platform you’re using (web, iOS, Android, or server) and I’ll give the exact example or config line.
i
nodejs
t
Regarding Node.js: you use the project URL as the LiveKit server endpoint when your server creates rooms or issues tokens, and when clients connect. Quick Node.js examples: 1) Creating a room with the LiveKit REST API (using project URL as base):
Copy code
const fetch = require('node-fetch');
const LIVEKIT_URL = 'https://your-project.livekit.cloud'; // project URL (HTTP)
const API_KEY = 'your_api_key';
const API_SECRET = 'your_api_secret';

async function createRoom(roomName) {
  const res = await fetch(`${LIVEKIT_URL}/rpc/createRoom`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${createAdminToken(API_KEY, API_SECRET)}`,
    },
    body: JSON.stringify({ name: roomName }),
  });
  return res.json();
}
2) Using the LiveKit Node SDK to issue join tokens (server-side):
Copy code
const { AccessToken } = require('livekit-server-sdk');
const LIVEKIT_URL = 'https://your-project.livekit.cloud'; // used for API calls/tokens
const API_KEY = 'your_api_key';
const API_SECRET = 'your_api_secret';

function createJoinToken(roomName, identity) {
  const at = new AccessToken(API_KEY, API_SECRET, { identity });
  at.addGrant({ room: roomName }); // grant to join this room
  return at.toJwt();
}
3) Client connection (what your web/mobile clients will use): • Clients connect to the WebSocket project URL (starts with
wss://
), e.g.
wss://your-project.livekit.cloud
, and present the join token generated above. If you want, I can: • Show exact code using the official LiveKit Node SDK (room creation + token generation), or • Help replace placeholders with your config and keys for a working snippet. Which would you prefer?
i
Unauthorized: object cannot be found at TwirpRpc.request (C\Users\MalayarajMaity\IG repos\genai trial\4hira avatar\backend\node modules\livekit server sdk\dist\TwirpRPC.cjs96:13) at process.processTicksAndRejections (nodeinternal/process/task queues105:5) at async RoomServiceClient.createRoom (C\Users\MalayarajMaity\IG repos\genai trial\4hira avatar\backend\node modules\livekit server sdk\dist\RoomServiceClient.cjs49:18) at async createLiveKitRoom (C\Users\MalayarajMaity\IG repos\genai trial\4hira avatar\backend\src\services\livkit custom.services.js35:21) at async setupInterviewController (C\Users\MalayarajMaity\IG repos\genai trial\4hira avatar\backend\src\controllers\livkit custom.controller.js122:9) { status: 401, code: 'unauthenticated', metadata: undefined }
t
You're getting a 401 unauthenticated when calling RoomService.createRoom — I'll help troubleshoot. Check these things first: 1. Confirm API key & secret • Ensure the API key and API secret you pass to the server SDK exactly match the project credentials from the dashboard (no extra spaces, correct key for that project). 1. Use the correct project URL (HTTP vs WebSocket) • For server SDK / REST calls, use the HTTPS project URL (e.g.,
https://your-project.livekit.cloud
) as the API base. • For client connections use the
wss://
URL. Using the wrong scheme can cause authentication failures. 1. Ensure the SDK client is initialized with the right base URL • If you’re using the RoomServiceClient from the Node SDK, confirm the client was created with the project HTTP URL and not an empty/incorrect URL. 1. Check token vs API key usage • Creating rooms with the server SDK requires API key/secret authentication (admin token) — not a client join token. • Make sure you’re generating an admin JWT (or passing API key/secret into the SDK) rather than a participant join token. 1. Verify project scope • Ensure the API key/secret belong to the same LiveKit project whose URL you’re calling. If you want, paste (with secrets redacted) the lines where you: • set
LIVEKIT_URL
,
API_KEY
,
API_SECRET
, and • initialize the RoomServiceClient or call
createRoom
and I’ll point out any specific issues.
i
avatarMap is not defined
t
You're right to flag this — "avatarMap" is not a LiveKit builtin; it's a variable in your app that's currently undefined. I can help fix it, but I need a bit more context. Please paste the small code snippet where
avatarMap
is used (and where you expect it to be created). Also tell me: • Is this error in your Node.js backend or in frontend code? • Do you expect
avatarMap
to be a
Map
, object, or array? If you’d rather, here are quick fixes you can try now: • Declare and initialize at the appropriate scope:
Copy code
// backend or top-level module scope
const avatarMap = new Map();
or
Copy code
// if using a plain object
const avatarMap = {};
• Ensure the declaration runs before any code that reads/writes
avatarMap
. • If the variable should persist per-room or per-session, initialize it where you manage room state (not inside a narrower function). Share the snippet and where it runs and I’ll point out the exact change. Sources: Android quickstart | LiveKit docs | Virtual avatar plugins | LiveKit Docs
i
function generateLiveKitToken(roomName, identity) { try { const at = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, { identity, }); at.addGrant({ roomJoin: true, room: roomName, canPublish: true, canSubscribe: true, }); return at.toJwt(); } catch (error) { console.log('>>>>>>>>>>>>>>>GENERATE TOKEN', error); } } this is not returning any token
t
You're close — the issue is that
toJwt()
is asynchronous and your function must await it and ensure credentials are present. Responding to your snippet: this is why it returns nothing and swallows errors. Please update to this async version and confirm your env vars are loaded:
Copy code
import { AccessToken } from 'livekit-server-sdk';
import dotenv from 'dotenv';
dotenv.config();

const LIVEKIT_API_KEY = process.env.LIVEKIT_API_KEY;
const LIVEKIT_API_SECRET = process.env.LIVEKIT_API_SECRET;

async function generateLiveKitToken(roomName, identity) {
  try {
    if (!LIVEKIT_API_KEY || !LIVEKIT_API_SECRET) {
      throw new Error('Missing LIVEKIT_API_KEY or LIVEKIT_API_SECRET');
    }

    const at = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, { identity });

    at.addGrant({
      roomJoin: true,
      room: roomName,
      canPublish: true,
      canSubscribe: true,
    });

    const token = await at.toJwt();
    return token;
  } catch (error) {
    console.error('GENERATE TOKEN ERROR:', error);
    throw error;
  }
}
Checklist: • Confirm
.env
is loaded (call
dotenv.config()
once at app entry). • Verify
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
are correct (no extra spaces). • Call the function with
await
, e.g.
const token = await generateLiveKitToken('room', 'user1')
. • Check console for the explicit error if it still fails. If you still get an error, paste the exact console output (redacting secrets) and I'll help debug further. Sources: Authentication | LiveKit docs | Generating tokens | LiveKit docs
i
"Request validation errors. body -> CUSTOM -> livekit_config -> livekit_url: Field required; body -> CUSTOM -> livekit_config -> livekit_room: Field required; body -> CUSTOM -> livekit_config -> livekit_client_token: Field required"
t
That error means the request body you’re sending is missing three required fields:
livekit_config.livekit_url
,
livekit_config.livekit_room
, and
livekit_config.livekit_client_token
. What each field should contain: • `livekit_url`: the project HTTP/WS URL for your LiveKit deployment (for server calls use `https://your-project.livekit.cloud`; clients connect with
wss://your-project.livekit.cloud
). • `livekit_room`: the room name you want the client to join (string). • `livekit_client_token`: a join token generated by your server (use the AccessToken flow we fixed earlier — this is the client JWT, not your API secret). Next steps — pick one: • I can show an example JSON body you should send. • I can show a Node.js snippet that builds these fields and returns them to the client. Which would you like? Also paste the request payload you’re currently sending (redact secrets) and I’ll point out exactly what to change.
i
method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ mode: "CUSTOM", avatar_id: "073b60a9-89a8-45aa-8902-c358f64d2852", avatar_persona: { voice_id: "e948b062-7dce-4f2b-bcf6-98bd3511106b", context_id: "b9fb8ecd-2420-4d85-ad15-4be7db897e9f", language: "en", }, livekit_config: { livekit_url: roomData?.serverUrl, livekit_room: roomData?.roomName, livekit_client_token: roomData?.avatarToken } }) });
t
You're sending
roomData?.serverUrl
,
roomData?.roomName
, and
roomData?.avatarToken
— the validation error means one or more of those are undefined at the time you build the request. Quick checks and fixes: 1. Verify
roomData
is populated before sending • Log
roomData
right before the fetch:
Copy code
console.log('roomData:', roomData);
• If any of
serverUrl
,
roomName
, or
avatarToken
are undefined, wait for the code that creates the room/token to finish. 1. Ensure token generation is awaited (server call) • The function that creates the join token must be
async
and awaited. Example:
Copy code
const roomData = await createRoomAndToken(...); // returns { serverUrl, roomName, avatarToken }
1. Send only when all fields exist • Quick guard:
Copy code
if (!roomData?.serverUrl || !roomData?.roomName || !roomData?.avatarToken) {
  throw new Error('Missing LiveKit config values');
}
1. Example correct body
Copy code
body: JSON.stringify({
  mode: "CUSTOM",
  avatar_id: "073b60a9-89a8-45aa-8902-c358f64d2852",
  avatar_persona: { /* ... */ },
  livekit_config: {
    livekit_url: "https://your-project.livekit.cloud", // or serverUrl
    livekit_room: "room-name",
    livekit_client_token: "eyJhbGciOi..." // join token string
  }
})
If you want, paste the
console.log('roomData:', roomData)
output (redact secrets) and I’ll point out exactly which field is missing and why.
i
{ "session_id": "aa93b00d-797b-4998-a7ba-7783e0f5a38a", "livekit_url": null, "livekit_client_token": null, "max_session_duration": 1200, "ws_url": "wss://webrtc-signaling.heygen.io/v2-alpha/interactive-avatar/session/639481f8-d459-11f0-8f22-1ef94f6646a5" }
t
Thanks — I see
livekit_url
and
livekit_client_token
are null in your payload. That’s why the request validation failed. What to do next: 1. Ensure your server creates the LiveKit room and join token before sending the request. 2. Populate these fields from the room creation result: ◦
livekit_url
— use the HTTP project URL (e.g.
https://your-project.livekit.cloud
) or the
serverUrl
returned by your create-room call. ◦
livekit_client_token
— the join token (JWT) generated with
AccessToken
and
await at.toJwt()
. ◦
livekit_room
— the room name returned by your server. Example Node.js flow (outline): 1. create room / token on server -> returns
{ serverUrl, roomName, avatarToken }
2. ensure you await that call 3. send request with:
Copy code
livekit_config: {
  livekit_url: "https://your-project.livekit.cloud",
  livekit_room: "room-name",
  livekit_client_token: "eyJ..."
}
Quick checks you can do now: • Log the room creation result right before building the fetch body:
console.log('roomData:', roomData)
. • Confirm the server-side function that returns
avatarToken
is async and you call it with
await
. • Verify
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
are set and the token generation uses
await at.toJwt()
. If you paste the server function that creates the room/token (redact secrets), I’ll point out exactly where to await or fix the values.
t
That URL is a WebSocket signaling endpoint for an interactive-avatar session — it’s where a client opens a WebSocket (wss://) connection to exchange real‑time signaling with the avatar system (session ID is included in the path). What it means and how it’s used: • wss:// — secure WebSocket protocol used for real‑time signaling. • Host/path — the service (heygen.io) and the API path for interactive avatar sessions. • Session ID in path — identifies the specific avatar session (so messages are routed to that session). • Purpose — clients use this endpoint to send/receive session events, SDP/ICE signaling, and other real‑time messages needed to establish and run the WebRTC/interactive avatar experience. How it differs from your LiveKit URL: • This is a signaling endpoint specific to the avatar provider (heygen). • LiveKit URLs (wss://your-project.livekit.cloud or https://your-project.livekit.cloud for API calls) connect clients to LiveKit rooms for audio/video/data routing and use LiveKit tokens for auth. • You may need both: the avatar signaling WS for avatar control/events and LiveKit for media transport, or the avatar service might proxy media through its own signaling depending on your integration. If you want, tell me whether you’re connecting to this from the client or server and I’ll show the minimal code to open the WebSocket or how to map this session to a LiveKit room.
i
avatar joined it how do user will use it in react component to join
t
You're asking how a user (in React) should join the avatar session — specifically using the LiveKit room and/or the avatar WebSocket. Below are minimal, actionable steps and a compact React example showing both: connecting to LiveKit with the join token and opening the avatar signaling WebSocket if needed. What you need from your server (passed to the client): • livekit_url (wss:// or https:// project URL for clients use
wss://...
) • livekit_room (room name string) • livekit_client_token (join JWT generated server-side) Client-side steps: 1. Ensure your server returns those three fields (not null). 2. In React, use the LiveKit SDK to connect to the room with the token. 3. If the avatar service requires a separate signaling WS, open a WebSocket to the avatar URL and exchange messages per their protocol. Minimal React example (uses @livekit/client):
Copy code
import React, { useEffect, useState } from 'react';
import { connect } from 'livekit-client';

function AvatarRoom({ livekitUrl, roomName, token, avatarWsUrl }) {
  const [room, setRoom] = useState(null);

  useEffect(() => {
    if (!livekitUrl || !roomName || !token) return;

    let roomInstance;
    (async () => {
      roomInstance = await connect(livekitUrl, token, { room: roomName });
      setRoom(roomInstance);

      // attach first remote track to an element (simple example)
      roomInstance.on('participantConnected', participant => {
        participant.tracks.forEach(pub => {
          if (pub.subscribed) attachTrack(pub.track);
          pub.on('subscribed', track => attachTrack(track));
        });
      });

      function attachTrack(track) {
        if (track.kind === 'video') {
          const el = document.createElement('video');
          el.autoplay = true;
          el.playsInline = true;
          el.srcObject = new MediaStream([track.mediaStreamTrack]);
          document.getElementById('videoContainer').appendChild(el);
        }
      }
    })();

    return () => {
      if (roomInstance) roomInstance.disconnect();
    };
  }, [livekitUrl, roomName, token]);

  useEffect(() => {
    if (!avatarWsUrl) return;
    const ws = new WebSocket(avatarWsUrl);
    ws.onopen = () => console.log('Avatar WS open');
    ws.onmessage = e => console.log('Avatar message', e.data);
    ws.onclose = () => console.log('Avatar WS closed');
    ws.onerror = e => console.error('Avatar WS error', e);
    return () => ws.close();
  }, [avatarWsUrl]);

  return (
    <div>
      <div id="videoContainer" />
      {!room && <div>Connecting...</div>}
    </div>
  );
}

export default AvatarRoom;
Key notes: • Use the
wss://
LiveKit URL for client connections. If your server gave
https://
convert to
wss://
or use the provided client WS URL. • Always generate
livekit_client_token
server-side with
AccessToken
and `await at.toJwt()`; return it to the client. • The avatar WS URL is separate: open it from the client if the avatar provider expects the client to talk directly. If your server proxies avatar signaling, the client may not need to open the WS. • Render tracks by subscribing to participant tracks (or use @livekit/react-components for quicker UI). If you want, I can: • Show a full example using
@livekit/react-components
to render video/audio, or • Inspect your server code that returns those three fields and point out why
livekit_url
/ token are null. Which would help most?
i
WHY I CANT SEND voice
t
I can help — to troubleshoot quickly, I need a few details. Which of these applies and paste any short code/logs (redact secrets): 1. Are you using the React client with @livekit/client or @livekit/react-components? 2. Do you see any console errors when joining the room or when trying to publish? Share them. 3. Is microphone permission granted in the browser? (Do you get the browser permission prompt?) 4. Did your server-generated token include publish rights (
canPublish: true
/
roomJoin
)? 5. Show the code you use to publish audio (the join + publish snippet). Quick checklist to try now: • Give the client a join token that includes publish grants. • Request mic and create a local audio track, then publish it: ◦ getUserMedia({ audio: true }) → createLocalAudioTrack() → room.localParticipant.publishTrack(...) • Confirm you call publish after connect and that you await async calls. • Check browser console and LiveKit logs for permission or negotiation errors. Send the answers and the small code snippet and I’ll point out the exact fix.
i
i was able to join the room but i cant talk to avatar
t
Good — you can join the room, so connection and token basics look OK. Let’s focus on the three usual blockers that stop your voice reaching the avatar and how to check/fix each quickly. 1) Token permissions • Ensure the server-generated token includes publish audio rights. The grant must include
roomJoin
and `canPublish`/`canPublishAudio`. • Quick check: paste the server code that creates the AccessToken (redact secrets). I’ll verify the grants. 2) Publish the microphone track from the client • Joining doesn’t auto-publish audio. You must create a mic track and publish it after connect. • Minimal pattern: a. getUserMedia({ audio: true }) or use LiveKit helper to create a mic track b. await room.localParticipant.publishTrack(localAudioTrack) • Add a console.log right after publish to confirm success: console.log('mic published', localAudioTrack.sid) • Paste the React snippet you use to publish and I’ll point out exactly what to change. 3) Ensure the avatar agent subscribes to audio • The avatar worker must subscribe to participant audio (e.g., connect with auto_subscribe or explicitly subscribe). • Check avatar/agent logs to confirm it sees incoming audio tracks or STT events. • If you control the agent, ensure it calls connect(auto_subscribe=Audio) or equivalent. Quick debugging steps to run now • In browser console after joining run: console.log(room.localParticipant.tracks) console.log(Array.from(room.localParticipant.publications.values())) // confirm a published audio track exists • In browser Network/Console: look for WebRTC negotiation errors, mute events, or permission errors. • On the server/agent: search logs for incoming audio frames or errors about subscribing. If you want immediate help, paste these three things (redact secrets): • token generation code (server) • small React publish code (client) • agent/worker entrypoint or logs showing how it subscribes I’ll review and give the exact fix. Sources: server-sdk-js | livekit/livekit_composite | DeepWiki | Virtual avatar plugins | LiveKit Docs | Camera & microphone | LiveKit docs | OpenAI and LiveKit partner to turn Advanced Voice into an API
i
Copy code
{
  "room": "interview-1765215345618",
  "roomID": "",
  "participant": "candidate-1765215345618",
  "pID": "PA_dh4rREnxetjf",
  "source": "microphone",
  "muted": false,
  "enabled": true,
  "kind": "audio",
  "streamID": "0e3c04e0-baee-489c-a6e1-c64b0bbc7ef1",
  "streamTrackID": "0e3c04e0-baee-489c-a6e1-c64b0bbc7ef1"
}
t
Thanks — that publication record shows your client has an audio track created and published (kind: "audio", source: "microphone",
muted: false
,
enabled: true
). So the client side looks correct. Next steps are to verify the avatar/agent is actually receiving and processing that audio. Please check the avatar agent (or worker) with these targeted checks: 1. Agent subscription • Confirm the agent connects with audio auto-subscribe OR explicitly subscribes to participant audio. • Look for lines like
connect(auto_subscribe=Audio)
or explicit subscribe calls in the agent entrypoint. 1. Agent logs • Search the agent logs for incoming audio events, STT transcripts, or errors (e.g., "no tracks", "subscription failed", or codec/negotiation errors). • If logs show nothing for the participant
candidate-1765215345618
or the stream IDs you posted, the agent is not subscribed. 1. Participant/track mapping in the room • From server/agent side, list participants and their published tracks and match streamTrackID
0e3c04e0-...
to confirm the agent sees that stream. • Example check: inspect
room.participants
or
participant.tracks
in agent code/logs. 1. Grants & permissions (quick re-check) • Confirm the join token used by
candidate-1765215345618
included publish audio rights (
canPublish
/
canPublishAudio
). You published, so this is likely OK, but double-check server token code if agent still sees nothing. 1. Network/codec issues • Check for console or agent logs about WebRTC negotiation or unsupported codec errors. If codecs mismatch, audio may not be decodable by the agent. If you want, paste (redact secrets): • The agent/worker entrypoint snippet that calls
connect(...)
or subscribes. • A short excerpt of agent logs around the time you published (include timestamps and any errors). I’ll pinpoint the likely missing step and the exact code change needed.
i
<LiveKitRoom token={roomData?.candidateToken} serverUrl={roomData?.serverUrl} connect={true} audio={true} video={true} onConnected={() => { console.log("ROOM READY — calling egress"); // startEgress(); }} > <VideoConference /> </LiveKitRoom>
t
You're publishing audio from the client (the publication record shows an active mic track). The remaining likely blockers are token grants or the avatar agent not subscribing to audio. Please paste two server/agent snippets (redact secrets) so I can verify: 1. The code that generates
candidateToken
(AccessToken / grants). 2. The avatar/agent entrypoint where it connects/subscribes (the
connect(...)
call or subscribe logic). Quick checklist to verify while you grab those: • Token grants include
roomJoin
and `canPublish`/`canPublishAudio`. • Client publishes mic after connect (your LiveKitRoom props look fine). • Agent connects with audio auto-subscribe or explicitly subscribes to participant audio (e.g.,
connect(auto_subscribe=Audio)
). Send the two snippets and any agent logs showing subscriptions or errors and I’ll pinpoint the fix.
i
bcz of custom im getting ws_url but i cant hear from avatar or avatar cant hear me not even chat works its like we are there but we cant communicate
t
I hear you — you can join the room but neither voice nor chat works between you and the avatar. Below is a focused troubleshooting checklist and exact checks to run so we can pinpoint the break. Immediate checks (run now) 1. Token grants (server) • Confirm the join token used by both user and avatar includes: ◦ roomJoin: true ◦ canPublish (or canPublishAudio): true for the user ◦ canSubscribe: true for the avatar (and user if needed) • Paste your token-generation snippet (redact secrets) if you want me to verify. 1. Client publishes mic • Confirm client actually creates & publishes a mic track after connect. • In browser console run right after join: console.log(room.localParticipant.publications) // look for an audio publication with muted:false • If you’re using LiveKit React props only, ensure you explicitly create/publish mic (joining alone does not auto-publish). 1. Browser permissions & device • Ensure getUserMedia prompt was shown and microphone is allowed. • Test mic locally (e.g., record + play) to rule out device issues. 1. Avatar agent subscription • The avatar/worker must subscribe to participant audio. Confirm the agent connects with audio auto-subscribe or explicitly subscribes: connect(auto_subscribe=AutoSubscribe.AUDIO) // or equivalent • Check agent logs for subscription events or errors mentioning the candidate identity or streamTrackID. 1. Chat/data channel • Verify datachannel messaging is enabled and that messages are routed to the avatar: ◦ Ensure token allows data publish/subscribe if your usage requires it. ◦ On client, verify sending: room.localParticipant.dataChannels or publishData. ◦ Check agent logs for incoming messages. Debugging steps to capture evidence • Client console: after join paste outputs of: console.log(room.localParticipant.publications) console.log(Array.from(room.participants.values()).map(p => ({id: p.identity, tracks: Array.from(p.publications.values()).map(pub => pub.trackSid)}))) • Agent/server logs: search for the candidate identity and streamTrackID you shared and paste any subscription or error lines. • Use LiveKit Inspector (if available) to see participants, published tracks, and subscriptions. Common root causes and fixes • Token missing publish grant → regenerate token with canPublishAudio and use await at.toJwt(). • Client didn’t publish mic (you must create & publish local audio track) → call createMicrophoneTrack() then publish. • Avatar not subscribed → change agent connect to auto_subscribe audio or call explicit subscribe on participant tracks. • Codec/negotiation mismatch or network issues → check WebRTC negotiation errors in browser/agent logs. What I need next to diagnose immediately • Server token code (redact keys) • Small React snippet that publishes mic (or confirm you ran create/publish) • Avatar agent entrypoint / connect snippet or logs showing subscriptions Send those three items and I’ll tell you the single change needed to restore two-way voice/chat.
i
{ "exp": 1765302601, "iss": "APIPrDE25vYFWDG", "name": "client", "nbf": 1765216201, "sub": "client", "video": { "canPublish": true, "canPublishData": true, "canSubscribe": true, "room": "521b98c1-d45e-11f0-928a-465378ff853b", "roomJoin": true } } { "video": { "roomJoin": true, "room": "interview-1765216297517", "canPublish": true, "canSubscribe": true, "canPublishData": true }, "iss": "APInKwecezapWSw", "exp": 1765223498, "nbf": 0, "sub": "candidate-1765216297517" }
t
Thanks — both token payloads show
roomJoin
,
canPublish
,
canSubscribe
, and
canPublishData
, so token grants look correct. That means the likely issues are: • The avatar agent is not subscribing to your audio, or • The avatar isn't processing incoming audio (STT/config), or • The client isn't actually publishing microphone audio despite having a publication record (rare but possible if tracks aren't routed). Please do the following checks and paste results/logs (redact secrets): 1) Agent connect/subscription • Share the agent/worker entrypoint that calls
connect(...)
or any subscription code. • I need to confirm it uses audio auto-subscribe or explicitly subscribes to participant audio. 2) Agent logs • Search agent logs for the candidate identity or your streamTrackID and paste lines around the join time. Look for "subscribed", "track received", STT/transcript events, or errors. 3) Client publish verification • In the browser console after join, run: console.log(Array.from(room.localParticipant.publications.values())) console.log(room.localParticipant.getTrackPublications()) • Paste the output. Confirm there is a non-muted audio publication with a valid
sid
. 4) Datachannel/chat check • From the client, try sending a data message and confirm send/receive: room.localParticipant.publishData(new TextEncoder().encode('ping'), DataPacket_Kind.RELIABLE) • Check agent logs for incoming data messages. 5) Codec/negotiation • If agent logs show subscription but no audio frames, paste any WebRTC/codec errors from browser or agent logs. If you share the three snippets/logs (agent connect code, agent log excerpt, client publication output), I’ll point to the single change needed to restore two‑way voice and chat. Sources: Authentication | LiveKit docs | Camera & microphone | LiveKit docs | Virtual avatar plugins | LiveKit Docs | Unity quickstart (WebGL) | LiveKit docs | server-sdk-js | livekit/livekit_composite | DeepWiki
i
<LiveKitRoom token={roomData?.avatarToken} serverUrl={roomData?.serverUrl} connect={true} audio={true} video={true} onConnected={() => { console.log("ROOM READY — calling egress"); // startEgress(); }} > <VideoConference /> </LiveKitRoom>
t
You're using the avatar token to connect the avatar participant — good. Since tokens look correct and you can join, the two most likely gaps are (A) the client isn't publishing mic audio after connect, or (B) the avatar worker isn't subscribing to/processsing that audio. Do these quick checks and changes now: 1) Ensure client explicitly publishes mic after connect • In your React
onConnected
(or useEffect after connect), create & publish the mic:
Copy code
// inside onConnected or effect after room connects
async function publishMic(room) {
  try {
    const tracks = await navigator.mediaDevices.getUserMedia({ audio: true });
    const audioTrack = tracks.getAudioTracks()[0];
    // If using @livekit/client helper
    // const audioTrack = await createLocalAudioTrack();
    await room.localParticipant.publishTrack(audioTrack);
    console.log('mic published');
  } catch (e) {
    console.error('publish mic failed', e);
  }
}
• Confirm in console: run
console.log(Array.from(room.localParticipant.publications.values()))
and verify a non-muted audio publication exists. 2) Ensure avatar agent subscribes to participant audio • Agent must connect with audio auto-subscribe or explicitly subscribe to participant tracks. Example patterns: ◦ auto-subscribe (pseudo): connect(auto_subscribe=AutoSubscribe.AUDIO) • explicit subscribe: after participant appears, call subscribe on their audio publication • Check agent logs for messages like "subscribed" or "track received" for the candidate identity/streamTrackID. 3) Verify datachannel/chat • Tokens include
canPublishData
— confirm client sends a test data message and agent logs if received:
Copy code
room.localParticipant.publishData(new TextEncoder().encode('ping'), DataPacket_Kind.RELIABLE);
4) Quick debugging evidence to paste here • Browser console output after join: ◦
Array.from(room.localParticipant.publications.values())
◦
Array.from(room.participants.values()).map(p => ({id: p.identity, publications: Array.from(p.publications.values()).map(pub => ({kind: pub.kind, muted: pub.muted}))}))
• A short excerpt of agent logs around join (look for subscription or track errors). • The agent connect/entrypoint snippet that calls
connect(...)
(redact secrets). Send those three items and I will pinpoint the single change to restore two‑way audio/chat.