Skip to content

Commit 171f753

Browse files
author
Yuqi Huang
committed
Fix Firefox compatibility by handling null ICE candidates
1 parent 93cc3e2 commit 171f753

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/answerer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Answerer {
9797
// `candidate` will be the empty string if the event indicates that there are no further candidates
9898
// to come in this generation, or null if all ICE gathering on all transports is complete.
9999
// https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/icecandidate_event
100-
if (candidate) {
100+
if (candidate && candidate.candidate) {
101101
console.log(this._loggingPrefix, 'Generated ICE candidate for', this._remoteClientId || 'remote');
102102
console.debug(this._loggingPrefix, 'ICE candidate:', candidate);
103103

@@ -111,6 +111,10 @@ class Answerer {
111111
}
112112
}
113113
} else {
114+
if(candidate && !candidate.candidate) {
115+
//firefox special case, candidate with null candidate field
116+
return;
117+
}
114118
console.log(this._loggingPrefix, 'All ICE candidates have been generated for', this._remoteClientId || 'remote');
115119

116120
// When trickle ICE is disabled, send the answer now that all the ICE candidates have been generated.

0 commit comments

Comments
 (0)