Valora
API Reference@valora-ai/reactindexFunctions

useIsSpeaking

function useIsSpeaking(participant?): boolean;

Defined in: packages/react/src/hooks/track/useIsSpeaking.ts:37

The useIsSpeaking hook returns a boolean that indicates if the participant is speaking or not.

Parameters

ParameterType
participant?unknown

Returns

boolean

Example

// Basic — read whether a participant is speaking.
const isSpeaking = useIsSpeaking(participant);

// Advanced — highlight active speakers in a participant list.
function SpeakerRow({ participant }: { participant: Participant }) {
  const isSpeaking = useIsSpeaking(participant);
  return <span data-speaking={isSpeaking}>{isSpeaking ? "Speaking" : "Quiet"}</span>;
}

function SpeakerRows() {
  const participants = useParticipants();
  return participants.map((participant, index) => (
    <SpeakerRow key={index} participant={participant} />
  ));
}

function SpeakerList() {
  return <VoiceRoom agent={agent}><SpeakerRows /></VoiceRoom>;
}

On this page

Valora is local-first

No API key, no server — everything in this doc runs on-device.

Star on GitHub