// Get the outbound RTP stream stats
pc.getStats().then((stats) => {
stats.forEach((report) => {
if (report.type === "outbound-rtp") {
const qualityLimitations = report.qualityLimitationDurations;
if (qualityLimitations) {
let totalTimeLimited = 0;
console.log("Quality Limitations:");
qualityLimitations.forEach((duration, reason) => {
console.log(`- ${reason}: ${duration} seconds`);
if (reason !== "none") {
totalTimeLimited += duration;
}
});
console.log(`Total time limited: ${totalTimeLimited}`);
}
}
});
});RTCOutboundRtpStreamStats: qualityLimitationDurations property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.