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

Update some docstrings #1054

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion packages/react/src/context/participant-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <ParticipantContext.Provider value={participant}>
* {children}
* </ParticipantContext.Provider>
* ```
*
* Hooks to read the `Participant` from the context include {@link useParticipantContext}, {@link useMaybeParticipantContext}, and {@link useEnsureParticipant}.
*
* @public
*/
export const ParticipantContext = React.createContext<Participant | undefined>(undefined);

/**
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/hooks/useParticipantTracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading