i've tried every webrtc demo out there. none of them can connect everytime. and this is just a localhost connection. i do not think this is my fault. i've had a friend try it too, usually it works, but if you retry the demo enough eventually it will fail to connect.
the issue is that pc.connectionState == "failed"
is webrtc actually unable to connect consistently? how is nobody complaining about this?
here's one of the better demos i've tried. https://scaledrone.github.io/webrtc-text-chat-tutorial/index.html source code is here https://github.com/ScaleDrone/webrtc-text-chat-tutorial
i challenge you to try it. connect to yourself. close both tabs and try again about 10 times. it should get stuck connecting. is there anyway to fix it? i've been messing with the code for all demos for weeks but can't make anything connect robustly!
the only fix i found is that calling pc.addIceCandidate before pc.remoteDescription.type exists is sometimes a race condition problem, fixing that seemed to help, but connections still get stuck
i tried with the latest chrome and firefox. i'm pretty sure when i first tried webrtc 3 years ago it connected 100% of the time.
if you have any webrtc code that can connect every time, post it as an answer, thanks!