Exposes details of an individual participant in a video call effect.
//============================================================================ // Retrieves information about the current participant and logs it to the // console. // // Required project capabilities: // - Participant (auto added on module import) // //============================================================================ // Load in the required modules const Participants = require('Participants'); const Diagnostics = require('Diagnostics'); (async function() { // Enable async/await in JS [part 1] // Create a reference to the current participant and log their unique ID // to the console const self = await Participants.self; Diagnostics.log(self.id); //========================================================================== // Create references to whether the current participant is active in the // effect and/or call and monitor these values in the console. //========================================================================== const isActiveInCall = self.isActiveInCall; // Monitor when the participant joins or leaves the call isActiveInCall.monitor({fireOnInitialValue: true}).subscribe((event) => { Diagnostics.log(`Participant is active in call: ${event.newValue}`); }); const isActiveInEffect = self.isActiveInSameEffect; // Monitor when the participant joins or leaves the effect isActiveInEffect.monitor({fireOnInitialValue: true}).subscribe((event) => { Diagnostics.log(`Participant is active in effect: ${event.newValue}`); }); })(); // Enable async/await in JS [part 2]
Property | Description |
---|---|
id | (get) id: string The unique identifier for the participant. You can pass this ID into the getParticipantById() method exposed by the Participants module to retrieve a specific participant.IDs are constant for the duration of the video call but are not persistent across separate calls. If a participant drops out and rejoins the same video call they will retain the same ID. However, if the video call ends and a new one is started, new unique identifiers are generated for each participant. |
isActiveInCall | (get) isActiveInCall: BoolSignal Whether the participant is currently active in the video call, as a BoolSignal .If a participant leaves the video call this property will return false but the participant will not be removed from the array returned by Participants.getAllOtherParticipants() or subtracted from the value returned by Participants.otherParticipantCount .A participant being active in the call does not guarantee that they are also active in the effect. For this, use the Participant's isActiveInSameEffect property instead. |
isActiveInSameEffect | (get) isActiveInSameEffect: BoolSignal Whether the participant is currently active in the same effect, as a BoolSignal .This is distinct from isActiveInCall as a participant may be active in the video call but not necessarily be active in the running effect. |
loadStatus | (get) loadStatus: StringSignal<ParticipantLoadStatus> The participant's load status, as a StringSignal containing a ParticipantLoadStatus enum value (LOADING , LOADED , ERROR or OPTED_OUT ). |
This module exposes no methods.