We are using the javascript web-client sdk and nee...
# ask-ai
r
We are using the javascript web-client sdk and need to know if we can somehow get the state of a user (speaking or listening). We are using noise cancellation both on the client (outbound) and on the server side (inbound), meaning we only want the actual noise cancellation cleaned talking state.
t
Thanks for reaching out, Brian. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — regarding whether you can get a user’s speaking/listening state in the JavaScript web-client SDK (while using client- and server-side noise cancellation): Yes. You can detect speaking state and audio level after noise suppression: • Use participant
isSpeaking
and the
ParticipantEvent.IsSpeakingChanged
event:
Copy code
participant.on(ParticipantEvent.IsSpeakingChanged, (speaking: boolean) => {
  console.log(`${participant.identity} is ${speaking ? 'speaking' : 'silent'}`);
});
• Or track active speakers for the room with `RoomEvent.ActiveSpeakersChanged`:
Copy code
room.on(RoomEvent.ActiveSpeakersChanged, (speakers: Participant[]) => {
  // speakers = currently active speakers
});
• For finer control, read
participant.audioLevel
(0.0–1.0) to inspect volume after processing. These signals operate on the processed audio stream, so they reflect voice activity after noise cancellation. If you want, tell me whether you need code examples for subscribing to participants, using this in React (hooks), or smoothing audioLevel values for UI. Sources: Subscribing to tracks | LiveKit docs