diff --git a/packages/react/src/context/participant-context.ts b/packages/react/src/context/participant-context.ts index 425f5653f..06812e4c5 100644 --- a/packages/react/src/context/participant-context.ts +++ b/packages/react/src/context/participant-context.ts @@ -2,7 +2,24 @@ import type { Participant } from 'livekit-client'; import * as React from 'react'; import { useMaybeTrackRefContext } from './track-reference-context'; -/** @public */ +/** + * Provides a `Participant` to the component tree. Used by {@link useParticipantAttributes}, {@link useParticipantTracks}, and {@link useParticipantInfo}. + * + * This context is provided automatically by the {@link ParticipantLoop} and {@link ParticipantTile} components. + * + * You may also provide one explicitly with {@link ParticipantContext.Provider}. + * + * @example + * ```tsx + * + * {children} + * + * ``` + * + * Hooks to read the `Participant` from the context include {@link useParticipantContext}, {@link useMaybeParticipantContext}, and {@link useEnsureParticipant}. + * + * @public + */ export const ParticipantContext = React.createContext(undefined); /** diff --git a/packages/react/src/hooks/useParticipantTracks.ts b/packages/react/src/hooks/useParticipantTracks.ts index e79266e4f..c66cba81f 100644 --- a/packages/react/src/hooks/useParticipantTracks.ts +++ b/packages/react/src/hooks/useParticipantTracks.ts @@ -6,8 +6,11 @@ import type { Track } from 'livekit-client'; import { useMaybeParticipantContext, useRoomContext } from '../context'; /** - * `useParticipantTracks` is a custom React that allows you to get tracks of a specific participant only, by specifiying the participant's identity. - * If the participant identity is not passed the hook will try to get the participant from a participant context. + * Hook to acquire the tracks of a specific participant only. By default the hook will look in the component tree for a {@link ParticipantContext}. + * To specify a different participant, pass their `identity`. + * + * You may also filter the returned tracks by `Source` (e.g. `Camera`, `Microphone`, `ScreenShare`, etc). + * * @public */ export function useParticipantTracks(