useActiveSpeakerId

useActiveSpeakerId(params?) : string | null

Returns the participant's session_id mentioned in the most recent 'active-speaker-change' event. Use this property to limit active speakers returned from this hook to subgroups.

Apply a filter to limit which participants should be considered as active speakers.

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

Params (optional)

ParameterTypeDescription
filterFunctionCallback function to filter which participants should be considered as active speakers by this hook instance. Return true to allow the passed session_id to become the next active speaker.
ignoreLocalbooleanIf true, useActiveSpeakerId will ignore when the local participant is the active speaker
onActiveSpeakerChangeFunctionEvent callback for 'active-speaker-change' event listener

Return type

TypeDescription
string | nullThe active speaker's session_id. If no participant has unmuted, useActiveSpeakerId returns null

Sample code

Related references