Skip to main content
Version: 0.0.x

Manage Participants

1. Local Participant (self)

Local participant is used to consume your video & audio streams. it contains information about local participant such as displayName, id, quality and streams Map.

You can acces localParticipant from the meeting object.

Participant object properties

Property NameTypeDescription
idstringUnique id of the participant.
displayNamestringThe name you define during the meeting initialization.
localbooleanIndicates the participant is local or not.
qualitystringIndicates the participant streams quality.
StreamsMap of StreamReturns Video & Audio Streams.

Stream Object properties

Property NameTypeDescription
idstringUnique id
codecstringVideo/Audio codec.
kindstringStream Kind.
trackstringMediaStreamTrack

2. Other Participants (Except You)

Other participants Map is used to get all the participants (except you) in the meeting at any given time.

Other participants Map contains same properties as LocalParticipant.

Local And Other Participants

import { View } from "react-native";
import {
useParticipant,
RTCView,
MediaStream,
} from "@videosdk.live/react-native-sdk";

/** localParticipant contains Participant object
as displayed above local participant section */
const localParticipant = meeting.localParticipant;

const participants = meeting.participants;

/** Render All Participant including local participant */
{
[...participants.keys()].map((k) => (
<View>
{k.map((l) => (
<ParticipantView key={l} participantId={l} />
))}
</View>
));
}

/** Participant View Component*/

const ParticipantView = ({ participantId }) => {
/** useParticipant Hooks which accept `participantId`
as parameter then return participant properties such as displayName, webcamOn, micOn etc. */
const { displayName, webcamStream, webcamOn, micOn, isActiveSpeaker } =
useParticipant(participantId);

return (
<RTCView
streamURL={new MediaStream([webcamStream?.track]).toURL()}
style={{ flex: 1 }}
/>
);
};
  1. participant-joined - Whenever any new participant join the meeting, participant-joined event will trigger. For example, the meeting is running with Alice and Bob, then Eve join that meeting, after that participant-joined event trigger and return the participant object.

  2. participant-left - Whenever any participant leave/exit the meeting, participant-left event will trigger.For example, the meeting is running with Alice and Bob, then Bob leave that meeting, after that participant-left event trigger and return the participant object

  3. presenter-changed - Whenever any participant present/screenshare their screen/window in meeting, presenter-changed event will trigger and return the presenter participantId.

  4. stream-enabled - Whenever any participant enabled mic/webcam in meeting, stream-enabled event will trigger and return Stream Map.

  5. stream-disabled - Whenever any participant disabled mic/webcam in meeting, stream-disabled event will trigger and return Stream Map.

import { useMeeting, useParticipant } from "@videosdk.live/react-native-sdk";

/** useMeeting hooks events */
const {
/** Methods */
} = useMeeting({
onParticipantJoined: (participant) => {},
onParticipantLeft: (participant) => {},
onPresenterChanged: (presenterId) => {},
});

/** useParticipant hooks events */
const {
/** Methods */
} = useParticipant(participantId, {
onStreamEnabled:(stream) => {};
onStreamDisabled(stream) => {};
});