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:
| Name | Required | Type | Description |
|---|---|---|---|
filter | string | 'local' | 'remote' | 'screen' | 'owner' | 'record' | FilterParticipantsFunction, filters the list of participant ids according to the provided criteria | |
onActiveSpeakerChange | Function | Callback for the active-speaker-change event | |
onParticipantJoined | Function | Callback for the participant-joined event | |
onParticipantLeft | Function | Callback for the participant-left event | |
onParticipantUpdated | Function | Callback for the participant-updated event | |
sort | string | 'joined_at' | 'session_id' | 'user_id' | 'user_name' | SortParticipantsFunction, sorts the list of participant ids according to the provided criteria |
filter options
| Value | Type | Description |
|---|---|---|
'local' | string | Returns only the local participant |
'remote' | string | Returns remote participants, everybody but local |
'screen' | string | Returns participants with active screen shares |
'owner' | string | Returns participants who joined the call with a meeting token that has the is_owner property set to true |
FilterParticipantsFunction | Function | Specifies 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
| Value | Type | Description |
|---|---|---|
'joined_at' | string | Sorts by when participants joined the call in ascending order. |
'session_id' | string | Sorts by participant session_ids |
'user_id' | string | Sorts by participant user_ids |
'user_name' | string | Sorts in alphabetical order by participant user_name |
SortParticipantsFunction | Function | Specifies 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
| Type | Description |
|---|---|
string[] | An array of string participant ids |
Sample code
Related references
- useActiveParticipant()
- useActiveSpeakerId()
- useLocalParticipant()
- useLocalSessionId()
- useParticipantCounts()
- useParticipantProperty()
- useParticipant()
- useWaitingParticipants()