useParticipantIds

useParticipantIds(params?): string[];

useParticipantIds returns a list of participant ids based on optional parameters. It can be used to render groups, grids, or lists containing participant data or tracks.

If no parameters are provided, the ids of all participants in the call are returned.

Params (optional)

An object with the following properties:

NameRequiredTypeDescription
filterstring'local' | 'remote' | 'screen' | 'owner' | 'record' | FilterParticipantsFunction, filters the list of participant ids according to the provided criteria
onActiveSpeakerChangeFunctionCallback for the active-speaker-change event
onParticipantJoinedFunctionCallback for the participant-joined event
onParticipantLeftFunctionCallback for the participant-left event
onParticipantUpdatedFunctionCallback for the participant-updated event
sortstring'joined_at' | 'session_id' | 'user_id' | 'user_name' | SortParticipantsFunction, sorts the list of participant ids according to the provided criteria

filter options

ValueTypeDescription
'local'stringReturns only the local participant
'remote'stringReturns remote participants, everybody but local
'screen'stringReturns participants with active screen shares
'owner'stringReturns participants who joined the call with a meeting token that has the is_owner property set to true
FilterParticipantsFunctionFunctionSpecifies custom filtering for the list of ids. The full Daily participant object can be referenced

String-based filters can be directly calculated from our internal state store and therefore provide a better render performance than a custom filter that needs to be evaluated at runtime.

sort options

ValueTypeDescription
'joined_at'stringSorts by when participants joined the call in ascending order.
'session_id'stringSorts by participant session_ids
'user_id'stringSorts by participant user_ids
'user_name'stringSorts in alphabetical order by participant user_name
SortParticipantsFunctionFunctionSpecifies custom sorting for the list of ids. The full Daily participant object can be referenced

String-based sorting can be directly calculated from our internal state store and therefore provide a better render performance than a custom sort function that needs to be evaluated at runtime.

Return type

TypeDescription
string[]An array of string participant ids

Sample code

Related references