Use the ClanMeeting methods to change the meeting settings/properties dynamically while a meeting is going on.
Example Usage (All Methods)
xxxxxxxxxx
201const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
2
3window.onload = function () {
4 // Method 1
5 meeting.start();
6
7 const meetingJoinedLsnr = function meetingJoinedLsnr(eventData) {
8 // Method 2
9 console.log(meeting.get('allParticipants'));
10 // Method 3
11 meeting.set('displayName', 'ChangedName');
12 };
13
14 meeting.once('meetingJoined', meetingJoinedLsnr);
15};
16
17window.onunload = function () {
18 // Method 4
19 meeting.end();
20};
Example Usage (Host Methods)
Wait for the role to be upgraded to moderator before executing methods that need host privileges.
xxxxxxxxxx
281const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
2// Methods 1 and 2 (chained together)
3meeting.generateRoomName().anonymizeDisplayName();
4
5window.onload = function () {
6 // Method 3
7 meeting.start();
8
9 const meetingJoinedLsnr = function meetingJoinedLsnr() {
10 const roleChangedLsnr = function roleChangedLsnr(event) {
11 // Execute host methods only AFTER the user has joined and has become the moderator
12 if (event.role === 'moderator') {
13 // Methods 4 & 5 (chained)
14 meeting
15 .exec('enableLobby', true)
16 .exec('startRecording');
17 }
18 };
19 meeting.on('roleChanged', roleChangedLsnr);
20 };
21
22 meeting.once('meetingJoined', meetingJoinedLsnr);
23};
24
25window.onunload = function () {
26 // Method 6
27 meeting.end();
28};
Method Chaining
Few ClanMeeting methods support chaining as shown in the examples above. The ones that do are flagged as isChainable.
All Methods
start()
Starts the conference. Use on window load.
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | false | true |
Example:
xxxxxxxxxx
31window.onload = function () {
2 meeting.start();
3};
end()
Removes all listeners and ends the conference (only for the local user).
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | false | true |
Example:
xxxxxxxxxx
31window.onunload = function () {
2 meeting.end();
3};
generateRoomName([prefix], [nbChars], [suffix])
Generates a complex random room name and sets the roomName
property.
If you do not set the roomName
property to a room of your choice then you must use this method BEFORE meeting.start()
.
param | type | description | isMandatory | default |
---|---|---|---|---|
prefix | String | Prefix string | false | empty |
nbChars | Number | Number of random alphanumeric characters in between the prefix and suffix | false | 10 |
suffix | String | Suffix string | false | empty |
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | false | true |
Example:
xxxxxxxxxx
121// either set the roomName in optionalProperties
2const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
3
4// or generate one before starting the meeting
5meeting.generateRoomName();
6// customize roomName like below if you want
7// this example generates 15 character room names
8meeting.generateRoomName('', 15, '');
9
10window.onload = function () {
11 meeting.start();
12};
anonymizeDisplayName([prefix], [nbDigits])
Anonymizes the displayName
of the participant. e.g. User_1234
If you do not set the displayName
property then you must use this method BEFORE meeting.start()
.
param | type | description | isMandatory | default |
---|---|---|---|---|
prefix | String | Prefix string | false | User_ |
nbDigits | Number | Number of digits after the prefix | false | 4 |
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | false | true |
Example:
xxxxxxxxxx
121// either set the displayName in optionalProperties
2const meeting = new ClanMeeting(domain, consumerId, optionalProperties);
3
4// or anonymize the name before starting the meeting
5meeting.anonymizeDisplayName();
6// or customize as per need
7// examples - Batch5_123, Batch5_843
8meeting.anonymizeDisplayName('Batch5_', 3);
9
10window.onload = function () {
11 meeting.start();
12};
isInFuture(startDateTime)
Returns true if the meeting is in the future as compared to the current time.
param | type | description | isMandatory |
---|---|---|---|
startDateTime | String | Start datetime of the scheduled meeting. Could be any Javascript datetime format. | true |
returns | needsHostPrivilege | isChainable |
---|---|---|
Boolean | false | false |
Example:
See usage in schedule meetings guide.
get(attribute, [arg])
Returns value of the requested attribute.
param | type | description | isMandatory |
---|---|---|---|
attribute | String | allParticipants nbParticipants videoQuality avatarUrlById displayNameById participantById | true |
arg | Any | Arguments if applicable to the attribute | depends on attr |
returns | needsHostPrivilege | isChainable |
---|---|---|
Any | false | false |
Example:
xxxxxxxxxx
281window.onload = function () {
2 meeting.start();
3
4 const meetingJoinedLsnr = function meetingJoinedLsnr(participant) {
5 // gets an array of all participants with information like ID, displayName, avatarUrl
6 meeting.get('allParticipants');
7
8 // gets the number of conference participants
9 meeting.get('nbParticipants');
10
11 // gets the current video quality setting
12 meeting.get('videoQuality');
13
14 // gets avatarUrl by participant ID
15 meeting.get('avatarUrlById', participant.id);
16 };
17
18 const someoneJoinedLsnr = function someoneJoinedLsnr(participant) {
19 // gets displayName by participant ID
20 meeting.get('displayNameById', participant.id);
21
22 // gets participant information for a specific participant
23 meeting.get('participantById', participant.id);
24 };
25
26 meeting.once('meetingJoined', meetingJoinedLsnr);
27 meeting.on('someoneJoined', someoneJoinedLsnr);
28};
getAsync(attribute)
Returns a promise of response for a requested attribute.
param | type | description | isMandatory |
---|---|---|---|
attribute | String | availableDevices currentDevices contentSharingParticipants livestreamUrl | true |
returns | needsHostPrivilege | isChainable |
---|---|---|
Promise | false | false |
Example:
xxxxxxxxxx
191window.onload = function () {
2 meeting.start();
3
4 const meetingJoinedLsnr = function meetingJoinedLsnr(participant) {
5 // gets available audio/video devices
6 meeting.getAsync('availableDevices').then(devices => { console.log(devices); });
7
8 // gets the list of screen sharing users
9 meeting.getAsync('contentSharingParticipants').then(participants => { console.log(participants); });
10
11 // gets the list of currently selected audio/video devices
12 meeting.getAsync('currentDevices').then(devices => { console.log(devices); });
13
14 // gets the livestreamUrl if livestreaming is on
15 meeting.getAsync('livestreamUrl').then(data => { console.log(data); });
16 };
17
18 meeting.once('meetingJoined', meetingJoinedLsnr);
19};
selectDeviceAsync(type, label, id)
Once you get the device list using above methods, you can select a particular AV input or output device. Device list has the label and ID.
param | type | description | isMandatory |
---|---|---|---|
type | String | audioInput audioOutput videoInput | true |
label | String | Device label | true |
id | String | Device ID | true |
returns | needsHostPrivilege | isChainable |
---|---|---|
Promise | false | false |
Example:
xxxxxxxxxx
21// returns true if selected
2meeting.selectDeviceAsync('audioInput', 'Microphone Array (Realtek Audio)', 'qndtoJUhFXtLampWZ3tLfObK7/yovEm7/G8XZmQvT/g=', ).then(devices => { console.log(devices); });
checkAsync(info, [arg])
Returns the status for the information requested.
param | type | description | isMandatory |
---|---|---|---|
attribute | String | isAudioAvailable isAudioMuted isDeviceListAvailable isMultipleAudioInputSupported isVideoAvailable isVideoMuted isDeviceChangeAvailable | true |
arg | Any | Argument if applicable to the attribute | depends on info |
returns | needsHostPrivilege | isChainable |
---|---|---|
Promise | false | false |
Example:
xxxxxxxxxx
171// is audio available
2meeting.checkAsync('isAudioAvailable').then(value => { console.log(value); });
3
4// is microphone muted or not
5meeting.checkAsync('isAudioMuted').then(value => { console.log(value); });
6
7// camera availability
8meeting.checkAsync('isVideoAvailable').then(value => { console.log(value); });
9
10// is camera muted or not
11meeting.checkAsync('isVideoMuted').then(value => { console.log(value); });
12
13meeting.checkAsync('isDeviceChangeAvailable', 'input').then(value => { console.log(value); });
14
15meeting.checkAsync('isDeviceListAvailable').then(value => { console.log(value); });
16
17meeting.checkAsync('isMultipleAudioInputSupported').then(value => { console.log(value); });
set(attribute, [arg2, [arg3])
Sets the attribute to the value.
param | type | description | isMandatory |
---|---|---|---|
attribute | String | avatarUrl displayName localSubject onStageParticipant tileView followMe (host) participantVolume (host) password (host) subject (host) | true |
arg2 | Any | Argument if applicable to the attribute | depends on attr |
arg3 | Any | Argument if applicable to the attribute | depends on attr |
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | true (some) | true |
Example:
xxxxxxxxxx
201meeting
2 .set('avatarUrl', 'https://path/to/compressed/avatar/image')
3 .set('displayName', 'John Doe')
4 // sets the subject for the local user only
5 .set('localSubject', 'Local Subject')
6 .set('onStageParticipant', participant.id)
7 .set('tileView', false);
8
9// the ones that need host privileges to execute
10meeting.on('roleChanged', (event) => {
11 if (event.role === 'moderator') {
12 meeting
13 .set('followMe', true)
14 .set('password', 'mysecret680')
15 .set('subject', 'Public Subject')
16 // host can control participant volume
17 // takes participant ID and volume level between 0 and 1
18 .set('participantVolume', participant.id, 0.2);
19 }
20});
exec(command, [arg2, [arg3, [arg4]]])
Executes the command.
param | type | description | isMandatory |
---|---|---|---|
command | String | enableLobby (host) hangup sendChatMessage initiatePrivateChat cancelPrivateChat muteAudioEveryone (host) muteVideoEveryone (host) startShareVideo stopShareVideo startRecording (host) stopRecording (host) startLiveStreaming (host) stopLiveStreaming (host) kickParticipant (host) pinParticipant answerKnockingParticipant (host) | true |
arg2 | Any | Argument if applicable to the command | depends on command |
arg3 | Any | Argument if applicable to the command | depends on command |
arg4 | Any | Argument if applicable to the command | depends on command |
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | true (some) | true |
Example:
xxxxxxxxxx
471// host commands
2meeting.on('roleChanged', function(event) {
3 if (event.role === 'moderator') {
4 meeting
5 .exec('enableLobby', true)
6
7 // you can use a custom or YouTube rtmp URL of your channel
8 .exec('startLiveStreaming', 'rtmp://url:1935/live/rtmp_key')
9
10 .exec('stopLiveStreaming')
11 .exec('startRecording')
12 .exec('stopRecording')
13
14 // send the ID of the participant that needs to be kicked
15 .exec('kickParticipant', '9713d834')
16
17 .exec('muteAudioEveryone')
18 .exec('muteVideoEveryone');
19 }
20});
21
22// host command
23meeting.on('someoneKnocked', function (data) {
24 meeting.exec('answerKnockingParticipant', data.participant.id, true);
25});
26
27meeting
28 // hangs up the call for the local participant only
29 .exec('hangup')
30
31 .exec('pinParticipant', participant.id)
32
33 // arg2: video URL
34 .exec('startShareVideo', 'https://www.youtube.com/watch?v=BHACKCNDMW8')
35
36 // stop the shared video
37 .exec('stopShareVideo')
38
39 // arg2: message - the text message
40 // arg3: to - the receiving participant ID or empty string/undefined for group chat
41 // arg4: ignorePrivacy - true if the privacy notification should be ignored. Defaulted to false
42 .exec('sendChatMessage', 'Hi', '', false)
43
44 // arg2: participant ID
45 .exec('initiatePrivateChat', '3533e6b2')
46
47 .exec('cancelPrivateChat');
execAsync(command)
param | type | description | isMandatory |
---|---|---|---|
command | String | captureStageScreenshot | true |
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | false | true |
Example:
xxxxxxxxxx
101/** The person taking the screenshot of the
2 * on-stage participant should be using Chrome browser.
3 * Add a screenshot button outside of meeting element.
4 */
5
6screenshotBtn.addEventListener('click', function() {
7 meeting
8 .execAsync('captureStageScreenshot')
9 .then(data => console.log(data.dataURL));
10});
toggle(attribute)
Toggles.
param | type | description | isMandatory |
---|---|---|---|
attribute | String | audio video filmStrip chat raiseHand shareScreen tileView camera cameraMirroring virtualBackgroundDialog | true |
returns | needsHostPrivilege | isChainable |
---|---|---|
ClanMeeting | false | true |
Example:
xxxxxxxxxx
111meeting
2 .toggle('audio')
3 .toggle('video')
4 .toggle('filmStrip')
5 .toggle('chat')
6 .toggle('raiseHand')
7 .toggle('shareScreen')
8 .toggle('tileView')
9 .toggle('camera')
10 .toggle('cameraMirroring')
11 .toggle('virtualBackgroundDialog');