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 |
瀏覽器相容性
載入中…