Skip to main content

Events

You can subscribe to events for all participants using meeting.participants.on() method. Here are the supported events:

View mode change​

Triggered when the View mode changes

meeting.participants.on(
'viewModeChanged',
({ viewMode, currentPage, pageCount }) => {
console.log('view mode changed', viewMode);
}
);

Page change​

meeting.participants.on(
'pageChanged',
({ viewMode, currentPage, pageCount }) => {
console.log('page changed', currentPage);
}
);

Active speaker​

This event is triggered when a participant becomes active when they starts to speak.

meeting.participants.on('activeSpeaker', (participant) => {
console.log(`${participant.id} is currently speaking`);
});

Events on all participants​

Instead of subscribing to individual participant events, you can subscribe to a participant map, such as joined & active and get updated when any of the participant emits an event.

If you want to subscribe to participants when they become active, you can do so by subscribing to meetings.participants.active.on('participantJoined')

Participant joined​

Trigger an event when any participant joins the meeting.

meeting.participants.joined.on('participantJoined', (participant) => {
console.log(`A participant with id "${participant.id}" has joined`);
});

Participant left​

Trigger an event when any participant leaves the meeting.

meeting.participants.joined.on('participantLeft', (participant) => {
console.log(`A participant with id "${participant.id}" has left the meeting`);
});

Participant pinned​

Trigger an event when a participant is pinned.

meeting.participants.joined.on('pinned', (participant) => {
console.log(`Participant with id "${participant.id}" was pinned`);
});

Participant unpinned​

Trigger an event when a participant is unpinned.

meeting.participants.joined.on('unpinned', (participant) => {
console.log(`Participant with id "${participant.id}" was unpinned`);
});

Video update​

Trigger an event when any participant starts / stops video.

meeting.participants.joined.on('videoUpdate', (participant) => {
console.log(
`A participant with id "${participant.id}" updated their video track in the meeting`
);
// Use the video track if it exists
if (participant.videoEnabled) {
// participant.videoTrack
} else {
// handle stop video
}
});

Audio update​

Trigger an event when any participant starts / stops audio.

meeting.participants.joined.on('audioUpdate', (participant) => {
console.log(
`A participant with id "${participant.id}" updated their audio track in the meeting`
);
// Use the audio track if it exists
if (participant.audioEnabled) {
// participant.audioTrack
} else {
// handle stop audio
}
});

Screen share update​

Trigger an event when any participant starts / stops screen share.

meeting.participants.joined.on('screenShareUpdate', (participant) => {
console.log(
`A participant with id "${participant.id}" updated their screen share in the meeting`
);
// Use the screen share track if it exists
if (participant.screenShareEnabled) {
// participant.screenShareTrack
} else {
// handle stop screen share
}
});

Network quality score​

Subscribe to the mediaScoreUpdate event to monitor network

meeting.participants.joined.on(
'mediaScoreUpdate',
({ participantId, kind, isScreenshare, score }) => {
if (kind === 'video') {
console.log(
`Participant ${participantId}'s ${
isScreenshare ? 'screenshare' : 'video'
} quality score is `,
score
);
}

if (kind === 'audio') {
console.log(
`Participant ${participantId}'s audio quality score is `,
score
);
}

if (score < 5) {
console.log(`Participant ${participantId}'s media quality is poor`);
}
}
);

Events for specific participant​

If you want to subscribe to above events but for a specific participant only, you can do so by binding event to meeting.participants.joined.get(peerId).on() method. where the peerId is the id of the participant that you want to watch.