mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: catch unhandled error on RTCPeerConnection#addIceCandidate
parent
273520cb2d
commit
d6acd0d321
|
@ -56,7 +56,6 @@ export class WebRtcPeer {
|
|||
protected configuration: Required<WebRtcPeerConfiguration>;
|
||||
|
||||
private iceCandidateList: RTCIceCandidate[] = [];
|
||||
private candidategatheringdone = false;
|
||||
|
||||
constructor(configuration: WebRtcPeerConfiguration) {
|
||||
platform = PlatformUtils.getInstance();
|
||||
|
@ -91,12 +90,16 @@ export class WebRtcPeer {
|
|||
}
|
||||
});
|
||||
|
||||
this.pc.addEventListener('signalingstatechange', () => {
|
||||
this.pc.addEventListener('signalingstatechange', async () => {
|
||||
if (this.pc.signalingState === 'stable') {
|
||||
// SDP Offer/Answer finished. Add stored remote candidates.
|
||||
while (this.iceCandidateList.length > 0) {
|
||||
let candidate = this.iceCandidateList.shift();
|
||||
this.pc.addIceCandidate(<RTCIceCandidate>candidate);
|
||||
try {
|
||||
await this.pc.addIceCandidate(<RTCIceCandidate>candidate);
|
||||
} catch (error) {
|
||||
logger.error('Error when calling RTCPeerConnection#addIceCandidate for RTCPeerConnection ' + this.getId(), error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue