How can I implement screen sharing so that only one user can share their screen at a time? Currently, multiple users can share their screens simultaneously. I want it such that if User A is sharing their screen, it is visible to everyone in the room. However, if User B wants to share their screen, User A’s screen sharing should automatically stop, and User B’s screen should become visible to everyone.
This is more of the logic of your code than of mediasoup.
So you’d probably have a reference to the active screen sharer. When another participant wants to share screen, you signal the client of the active screen sharer to stop sharing. After this is done the new screen sharer can take over.
1 Like
can you please provide solution with code
Please don’t ask others to write code free for you. You have the mediasoup demo app as example app and you have the mediasoup API documentation to learn how to use mediasoup in depth. Don’t ask people to extend the demo app with your specific needs by free.