Skip to main content
Version: 2.x.x

useParticipantHook Properties - React Native

displayName​

  • type : string
  • displayName represents the name of the Participant

participant​

  • type : Participant | null
  • The Participant object. It is null until the participant is in the room.

webcamStream​

  • type : RTCStream or null
  • The participant's camera stream. Render it with new MediaStream([webcamStream.track]).toURL() as the streamURL of RTCView.
import { MediaStream, RTCView, useParticipant } from "@videosdk.live/react-native-sdk";

function ParticipantView({ participantId }) {
const { webcamStream, webcamOn } = useParticipant(participantId);

return webcamOn && webcamStream ? (
<RTCView
streamURL={new MediaStream([webcamStream.track]).toURL()}
objectFit="cover"
style={{ flex: 1 }}
/>
) : null;
}

micStream​

  • type : RTCStream or null
  • The participant's microphone stream.

screenShareStream​

  • type : RTCStream or null
  • The participant's screen-share stream. Render it the same way as webcamStream.

screenShareAudioStream​

  • type : RTCStream or null
  • screenShareAudioStream represents the stream of the audio shared with the participant's screen share, when that audio is sent as a separate stream.
  • On Android, the audio of a screen share started with this SDK is mixed into the mic stream, so others receive it in micStream.

webcamOn​

  • type : boolean
  • webcamOn is true if the participant's video is on else false

micOn​

  • type : boolean
  • micOn is true if the participant's mic is on else false

screenShareOn​

  • type : boolean
  • screenShareOn is true if the participant is presenting screen else false

isLocal​

  • type : boolean
  • isLocal is true if the participant is local participant else false.

isActiveSpeaker​

  • type : boolean
  • isActiveSpeaker is true if the participant is active speaker else false.

videoQuality​

  • type : "low" | "med" | "high" | undefined
  • The quality layer this device receives for the participant's video. Ask for another layer with setQuality().

pinState​

  • type : { cam: boolean, share: boolean }
  • pinState shows whether the participant's camera (cam) and screen share (share) are pinned. Use pin() and unpin() to change it.
  • The Participant object also has pinState.

mode​

  • type : "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"
  • mode represents the participant's mode in the room. It changes when the participant calls changeMode().

metaData​

  • type: Object

  • It represents the additional information that you have passed in the metaData of the RoomProvider config.


isAgent()​

  • type : () => boolean
  • Returns true when the participant is an AI agent. Use useAgentParticipant() for agents.

Participant object​

participant here, the values in useRoom().participants, useRoom().localParticipant and the Participant that callbacks such as onParticipantJoined receive are all Participant objects. Their fields read the current value each time. In a component, prefer the properties of useParticipant(), which re-render when they change.

MemberDescription
idThe participant's id.
displayName, metaData, isLocal, modeThe same as the properties above.
isAgentboolean: true for an AI agent. On this object it is a value, not a function.
micOn, webcamOn, screenShareOnThe same as the properties above.
streamsMap<string, RTCStream>: the participant's streams, by stream id.
pinState{ cam, share }: what is pinned for this participant. It updates with onPinStateChanged.
setScreenShareQuality(quality)Sets the quality of this participant's screen share that you receive: "low", "med" or "high". Returns Promise<void>.

It also has the methods of useParticipant().

Got a Question? Ask us on discord