Re: [mediacapture-main] What happens when a machine suspends? (#668)

It follows that when the user _explicitly sets_ "Suspend" at OS Power Manager or equivalent native settings GUI or at command-line for the case of "When laptop lid is closed" if the user really wants to stop the local tracks, or do something else, that can be achieved awaiting `iceconnectionstatechange` event and `iceConnectionState` value `"disconnected"`

```

pc1.oniceconnectionstatechange = () => { 
  if (pc1.iceConnectionState === "disconnected") {
    for (const sender of pc1.getSenders()) {
       sender.track.stop();
    };
  };
};
```
Tested at Nightly 77 and Chromium 81. The only difference in the result is Chromium prints `Uncaught (in promise) TypeError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': Candidate missing values for both sdpMid and sdpMLineIndex
    at RTCPeerConnection.pc2.onicecandidate`.

-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/668#issuecomment-623028565 using your GitHub account

Received on Saturday, 2 May 2020 23:23:30 UTC