Re: [webrtc-extensions] Peer Connection and back/forward cache (#200)

> That is how it is done in Safari. We basically simulate a network failure.

When I test in Safari with https://jan-ivar.github.io/dummy/pc_bfcache.html which has 3 buttons `Start`, `sLD` and `sRD`, which together complete a local-loop connection, I observe the following:
1. pressing `Start`, `sLD`, `sRD`, `←`, `→` ... seems to recover (showing 2 videos) after ~2-5 seconds
2. pressing `Start`, `sLD`, `←`, `→`, `sRD` ... seems to recover (showing 2 videos) after ~14 seconds

This is cool! It recovers thanks to this code:
```js
pc1.oniceconnectionstatechange = async () => {
  switch (pc1.iceConnectionState) {
    case "disconnected":
    case "failed":
      await pc1.restartIce();
      await sLD.onclick();
      await sRD.onclick();
      break;
  }
};
```
Of course this being a local-loop it doesn't address whether signaling over e.g. WebSocket would recover or https://github.com/w3c/webrtc-extensions/issues/200#issuecomment-1961861356 

> This is something websites should be prepared for, at least in theory.

In 1 yes, but in 2 which is during initial signaling (admittedly a narrow gap), `"disconnected"` never fires because `"connected"` never fired, and `"failed"` only fires if sRD comes in, which seems unclear in practice.

Webpages can of course listen to [pageshow](https://html.spec.whatwg.org/multipage/indices.html#event-pageshow) to detect this situation, or detect stalled signaling, but this seems a higher bar than quoted.

Is this fine?

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


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

Received on Monday, 11 March 2024 22:56:19 UTC