Re: [webrtc-pc] ICE restart deserves a first-class API. (#2167)

@fippo `iceconnectionstatechange` does not wait for `"stable"` state, so that code will fail occasionally. I think safer APIs will avoid these races.

> Adding a restartIce method leads down the slippery slope of triggering it based on peerconnection logic, not application logic.

I don't see that, but feel free to clarify. I see quite the opposite. It's today's API that seems buried in the details of peer connection's negotiation handling.

`negotiationneeded` is meant to help people encapsulate the detail-task of negotiating. If we split application logic up between what goes above that abstraction and what goes below it—with up being higher-level, closer to the app—I think ICE restart belongs above it.
```js
pc.oniceconnectionstatechange = () => pc.icecConnectonState == 'failed' && pc.restartIce();
```
Users shouldn't have to worry about `signalingState` at this level IMHO.

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

Received on Monday, 8 April 2019 15:27:19 UTC