Scripting API
ParticipantsModule
ParticipantsModule Overview

ParticipantsModule

Exposes the ability to retrieve the participants in a video call effect. Each user on the call is considered a participant, including the host.
When a new user joins the call a new Participant object is added to the array returned by getAllOtherParticipants() and otherParticipantCount is increased.


Participants are not removed from the array if they leave while the call is still active. This allows individual participants to retain the same unique ID that can be referenced for the duration of the video call, even after a dropout. Similarly, otherParticipantCount is not decreased when a participant leaves. However, if the the video call ends then the participant array and count are both reset.


Importing this module automatically enables the Participants capability within the project's Properties.

Example

Properties

PropertyDescription
effectGroupInitialised
(get) effectGroupInitialised: BoolSignal
(set) (Not Available)


Whether the group apply of effect in video call initialised, that means all other participants trying to load the same effect has finished loading.
otherParticipantCount
(get) otherParticipantCount: ScalarSignal
(set) (Not Available)


The total number of participants in the video call, not including the current participant (self), as a ScalarSignal.
To retrieve the total number of other participants active in the effect, use otherParticipantsInSameEffectCount instead.
otherParticipantsInSameEffectCount
(get) otherParticipantsInSameEffectCount: ScalarSignal
(set) (Not Available)


The total number of participants active in the effect, not including the current participant (self), as a ScalarSignal.
To retrieve the total number of other participants in the video call whether they are active in the effect or not, use otherParticipantCount instead.
self
(get) self: Promise<Participant>
(set) (Not Available)


The current user, as a Participant object.

Methods

MethodDescription
getAllOtherParticipants
getAllOtherParticipants(): Promise<Array<Participant>>


Returns an array of Participant objects containing all of the other participants in the video call, not including the current user (self).
getOtherParticipantsInSameEffect
getOtherParticipantsInSameEffect(): Promise<Array<Participant>>


Returns an array of Participant objects containing all of the participants active in the effect, not including the current user (self).
getParticipantById
getParticipantById(id: string): Promise<Participant>


Returns the Participant object attached to the unique ID specified.
A Participant object's unique ID is accessible via its id property. For example:

const otherParticipants = await Participants.getAllOtherParticipants();
const participant = otherParticipants[0];
const participantId = participant.id;

// Retrieves the above participant via its unique ID
const sameParticipant = Participants.getParticipantById(participantId)
onOtherParticipantAdded
onOtherParticipantAdded(): EventSource<Participant>


Returns an EventSource object that emits a new Participant object each time a new participant joins the video call. For example:
Participants.onOtherParticipantAdded().subscribe((participant) => {
// const newParticipantId = participant.id;
});

Classes

ClassDescription
ParticipantExposes details of an individual participant in a video call effect.