1
votes

Let's say I have a room with 5 participants. 1 moderator and 4 participants and the moderator needs to mute a particular participant in the room or mute everyone but him/her self. I keep coming across code that seems to indicate a "localParticipant" which seems to be a client side construct referring to the code connected to the examples. I tried to use the following code to drill down into the room and participants but I am not seeing anything helpful under tracks which would be ideal:

let client = await twilio(ACCOUNT_SID, AUTH_TOKEN);
let room = await client.video.rooms(roomSid).fetch();
let participant = await room.participants().get(participantSid).fetch();
let tracks = await participant.publishedTracks.get('Camera').fetch();

I would like to allow the client side code to hit an endpoint that would take the room and participant sid's and mute/unmute from there. Can this be controlled via an express endpoint? I saw a twilio-video package on npm but that seems to be for client-side purposes.

1

1 Answers

1
votes

At this time, the SDK does not provide a native ability to mute remote tracks. Only the local participant can disable their own tracks.

A solution to this problem is the track subscription API. This API allows you to make a request to update a certain participant's subscribe rules so you can programmatically unsubscribe users from tracks. For your use case, the moderator could hit this API to unsubscribe participants from specific users in the room, or unsubscribe all participants from all tracks except the moderators.

More info on this can be found here: Track Subscription API