twilio / twilio-video-app-react

A collaboration application built with the twilio-video.js SDK and React.js
Apache License 2.0
1.81k stars 728 forks source link

How to mute remote participants and turn their videos off? #601

Closed SanjayBikhchandani closed 3 years ago

SanjayBikhchandani commented 3 years ago

In our application, we'll be giving some users host privileges so If the user is the host then they should be able to mute remote participants or turn off videos of remote participants?

so how can we implement that functionality, Is it possible?

AkashM398 commented 3 years ago

In order to implement a moderation feature in your application, you would have to consider using the DataTrack, which can be used to send messages/signals to either a specific or all participants that instructs their application to either mute their audio or turn off their video during the meeting.

You can see how to use the DataTrack API at the following documentation:

https://www.twilio.com/docs/video/using-datatrack-api

However, we do not have an example or implemented the same in this application. This will require you to build a custom logic in your application in order to implement this feature.

SanjayBikhchandani commented 3 years ago

Thanks, @AkashM398

With the help of DataTrack API, I was able to achieve this functionality

olipyskoty commented 3 years ago

Thanks for the help @AkashM398!

@SanjayBikhchandani glad to hear you were able to figure out how to add this functionality to your app using the DataTrack API! 🎉

If you are curious, check out this Twilio Blog Post for an example on how we implemented Data Tracks within this React app. Although we did build out a different feature, it will give you an idea as to how we used the DataTrack API.

Please let us know if you have any more questions and enjoy the rest of your week!