What are events?
You can set listeners to certain events within the meeting. A listener gets called when the corresponding event occurs.
xxxxxxxxxx
131/** The eventName parameter is a String with the name of the event.
2 * The listener parameter is a Function object that will be notified
3 * when the event occurs, with data related to the event.
4 **/
5
6// Triggers every time an event is emitted
7meeting.on(eventName, listener);
8
9// Triggers only once even if the event occurs multiple times
10meeting.once(eventName, listener);
11
12// Remove the listener
13meeting.off(eventName, listener);
Example Usage – 1 (Single Event)
xxxxxxxxxx
191const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
2
3window.onload = function () {
4 meeting.start();
5
6 const meetingJoinedLsnr = function meetingJoinedLsnr(eventData) {
7 console.log('My participant ID:', eventData.id);
8
9 // Example tasks once meeting is joined
10 console.log(meeting.get('allParticipants'));
11 meeting.set('displayName', 'ChangedName');
12 };
13
14 meeting.once('meetingJoined', meetingJoinedLsnr);
15};
16
17window.onunload = function () {
18 meeting.end();
19};
Example Usage – 2 (Single Event)
xxxxxxxxxx
131const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
2
3window.onload = function () {
4 meeting.start();
5
6 meeting.once('meetingLeft', function (eventData) {
7 // route to another page when user leaves the conference
8 });
9};
10
11window.onunload = function () {
12 meeting.end();
13};
Example Usage – 3 (Multiple Events)
xxxxxxxxxx
301const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
2
3window.onload = function() {
4 meeting.start();
5
6 const meetingJoinedLsnr = function meetingJoinedLsnr(participant) {
7 console.log('My participant ID:', participant.id);
8
9 const roleChangedLsnr = function roleChangedLsnr(event) {
10 if (event.role === 'moderator') {
11 meeting.exec('enableLobby', true);
12 }
13 };
14
15 // event 2
16 meeting.once('roleChanged', roleChangedLsnr);
17
18 // event 3
19 meeting.on('someoneKnocked', function (data) {
20 meeting.exec('answerKnockingParticipant', data.participant.id, true);
21 });
22 };
23
24 // event 1
25 meeting.once('meetingJoined', meetingJoinedLsnr);
26};
27
28window.onunload = function() {
29 meeting.end();
30};
All Events
meetingJoined
Joined the conference.
eventData: Object
xxxxxxxxxx
61{
2 roomName: string, // roomName of the conference joined
3 id: string, // the id of local participant
4 displayName: string, // display name of the user
5 avatarURL: string, // avatar URL of the user
6}
meetingLeft
Left the conference.
eventData: Object
xxxxxxxxxx
31{
2 roomName: string // roomName of the conference left
3}
someoneJoined
Someone (apart from the local user) joined the conference.
eventData: Object
xxxxxxxxxx
41{
2 id: string, // the id of the participant
3 displayName: string // the display name of the participant
4}
someoneLeft
Someone (apart from the local user) left the conference.
eventData: Object
xxxxxxxxxx
31{
2 id: string // the id of the participant
3}
audioAvailabilityChanged
Audio availability status changed.
eventData: Object
xxxxxxxxxx
31{
2 available: boolean // new available status - boolean
3}
audioMuteStatusChanged
Audio mute status changed.
eventData: Object
xxxxxxxxxx
31{
2 muted: boolean // new muted status - boolean
3}
browserSupported
Current browser support event notification.
eventData: Object
xxxxxxxxxx
31{
2 supported: boolean
3}
cameraError
Failed to access camera.
eventData: Object
xxxxxxxxxx
41{
2 type: string, // A constant representing the overall type of the error.
3 message: string // Additional information about the error.
4}
chatUpdated
eventData: Object
xxxxxxxxxx
41{
2 isOpen: boolean, // Whether the chat panel is open or not
3 unreadCount: number // The unread messages counter
4}
deviceListChanged
List of available audio/video devices changed.
eventData: Object
xxxxxxxxxx
31{
2 devices: Object // the new list of available devices.
3}
errorOccurred
eventData: Object
xxxxxxxxxx
71{
2 details: Object?, // additional error details
3 message: string?, // the error message
4 name: string, // the coded name of the error
5 type: string, // error type/source, one of : 'CONFIG', 'CONNECTION', 'CONFERENCE'
6 isFatal: boolean // whether this is a fatal error which triggered a reconnect overlay or not
7}
filmstripDisplayChanged
Filmstrip state updated.
eventData: Object
xxxxxxxxxx
31{
2 visible: boolean // Whether or not the filmstrip is displayed or hidden.
3}
incomingMessage
Incoming chat message.
eventData: Object
xxxxxxxxxx
61{
2 from: string, // The id of the user that sent the message
3 nick: string, // the nickname of the user that sent the message
4 privateMessage: boolean, // whether this is a private or group message
5 message: string // the text of the message
6}
micError
Failed to access microphone.
eventData: Object
xxxxxxxxxx
41{
2 type: string, // A constant representing the overall type of the error.
3 message: string // Additional information about the error.
4}
outgoingMessage
Outgoing chat message.
eventData: Object
xxxxxxxxxx
41{
2 message: string, // the text of the message
3 privateMessage: boolean // whether this is a private or group message
4}
passwordRequired
Participant encountered a password prompt.
eventData: null
readyToClose
Conference is about to close. All hang up operations are completed.
eventData: null
roleChanged
Local user's role has changed (none, moderator, participant)
eventData: Object
xxxxxxxxxx
41{
2 id: string // the id of the participant
3 role: string // the new role of the participant
4}
screenSharingStatusChanged
Screen sharing status changed.
eventData: Object
xxxxxxxxxx
41{
2 on: boolean, //whether screen sharing is on
3 details: {} // about the source
4}
someoneBecameDominantSpeaker
Someone became the dominant speaker.
eventData: Object
xxxxxxxxxx
31{
2 id: string //participantId of the new dominant speaker
3}
someoneChangedAvatar
eventData: Object
xxxxxxxxxx
41{
2 id: string, // the id of the participant that changed avatar
3 avatarURL: string // the new avatar URL
4}
someoneChangedContentSharingStatus
Someone switched on or turned off screen sharing. Listener receives a real-time list of all screen sharing participants.
eventData: Object
xxxxxxxxxx
31{
2 data: ["particId1", "particId2", ]
3}
someoneChangedDisplayName
eventData: Object
xxxxxxxxxx
41{
2 id: string, // the id of the participant
3 displayname: string // the new display name
4}
someoneKnocked
Someone is waiting in the lobby.
eventData: Object
xxxxxxxxxx
71{
2 // participant that is currently knocking in the lobby
3 participant: {
4 id: string,
5 name: string
6 }
7}
someoneRaisedHand
eventData: Object
xxxxxxxxxx
41{
2 id: string, // participantId of the user who raises/lowers the hand
3 handRaised: number // 0 when hand is lowered and the hand raised timestamp when raised.
4}
someoneTookStage
Someone took the stage view (large video).
eventData: Object
xxxxxxxxxx
31{
2 id: string // participant id now on the large video in the stage view.
3}
someoneWasKickedOut
eventData: Object
xxxxxxxxxx
91{
2 kicked: {
3 id: string, // the id of the participant removed from the room
4 local: boolean // whether or not the participant is the local participant
5 },
6 kicker: {
7 id: string // the id of the participant who kicked out the other participant
8 }
9}
suspendDetected
Detected suspended events in the user's computer.
eventData: null
tileViewChanged
Tile view entered or exited
eventData: Object
xxxxxxxxxx
31{
2 enabled: boolean, // whether tile view is not displayed or not
3}
videoAvailabilityChanged
Video availability status changed.
eventData: Object
xxxxxxxxxx
31{
2 available: boolean // new available status - boolean
3}
videoMuteStatusChanged
Video (camera) mute status changed.
eventData: Object
xxxxxxxxxx
31{
2 muted: boolean // new muted status - boolean
3}
videoQualityChanged
Meeting video quality changed.
eventData: Object
xxxxxxxxxx
31{
2 videoQuality: number // the height of the new changed (new) resolution
3}