diff --git a/internal/servers/webrtc/publisher.js b/internal/servers/webrtc/publisher.js index 6990f449..b44babd1 100644 --- a/internal/servers/webrtc/publisher.js +++ b/internal/servers/webrtc/publisher.js @@ -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(); } diff --git a/internal/servers/webrtc/reader.js b/internal/servers/webrtc/reader.js index 5385c47d..52a218ef 100644 --- a/internal/servers/webrtc/reader.js +++ b/internal/servers/webrtc/reader.js @@ -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'); } };