webrtc: fix reconnecting to server after a failure (#4022)

This commit is contained in:
aler9 2025-01-06 13:51:08 +01:00
parent 6d7d0e6e21
commit 1342431c15
2 changed files with 5 additions and 5 deletions

View file

@ -264,7 +264,7 @@
});
this.pc.onicecandidate = (evt) => this.onLocalCandidate(evt);
this.pc.oniceconnectionstatechange = () => this.onConnectionState();
this.pc.onconnectionstatechange = () => this.onConnectionState();
this.conf.stream.getTracks().forEach((track) => {
this.pc.addTrack(track, this.conf.stream);
@ -372,9 +372,9 @@
return;
}
if (this.pc.iceConnectionState === 'failed') {
if (this.pc.connectionState === 'failed') {
this.handleError('peer connection closed');
} else if (this.pc.iceConnectionState === 'connected') {
} else if (this.pc.connectionState === 'connected') {
if (this.conf.onConnected !== undefined) {
this.conf.onConnected();
}

View file

@ -371,7 +371,7 @@
this.pc.addTransceiver('audio', { direction });
this.pc.onicecandidate = (evt) => this.onLocalCandidate(evt);
this.pc.oniceconnectionstatechange = () => this.onConnectionState();
this.pc.onconnectionstatechange = () => this.onConnectionState();
this.pc.ontrack = (evt) => this.onTrack(evt);
return this.pc.createOffer()
@ -468,7 +468,7 @@
return;
}
if (this.pc.iceConnectionState === 'failed') {
if (this.pc.connectionState === 'failed') {
this.handleError('peer connection closed');
}
};