useActiveParticipant
Deprecated

useActiveParticipant(params?) : Object | null

Returns an object for the participant id mentioned in the most recent active-speaker-change event.

useActiveParticipant can also set up an optional callback for the active-speaker-change event.

Params (optional)

ParameterRequiredTypeDescription
ignoreLocalbooleanIf true, useActiveParticipant will not return a participant object when the local participant is the active speaker
onActiveSpeakerChangeFunctionevent callback for active-speaker-change event listener

Return type

TypeDescription
Object | nullContains detailed information about the participant, see participant properties. If no participant has unmuted, useActiveParticipant returns null

Sample code

import { useActiveParticipant } from '@daily-co/daily-react';
export const CurrentSpeaker = () => {
const activeSpeaker = useActiveParticipant();
return (
<div>{activeSpeaker?.user_name ?? 'Nobody'} is currently speaking.</div>
);
};

Related references