MDN self-hosted library · e01.org

RTCTransportStats

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
async function getTransportStats(peerConnection) {
  const stats = await peerConnection.getStats();

  for (const report of stats.values()) {
    if (report.type === "transport") {
      return report;
    }
  }

  return null;
}