[webrtc-extensions] Unclear when all side-effects of setSelectedCandidatePair have taken effect (#182)

sam-vi has just created a new issue for https://github.com/w3c/webrtc-extensions:

== Unclear when all side-effects of setSelectedCandidatePair have taken effect ==
The [setSelectedCandidatePair](https://w3c.github.io/webrtc-extensions/#dom-rtcicetransport-setselectedcandidatepair) method in [ยง 9. RTCIceTransport extensions](https://w3c.github.io/webrtc-extensions/#rtcicetransport) causes the selected candidate pair to change asynchronously.

This has several side-effects:
1. The candidate pair returned by [getSelectedCandidatePair](https://w3c.github.io/webrtc-pc/#dom-rtcicetransport-getselectedcandidatepair) changes, backed by the [[[SelectedCandidatePair]]](https://w3c.github.io/webrtc-pc/#dfn-selectedcandidatepair) internal slot.
2. A [selectedcandidatepairchange](https://w3c.github.io/webrtc-pc/#event-icetransport-selectedcandidatepairchange) event is fired.
3. The transport's [RTCIceTransportState](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate) may change.

This would be a good scenario to return a promise that resolves once all the changes have been applied. Then it is possible to do this:

```js
await transceiver.transport.iceTransport.setSelectedCandidatePair(foo);
const bar = transceiver.transport.iceTransport.getSelectedCandidatePair();
// foo and bar now match
```

Please view or discuss this issue at https://github.com/w3c/webrtc-extensions/issues/182 using your GitHub account


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

Received on Tuesday, 31 October 2023 13:15:40 UTC