mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-30 15:02:00 -08:00
webrtc: fix reconnecting to server after a failure (#4022)
This commit is contained in:
parent
6d7d0e6e21
commit
1342431c15
2 changed files with 5 additions and 5 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue