Re: [webrtc-pc] {iceRestart: true} works poorly with negotiationneeded (#2167)

pc.onnegotiationneeded = async () => {
  await pc.setLocalDescription(await pc.createOffer());
  io.send({desc: pc.localDescription});
}

actulally allows shimming in a RestartIce method, like this:

RTCPeerConnection.prototype.restartIce = function() {
   this.iceRestartNeeded = true;
   pc.onnegotiationneeded();
}

pc.onnegotiationneeed = async() => {
  await pc.setLocalDescription(await pc.createOffer({iceRestart: this.iceRestartNeeded});
  io.send({desc.pcLocalDescription});
}

and (if you want to emulate your proposed patch perfectly):

pc.addEventListener('signalingstatechange', () => {
   if (this.signalingstate == 'stable) {
     this.iceRestartNeeded = false;
  }
}

Point being - there seems to be nothing in the new API that can't be done by the user if the user desires it.

What I dislike about the new API surface is that it seems like it's doing an imperative action ("RestartIce"), while what it's actually doing is (probably) triggering a negotiation request, which will just call back out to user code. Why should the user call a method to call his own code?


-- 
GitHub Notification of comment by alvestrand
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2167#issuecomment-499475161 using your GitHub account

Received on Thursday, 6 June 2019 12:35:19 UTC