subhra_saranyu
Member
Hi, Max, We are planning on creating a functionality where a meeting host should be able to remove a participant or Mute them forcefully if requires, is there any way to do that ?
var participants = room.getParticipants();
for (var i = 0; i < participants.length; i++) {
if(participants[i].name == "Alice") {
// Send a message to kick user Alice
var message = base64_encode('CUSTOM_{"action":"kick"}');
participants[i].sendMessage(message);
break;
}
}
connection.join({name: getRoomName(), record: isRecord()}).on(ROOM_EVENT.STATE, function(room){
...
}).on(ROOM_EVENT.MESSAGE, function(message){
var custom = base64_decode(message);
if(custom.CUSTOM_) {
// Custom message
if(custom.CUSTOM_.action == "kick") {
// Leave the room
room.leave().then(onLeft, onLeft);
}
} else {
// Usual text message
addMessage(message.from.name(), message.text);
}
});
The example above is a sample how to implement, not a working code. So please provide your code to check or access to webpage to test using this form.Hi, Max I am getting undefined while using the above method, any idea on that ?
Please test in the Conference example. Are there any text messages loss? If not, seems like the problem is in your code.PS: I am getting correct participant's name but somehow messages are not coming in the ROOM EVENT itself, any specific reason for the same ?