Re: [webrtc-pc] When is negotiation complete? (#2495)

> Wouldn't the following be able to tell if negotiation was needed in most cases? 

Why specify [check if negotiation is needed](https://w3c.github.io/webrtc-pc/#dfn-check-if-negotiation-is-needed) if we're forcing JS to write their own buggy version?

We'll end up with lots of JS that work in "most cases" but not all. A recipe for sadness.

We should at minimum expose `pc.negotiationneeded` then.

> why couldn't you assert that within the next execution cycle onnegotiatonneeded must have or must not have happened?

Great question, and the argument against exposing `pc.negotiationneeded` years ago, as I recall!
```js
const negotiationNotNeeded = !await Promise.race([
  new Promise(r => pc.onnegotiationneeded = r),
  new Promise(r => setTimeout(r))
]); 
```
Unfortunately, it is no longer reliable, since we decided to chain ONN in https://github.com/w3c/webrtc-pc/pull/2405 and https://github.com/w3c/webrtc-pc/pull/2478

So this is a functional spec regression I think we need to fix.

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

Received on Monday, 30 March 2020 19:38:12 UTC