how to get audio level of local or remote particia...
# ask-ai
c
how to get audio level of local or remote particiant in js
t
Thanks for reaching out, Tuy. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To get the audio level of a local or remote participant in JavaScript using LiveKit, you can access the
audioLevel
property of the participant object. This property provides a value between 0 and 1, with 1 being the loudest. You can monitor audio levels when a participant is speaking by using the
IsSpeakingChanged
event:
Copy code
participant.on(ParticipantEvent.IsSpeakingChanged, (speaking: boolean) => {
  console.log(
    `${participant.identity} is ${speaking ? 'now' : 'no longer'} speaking. audio level: ${participant.audioLevel}`,
  );
});
This event handler will be triggered whenever a participant's speaking status changes, and it includes the current audio level of that participant. Sources: Subscribing to tracks | LiveKit Docs
c
what is room object or participant object? where do i get it on react: <LiveKitRoom serverUrl={serverUrl} token={participantToken} connect={shouldConnect} options={{ adaptiveStream: { pixelDensity: 'screen' } }} audio={true} video={false} >
t
I'm sorry, but I don't have the information you need at the moment. If you would like a member of the LiveKit team to respond, please ask your question in one of the other channels.
c
what is room object