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

浏览器兼容性