Re: [webrtc-extensions] ICE improvements: prevent candidate pair removal (#166)

Here's how a basic usage of this API looks.

```javascript
const pc = new RTCPeerConnection({iceServers: [/* ice servers */]});
const transceiver = pc.addTransceiver("video");
await pc.setLocalDescription();

// Option 1 - cancelable event
transceiver.sender.transport.iceTransport.oncandidatepairremoval = (e) => {
  if (e.candidatePair.local.type === 'relay' || e.candidatePair.local.protocol === 'udp') {
    e.preventDefault();
  }
  // else e.candidatePair gets removed
};


// Option 2 - removable attribute
transceiver.sender.transport.iceTransport.oncandidatepairadded = (e) => {
  if (e.candidatePair.local.type === 'relay' || e.candidatePair.local.protocol === 'udp') {
    e.candidatePair.removable = false;
  }
};


// Option 3 - idleTimeout attribute
transceiver.sender.transport.iceTransport.oncandidatepairadded = (e) => {
  if (e.candidatePair.local.type === 'relay' || e.candidatePair.local.protocol === 'udp') {
    e.candidatePair.idleTimeout = Number.MAX_SAFE_INTEGER;
  }
};
```

-- 
GitHub Notification of comment by sam-vi
Please view or discuss this issue at https://github.com/w3c/webrtc-extensions/issues/166#issuecomment-1544078606 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 11 May 2023 14:23:10 UTC