Is it possible to distinguish that only two people use video and the rest can only chat as subscribers?

Dear, OpenVidu Developers.

We are building a service by using the openVidu ‘React call tutorial’.
We want to distinguish between the users participating in the room.

Currently, video connection is essential for all incoming participants, but I want to make it so that only designated users can use video and the rest can only function as viewers.

For example, it is a service where only two people can chat via video, and the rest can only chat while looking at the screen.

I’d like to know if this is possible, and if so, how.

Thank you.

Please anybody help. is there any proper way?

Of course this is possible. For this reason OpenVidu has the concept of user roles: Connection.role

Users with role SUBSCRIBER are only able to receive video. Users with role PUBLISHER are able to receive and send video. Users with role MODERATOR can do both things, and besides manage other user’s videos.

To make a user publish video, you should generate a Connection with role PUBLISHER, and use its token to connect that user to the Session. And after connected to it, the user should initialize a Publisher and publish it to the Session.

To make a user only receive video, you should generate a Connection with role SUBSCRIBER, and use its token to connect that user to the Session. And after connected to it, the user should simply subscribe to any remote Stream published to the Session. Do not initialize any Publisher.

More information:

There are also several tutorials that show the concept of PUBLISHERS vs SUBSCRIBERS:

@pabloFuente
I understand those roles, but right now everyone entering each room has their video turned on as a publisher.
Situation now is: If the person making the room is a publisher, then the next person who comes in is the room’s subscribers and also a new publisher.

How can I give the separated rolls before they come in?

thank you.

You must customize the OpenVidu Call React application to do so. This demo app by default handles every user the same way (as Publishers). You’d have to modify it to only publish when the user is actually a Publisher, and only subscribe when it is a subscriber.

@pabloFuente

Where can I modify those (real pub to pub, real sub to sub) function in react codes?

Thank you.