Participant events
You might also want to monitor for events that happen to a specific participant on a call. This group of events is emitted when a participant joins or leaves a call, or when something about the participant has changed, like their audio or video track status.
See participants()
for details on the information that the participants
object returns for each participant property.
participant-joined
Fires when a new remote participant has joined the call. The participant
property includes all available information about who joined, like whether or not their audio is on.
See participants()
for more information on the participant
property.
Note: this event may arrive for a remote participant before the local joined-meeting
event fires.
participant-updated
Emitted when a local or remote participant's state changes.
The event object's participant
property contains all the available information about the participant.
See participants()
for more information on the participant
property.
participant-left
A remote participant leaves the call.
The event's participant
property contains all of the available information about the participant just before the participant disconnected.
See participants()
for more information on the participant
property.
Note: a participant losing presence is treated as them leaving, resulting in this event being emitted. When this occurs, an optional reason
field in the event payload will tell you they became 'hidden'
.
waiting-participant-added
A participant has been added to the waitingParticipants()
set.
Payload object:
action
participant
: seewaitingParticipants()
for object format
waiting-participant-updated
A participant in the waitingParticipants()
set has updated details (right now, this just indicates a name
change).
Payload object:
action
participant
: seewaitingParticipants()
for object format
waiting-participant-removed
A participant has been removed from the waitingParticipants()
set.
Payload object:
action
participant
: seewaitingParticipants()
for object format
app-message
This event fires when somebody broadcasts a message to other participants in the call via the sendAppMessage()
method.
The event object returns information about the participant who broadcast the message, and also the data
they sent. The data they sent is always in the form of a JavaScript object that can be serialized into JSON.
Messages are not sent to the person who sends the message, and they are not stored. If a participant joins a call after a message is sent, they will never see it.
Calling this method and listening for the event could be used to build out a custom chat UI, or to implement a "Raise Your Hand" feature, for example.
See app-message in action
track-started
Fires when a participant's audio or video track begins.
The event object returned includes a MediaStreamTrack object and information about the participant whose track started.
track-stopped
Fires when a participant's audio or video track stops.
The event object returned includes a MediaStreamTrack object and information about the participant whose track stopped.
available-devices-updated
Triggered when a new device is available or when a device is removed. For example, this includes when a headset (wired or Bluetooth) is connected or disconnected. The availableDevices
property includes relevant information about devices available to the local user.
See enumerateDevices()
for more information on the properties returned.
selected-devices-updated
Triggered when a participant changes their selected input or output device. For example, this event will fire if a participant updates their speaker from AirPods to built-in speakers while in a call.
This event is somewhat similar to available-devices-updated
. The difference is that selected-devices-updated
only fires when the participant has selected a new device, whereas available-devices-updated
fires whenever a new device is detected.
This event returns a devices
object, with the devices that have been updated: