v144 · webrtc · demo

Network Simulator

Pick a degradation preference, then run the simulation. A series of bandwidth events fires over 6 steps (100% → 50% → 25% → 10% → 50% → 100%). For each event the page computes exactly what the encoder would sacrifice — framerate, resolution, quality, or nothing — according to the selected preference.

RTCRtpSender.setParameters: checking…

Loading description…
bandwidth
framerate
resolution
quality

bandwidth level:

simulation timeline (newest first):

step bandwidth fps resolution quality sacrifice

the API

// Create loopback RTCPeerConnection and add a video track
const pc1 = new RTCPeerConnection();
const pc2 = new RTCPeerConnection();

const stream = await navigator.mediaDevices.getUserMedia({ video: true });
const sender = pc1.addTrack(stream.getVideoTracks()[0], stream);

// Set the degradation preference using setParameters
const params = sender.getParameters();
params.degradationPreference = "maintain-framerate-and-resolution";
// ↑ New in Chrome 144: disables the internal encoder adapter entirely,
//   so your own JS adapter has full control.
await sender.setParameters(params);

// Poll getStats() to react to bandwidth changes yourself
const stats = await sender.getStats();
stats.forEach(report => {
  if (report.type === "outbound-rtp") {
    console.log(report.frameWidth, report.framesPerSecond, report.qualityLimitationReason);
  }
});

see also