Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [VID-315] allow filtering participants using filter object #1655

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

myandrienko
Copy link
Contributor

@myandrienko myandrienko commented Jan 24, 2025

This PR adds support for filtering participants using a filter object instead of a predicate. Filter object looks something like this:

// Render video only from pinned participants
// or participants with the role "presenter"
{
  $or: [
    { isPinned: true },
    { roles: { $contains: 'presenter' } },
  ],
}

(For more examples of what kinds of operators we allow, see filters.test.ts.)

Filtering is supported for a subset of participant properties:

  • userId: string
  • isSpeaking: boolean
  • isDominantSpeaker: boolean
  • name: string
  • roles: string[]
  • isPinned: boolean

SpeakerLayout and PaginatedGridLayout now accept filter objects in their filterParticipants prop:

<SpeakerLayout
  filterParticipants={{
    $or: [
      { roles: { $contains: 'student' } },
      { isPinned: true },
    ],
  }}
/>

This is particularly useful for the composite app, because a filter object (unlike a predicate) can be passed in configuration. So the new optional configuration option is added to the composite app: participant.filter. It is supported by built-in layouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant