RTCVideoSourceStats: width-Eigenschaft
Die width
-Eigenschaft des RTCVideoSourceStats
Wörterbuchs gibt die Breite, in Pixel, des letzten Bildes an, das von dieser Quelle stammt.
Diese Eigenschaft wird erst am Statistikobjekt definiert, nachdem das erste Bild produziert wurde.
Wert
Eine positive Zahl, die die Breite in Pixel angibt.
Beispiele
Dieses Beispiel zeigt, wie Sie das Statistikobjekt, das von RTCRtpSender.getStats()
zurückgegeben wird, durchlaufen können, um die Videodatenquellenstatistiken zu erhalten und dann die width
zu extrahieren.
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?.width;
Spezifikationen
Specification |
---|
Identifiers for WebRTC's Statistics API # dom-rtcvideosourcestats-width |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
width in 'media-source' stats for video |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.