I have a problem with a video call project I created. I followed the steps in this video https://www.youtube.com/watch?v=_3exOT53faw&ab_channel=CodeShell, but I get an error because RTCPeerConnection.connectionState is failed. According to https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/connectionState it is because "One or more of the ICE transports on the connection is in the failed state.". I don't know if I should change the servers I use, or add new ones. Any ideas? Here is part of the code:
const configuration = {
iceServers: [
{
urls: [
'stun:stun1.l.google.com:19302',
'stun:stun2.l.google.com:19302',
],
},
],
iceCandidatePoolSize: 10,
};
peerConnection = new RTCPeerConnection(configuration);
peerConnection.addEventListener('icecandidate', event => {
if (!event.candidate) {
console.log('Got final candidate!');
return;
}
console.log('Got candidate: ', event.candidate);
callerCandidatesCollection.add(event.candidate.toJSON());
});