W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > March 2020

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

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Mon, 23 Mar 2020 00:58:00 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-602310586-1584925078-sysbot+gh@w3.org>
**Proposal A:** `negotiationcomplete` event from SRD(answer) _only_ if renegotiation is not needed.
```js
const transceiver = pc.addTransceiver("video");
await new Promise(r => pc.onnegotiationcomplete = r);
assert_equals(transceiver.currentDirection, "sendonly", "negotiates to sendonly");
```

A downside is subsequent actions might delay this event.

**Proposal B:** Expose a `negotiationneeded` boolean attribute.
```js
const transceiver = pc.addTransceiver("video");
while (pc.negotiationneeded) await state(pc, "stable");
assert_equals(transceiver.currentDirection, "sendonly", "negotiates to sendonly");
```

Complication: once set, we MUST fire `negotiationneeded` event, to meet JS expectations.

**Proposal C:** Expose a `negotiationcomplete` promise attribute.
```js
const transceiver = pc.addTransceiver("video");
await pc.negotiationcomplete;
assert_equals(transceiver.currentDirection, "sendonly", "negotiates to sendonly");
```

Its fulfillment would not be delayed by subsequent actions, besting **_proposal A_**
(browsers would replace this attribute with a new promise each time a train leaves the station).

Think of it as _the promise addTransceiver etc. should have returned_.

**Proposal D:** The Road.

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2495#issuecomment-602310586 using your GitHub account
Received on Monday, 23 March 2020 00:58:01 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:50 UTC