ionorg / ion-sdk-js

ion javascript sdk
MIT License
102 stars 70 forks source link

(feat)ice restart #154

Closed adwpc closed 3 years ago

adwpc commented 3 years ago

https://developer.mozilla.org/en-US/docs/Web/API/RTCOfferOptions/iceRestart

pc.oniceconnectionstatechange = function(evt) {
  if (pc.iceConnectionState === "failed") {
    if (pc.restartIce) {
      pc.restartIce();
    } else {
      pc.createOffer({ iceRestart: true })
      .then(pc.setLocalDescription)
      .then(sendOfferToServer);
    }
  }
}

https://github.com/webrtc/samples/blob/4b198b679350f836809b40516c25d4b17eb22e9d/src/content/peerconnection/restart-ice/js/main.js#L89