mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: individual ICE candidate list to support signalingstate
parent
65cdea70f6
commit
4e0092614d
|
@ -40,6 +40,8 @@ export class WebRtcPeer {
|
||||||
remoteCandidatesQueue: RTCIceCandidate[] = [];
|
remoteCandidatesQueue: RTCIceCandidate[] = [];
|
||||||
localCandidatesQueue: RTCIceCandidate[] = [];
|
localCandidatesQueue: RTCIceCandidate[] = [];
|
||||||
|
|
||||||
|
iceCandidateList: RTCIceCandidate[] = [];
|
||||||
|
|
||||||
private candidategatheringdone = false;
|
private candidategatheringdone = false;
|
||||||
|
|
||||||
constructor(private configuration: WebRtcPeerConfiguration) {
|
constructor(private configuration: WebRtcPeerConfiguration) {
|
||||||
|
@ -61,12 +63,9 @@ export class WebRtcPeer {
|
||||||
|
|
||||||
this.pc.onsignalingstatechange = () => {
|
this.pc.onsignalingstatechange = () => {
|
||||||
if (this.pc.signalingState === 'stable') {
|
if (this.pc.signalingState === 'stable') {
|
||||||
for (const candidate of this.remoteCandidatesQueue) {
|
while (this.iceCandidateList.length > 0) {
|
||||||
this.pc.addIceCandidate(<RTCIceCandidate>candidate);
|
this.pc.addIceCandidate(<RTCIceCandidate>this.iceCandidateList.shift());
|
||||||
}
|
}
|
||||||
/*while (this.remoteCandidatesQueue.length > 0) {
|
|
||||||
this.pc.addIceCandidate(<RTCIceCandidate>this.remoteCandidatesQueue.shift());
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -228,6 +227,7 @@ export class WebRtcPeer {
|
||||||
addIceCandidate(iceCandidate: RTCIceCandidate): Promise<void> {
|
addIceCandidate(iceCandidate: RTCIceCandidate): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.debug('Remote ICE candidate received', iceCandidate);
|
console.debug('Remote ICE candidate received', iceCandidate);
|
||||||
|
this.remoteCandidatesQueue.push(iceCandidate);
|
||||||
switch (this.pc.signalingState) {
|
switch (this.pc.signalingState) {
|
||||||
case 'closed':
|
case 'closed':
|
||||||
reject(new Error('PeerConnection object is closed'));
|
reject(new Error('PeerConnection object is closed'));
|
||||||
|
@ -238,7 +238,7 @@ export class WebRtcPeer {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.remoteCandidatesQueue.push(iceCandidate);
|
this.iceCandidateList.push(iceCandidate);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue