Hello,
This code is good as a start point for the conference screen sharing. I like the command line parameters method which is not depend on plugin.
Is it still maintained? I notice the code is submitted 2 years ago. Has it been tested on recent environment?
I got it merely works on 2 clients. After modify the index.html code, it gets better experience.
I.E. in line 367, modify
pc.addStream(localStream);
to
if(localStream)
pc.addStream(localStream);
But the screen can not share to more than 1 other client.
The receivers' log like:
Received offer...
(index):402 Creating peer connection
(index):460 Adding local stream...
(index):370 Creating remote session description...
(index):375 Sending answer...
(index):469 Added remote stream
(index):313 Sending: SDP
(index):314 RTCSessionDescription {type: "answer", sdp: "v=0
↵o=- 4063776319108917199 2 IN IP4 127.0.0.1
↵s…90000
↵a=rtpmap:96 rtx/90000
↵a=fmtp:96 apt=100
↵"}
(index):382 Received answer...
(index):383 Setting remote session description...
(index):389 Received ICE candidate...
(index):392 RTCIceCandidate {candidate: "candidate:3350409123 1 udp 2113937151 192.168.0.10… typ host generation 0 ufrag fqZc network-cost 50", sdpMid: "video", sdpMLineIndex: 0}
(index):389 Received ICE candidate...
(index):392 RTCIceCandidate {candidate: "candidate:1878309491 1 udp 2122260223 192.168.122.…3935 typ host generation 0 ufrag i04bDKdFdinlpKMW", sdpMid: "video", sdpMLineIndex: 0}
(index):448 Sending ICE candidate...
(index):449 RTCIceCandidate {candidate: "candidate:2131708102 1 udp 2113937151 192.168.0.10… typ host generation 0 ufrag vZ9e network-cost 50", sdpMid: "video", sdpMLineIndex: 0}
(index):1 Uncaught (in promise) DOMException: Failed to set remote answer sdp: Called in wrong state: STATE_INPROGRESS
Promise (async)
onWebSocketMessage @ (index):386
(index):457 End of candidates.
(index):389 Received ICE candidate...
(index):392 RTCIceCandidate {candidate: "candidate:1878309491 2 udp 2122260222 192.168.122.…3936 typ host generation 0 ufrag i04bDKdFdinlpKMW", sdpMid: "video", sdpMLineIndex: 0}
(index):389 Received ICE candidate...
(index):392 RTCIceCandidate {candidate: "candidate:561464963 1 tcp 1518280447 192.168.122.6…cptype active generation 0 ufrag i04bDKdFdinlpKMW", sdpMid: "video", sdpMLineIndex: 0}
And the server console displays:
Mon Jan 08 2018 14:58:26 GMT+0800 (CST) Received Message {"messageType":"iceCandidate","candidate":{"candidate":"candidate:1878309491 1 udp 2122260223 192.168.122.6 3935 typ host generation 0 ufrag i04bDKdFdinlpKMW","sdpMid":"video","sdpMLineIndex":0}}
send() error: Error: This socket has been ended by the other party
send() error: Error: This socket has been ended by the other party
send() error: Error: This socket has been ended by the other party
The sender looks OK. But nothing received on the clients side. Is there any ideas?