demos/js/demo_ice_filter.js
function iceCandidateFilter( iceCandidate, fromPeer) {
   var sdp = iceCandidate.candidate;
   if( sdp.indexOf("typ relay") > 0) { // is turn candidate
       if( document.getElementById("allowTurn").checked ) {
           return iceCandidate;
       }
       else {
           return null;
       }
   }
   else if( sdp.indexOf("typ srflx") > 0) { // is turn candidate
       if( document.getElementById("allowStun").checked ) {
           return iceCandidate;
       }
       else {
           return null;
       }
   }
   else if( sdp.indexOf("typ host") > 0) { // is turn candidate
       if( document.getElementById("allowLocal").checked ) {
           return iceCandidate;
       }
       else {
           return null;
       }
   }
   else {
      console.log("Unrecognized type of ice candidate, passing through: " + sdp);
   }
}
function iceCandidateFilter( iceCandidate, fromPeer) {
   var sdp = iceCandidate.candidate;
   if( sdp.indexOf("typ relay") > 0) { // is turn candidate
       if( document.getElementById("allowTurn").checked ) {
           return iceCandidate;
       }
       else {
           return null;
       }
   }
   else if( sdp.indexOf("typ srflx") > 0) { // is turn candidate
       if( document.getElementById("allowStun").checked ) {
           return iceCandidate;
       }
       else {
           return null;
       }
   }
   else if( sdp.indexOf("typ host") > 0) { // is turn candidate
       if( document.getElementById("allowLocal").checked ) {
           return iceCandidate;
       }
       else {
           return null;
       }
   }
   else {
      console.log("Unrecognized type of ice candidate, passing through: " + sdp);
   }
}
function iceCandidateFilter ( iceCandidate , fromPeer ) { var sdp = iceCandidate . candidate ; if ( sdp . indexOf ( "typ relay" ) > 0 ) { // is turn candidate if ( document . getElementById ( "allowTurn" ) . checked ) { return iceCandidate ; } else { return null ; } } else if ( sdp . indexOf ( "typ srflx" ) > 0 ) { // is turn candidate if ( document . getElementById ( "allowStun" ) . checked ) { return iceCandidate ; } else { return null ; } } else if ( sdp . indexOf ( "typ host" ) > 0 ) { // is turn candidate if ( document . getElementById ( "allowLocal" ) . checked ) { return iceCandidate ; } else { return null ; } } else { console . log ( "Unrecognized type of ice candidate, passing through: " + sdp ) ; } }
filter ice candidates according to the ice candidates checkbox.
filter ice candidates according to the ice candidates checkbox .