RTCVideoSourceStats: framesPerSecond 属性
RTCVideoSourceStats
字典的 framesPerSecond
属性指示在上秒内由此视频源产生的帧数。
在对象生命周期的第一秒,该属性未在 stats 对象上定义。
值
一个指示在上秒内由此源产生的帧数的数字。
示例
此示例展示了如何迭代 RTCRtpSender.getStats()
返回的 stats 对象以获取视频源统计信息,然后提取 framesPerSecond
。
js
// where sender is an RTCRtpSender
const stats = await sender.getStats();
let videoSourceStats = null;
stats.forEach((report) => {
if (report.type === "media-source" && report.kind==="video") {
videoSourceStats = report;
break;
}
});
// Note, test is conditional in case the stats object
// does not include video source stats
const fps = videoSourceStats?.framesPerSecond;
规范
规范 |
---|
WebRTC 统计 API 的标识符 # dom-rtcvideosourcestats-framespersecond |
浏览器兼容性
加载中…