Reputation: 5192
For screen sharing, whenever we invoke navigator.mediaDevices.getDisplayMedia()
we need to select the screen that we wish to share, before the streaming can be started. This works fine if it is one to one sharing.
But if I am doing 1 to many screen sharing, we have to create a separate WebRTC connection to each peer. The problem is, if I have 5 peers, I have to select the screen 5 times because every time I call getDisplayMedia()
for different peer, it will requires me to select the screen again.
Upvotes: 0
Views: 1235
Reputation: 17265
There is no need to call getDisplayMedia multiple times, you can add the track/stream from the first getDisplayMedia call to more than one peerconnection.
See https://webrtc.github.io/samples/src/content/peerconnection/multiple/ for a sample illustrating this. There is only a single call (to getUserMedia in this case)
Upvotes: 1