question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement ICE restarts

See original GitHub issue

When network conditions change or the current route is congested, it’s possible to restart ICE and gather/select a new candidate pair. Apparently this happens very frequently with cellular networks or with certain types of NATs.

Restart is done by calling createOffer with the iceRestart option when iceConnectionState == 'failed'.

As an optimization, ICE restart can be done preemptively when iceConnectionState == 'disconnected' (before 'failed') and it won’t immediately bounce back to connected.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
t-mullencommented, May 15, 2020
  • We currently avoid glare by sending a { renegotiate: true } message from the non-initiator to the initiator. We could expand this message to be { renegotiate: { iceRestart: true/false }. Offers from the non-initiator were not well-supported when I implemented renegotiation.

  • I don’t think we need to listen for negotiationeeded. This wasn’t required for changing media, but it’s worth a test.

  • That makes sense to me. Developers disabling trickle usually have very simple signalling setups (ie copy-paste) and we don’t want to break that.

1reaction
t-mullencommented, May 15, 2020

simple-peer should detect the ice connection state 'failed' and do this transparently (no public API, except maybe a max number of restart attempts).

Restart is just renegotiation with iceRestart: true in createOffer (or by callingrestartIce() if that’s implemented in the browser).

https://developer.mozilla.org/en-US/docs/Web/API/RTCOfferOptions/iceRestart https://medium.com/the-making-of-whereby/ice-restarts-5d759caceda6

Read more comments on GitHub >

github_iconTop Results From Across the Web

ICE restarts - WebRTC Course
How to know in WebRTC that ICE restart procedure finished successfully.
Read more >
ICE restarts - Medium
As we have seen doing ICE restarts are a great way to improve the quality of a WebRTC service. They're one solution to...
Read more >
RTCPeerConnection.restartIce() - Web APIs | MDN
Restarting ICE essentially resets ICE so that it creates all new candidates using new credentials. Existing media transmissions continue ...
Read more >
Proper way to handle ICE restart - Google Groups
Just FYI, ICE restarts only make sense when you were connected (PeerConnection was up) and then it got to failed later on, which...
Read more >
android - how to ice restart? - Stack Overflow
For doing ice restart, sender should send SDP file with different ice-pwd or ice-ufrag. IceRestart option forces PeerConnection to update ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found