RTCVideoSourceStats: frames 屬性

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

RTCVideoSourceStats 字典中的 frames 屬性表示此影片源在其生命週期內產生的總幀數。

一個指示此源產生的總幀數的數字。

示例

此示例展示瞭如何迭代 RTCRtpSender.getStats() 返回的 stats 物件以獲取影片源統計資訊,然後提取 frames

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;
  }
});

const frames = videoSourceStats?.frames;

規範

規範
WebRTC 統計 API 的識別符號
# dom-rtcvideosourcestats-frames

瀏覽器相容性