Mute Remote Participant in Conference Room

Luca

New Member
Hi

I am trying to find a way how to mute/unmute a remote participants stream when they join a room(or they already are in a room)

I would like to associate an audio button to each participant where I can mute/unmute their stream

Is there a way I can do it?

Please let me know
Best
Luca
 

Max

Administrator
Staff member
Good day.
Please look at Conference example (code on GitHub). You can locally mute the participants stream when playing it. Just set stream option unmutePlayOnStart: true (sample code).
Or, if you want to mute stream on publisher side, you should use stream.muteAudio() method. In this case, you should also send a special message to the participant
Code:
        var participants = room.getParticipants();
        for (var i = 0; i < participants.length; i++) {
            if (participant[i].name == "user1") {
                 participants[i].sendMessage(JSON.stringify({command: "mute", muteLocalAudio: true}));
            }
        }
At participants side, you should handle the message
Code:
connection.join({name: getRoomName(), record: isRecord()}).on(ROOM_EVENT.STATE, function(room) { 
    ...
    }).on(ROOM_EVENT.MESSAGE, function(message){
        var customPayload = JSON.parse(message)
        if (customPayload.command != undefined) {
             if (customPayload.command == "mute") {
                   // publishStream is the variable where you keep a stream object published by participant
                   publishStream.muteAudio();
             }
        }
    }
});
 
Top