RTCVideoSourceStats: height 屬性

可用性有限

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

RTCVideoSourceStats 字典的 height 屬性指示來自此源的最後一幀的高度(以畫素為單位)。

在生成第一幀之後,此屬性才會出現在 stats 物件中。

一個正數,表示高度(以畫素為單位)。

示例

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

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 height = videoSourceStats?.height;

規範

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

瀏覽器相容性