I am creating a multi user video chat using webRTC.
But i have encountered a problem with RTCPeerConnection
On some occasions i have chats with 7 users where everyone sees the other peoples videos
but sometimes i get black screen from a user.
Weird thing is that it is totally random, sometimes everything works. sometimes a user has a black screen. if that user would re log there would be other screens black or everything would work.
I have checked my flow of how peerconnection works and here is how it works for me:
The user that starts the peerconnection:
- kenneth: Peerconnection created main.js:275
- kenneth: listener for remote stream added main.js:280
- kenneth: listener remote stream removed added main.js:285
- kenneth: local stream added to peerconnection main.js:264
- kenneth: Offer created main.js:293
- kenneth: Offer Sent main.js:315
- kenneth: answer received main.js:205
- kenneth: Listener added to send local ICE candidates main.js:210
- kenneth: Remote Description set from answer main.js:215
- kenneth: Remote stream added main.js:366
- kenneth: remote ICE received main.js:218
- kenneth: remote ICE added to Peerconnection main.js:225
- kenneth: remote ICE received main.js:218
- kenneth: remote ICE added to Peerconnection main.js:225
- kenneth: ICE candidate sent main.js:340
- kenneth: ICE candidate sent main.js:340
- kenneth: ICE candidate sent main.js:340
- kenneth: ICE candidate sent main.js:340
- kenneth: remote ICE received main.js:218
- kenneth: remote ICE added to Peerconnection main.js:225
- kenneth: remote ICE received main.js:218
- kenneth: remote ICE added to Peerconnection main.js:225
- kenneth: ICE candidate sent main.js:340
- kenneth: ICE candidate sent main.js:340
- kenneth: End of Candidates main.js:342
The user that receives an offer and then creates answer:
- kennethtest1: offer received main.js:183
- kennethtest1: Peerconnection created main.js:275
- kennethtest1: listener for remote stream added main.js:280
- kennethtest1: listener remote stream removed added main.js:285
- kennethtest1: Listener added to send local ICE candidates main.js:189
- kennethtest1: Remote Description set from offer main.js:194
- kennethtest1: Local stream added to peerconnection main.js:198
- kennethtest1: Answer created main.js:301
- kennethtest1: Remote stream added main.js:366
- kennethtest1: Answer Sent main.js:324
- kennethtest1: ICE candidate sent main.js:340
- kennethtest1: ICE candidate sent main.js:340
- kennethtest1: ICE candidate sent main.js:340
- kennethtest1: ICE candidate sent main.js:340
- kennethtest1: remote ICE received main.js:218
- kennethtest1: remote ICE added to Peerconnection main.js:225
- kennethtest1: remote ICE received main.js:218
- kennethtest1: remote ICE added to Peerconnection main.js:225
- kennethtest1: remote ICE received main.js:218
- kennethtest1: remote ICE added to Peerconnection main.js:225
- kennethtest1: remote ICE received main.js:218
- kennethtest1: remote ICE added to Peerconnection main.js:225
- kennethtest1: End of Candidates main.js:342
- kennethtest1: remote ICE received main.js:218
- kennethtest1: remote ICE added to Peerconnection main.js:225
- kennethtest1: remote ICE recieved main.js:218
- kennethtest1: remote ICE added to Peerconnection main.js:225
I have also checked out chrome://webrtc-internals/
where i can see that for that specific black screen peerconnection the stream is there
but it isn't sending any data trough it.
Anyone has an idea why sometimes the stream doesn't open here?
Fixed this by adding multiple STUN server instead of relying on just one. I have seen that with using one google STUN server occasionally the requests do not return in time which makes webrtc stop searching for a path to send over the media streams.
I have added STUN servers from other open source suppliers