From ae686ffbb68babe74dd07390395b94170f864507 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Mon, 22 Mar 2021 11:46:52 +0100 Subject: [PATCH] openvidu-browser: change all "on" methods to "addEventListener" --- .../src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts b/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts index 1208e4df..5b0d1a3a 100644 --- a/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts +++ b/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts @@ -59,7 +59,7 @@ export class WebRtcPeer { this.pc = new RTCPeerConnection({ iceServers: this.configuration.iceServers }); this.id = !!configuration.id ? configuration.id : this.generateUniqueId(); - this.pc.onicecandidate = (event: RTCPeerConnectionIceEvent) => { + this.pc.addEventListener('icecandidate', (event: RTCPeerConnectionIceEvent) => { if (event.candidate != null) { const candidate: RTCIceCandidate = event.candidate; this.configuration.onicecandidate(candidate); @@ -67,16 +67,16 @@ export class WebRtcPeer { this.localCandidatesQueue.push({ candidate: candidate.candidate }); } } - }; + }); - this.pc.onsignalingstatechange = () => { + this.pc.addEventListener('signalingstatechange', () => { if (this.pc.signalingState === 'stable') { while (this.iceCandidateList.length > 0) { let candidate = this.iceCandidateList.shift(); this.pc.addIceCandidate(candidate); } } - }; + }); this.start(); } @@ -314,7 +314,7 @@ export class WebRtcPeer { } addIceConnectionStateChangeListener(otherId: string) { - this.pc.oniceconnectionstatechange = () => { + this.pc.addEventListener('iceconnectionstatechange', () => { const iceConnectionState: RTCIceConnectionState = this.pc.iceConnectionState; switch (iceConnectionState) { case 'disconnected': @@ -340,7 +340,7 @@ export class WebRtcPeer { logger.log('IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') change to "completed"'); break; } - } + }); } /**