-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add remainder of Video source updates
- Loading branch information
1 parent
aedc312
commit c15eee3
Showing
5 changed files
with
157 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: "RTCVideoSourceStats: frames property" | ||
short-title: frames | ||
slug: Web/API/RTCVideoSourceStats/frames | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_media-source.frames | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`frames`** property of the {{domxref("RTCVideoSourceStats")}} dictionary indicates the total number of frames sent from this video source over its lifetime. | ||
|
||
## Value | ||
|
||
A number indicating the total number of frames from this source. | ||
|
||
## Examples | ||
|
||
This example shows how you might iterate the stats object returned from `RTCRtpSender.getStats()` to get the video source stats, and then extract the `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; | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: "RTCVideoSourceStats: height property" | ||
short-title: height | ||
slug: Web/API/RTCVideoSourceStats/height | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_media-source.height | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`height`** property of the {{domxref("RTCVideoSourceStats")}} dictionary indicates the height, in pixels, of the last frame originating from this source. | ||
|
||
This property is not defined on the stats object until after the first frame has been produced. | ||
|
||
## Value | ||
|
||
A positive number indicating the height, in pixels. | ||
|
||
## Examples | ||
|
||
This example shows how you might iterate the stats object returned from `RTCRtpSender.getStats()` to get the video source stats, and then extract the `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 because the property | ||
// 'height' does not exist until frames are being produced. | ||
const height = videoSourceStats?.height; | ||
``` | ||
## Specifications | ||
{{Specifications}} | ||
## Browser compatibility | ||
{{Compat}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: "RTCVideoSourceStats: width property" | ||
short-title: width | ||
slug: Web/API/RTCVideoSourceStats/width | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_media-source.width | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`width`** property of the {{domxref("RTCVideoSourceStats")}} dictionary indicates the width, in pixels, of the last frame originating from this source. | ||
|
||
This property is not defined on the stats object until after the first frame has been produced. | ||
|
||
## Value | ||
|
||
A positive number indicating the width, in pixels. | ||
|
||
## Examples | ||
|
||
This example shows how you might iterate the stats object returned from `RTCRtpSender.getStats()` to get the video source stats, and then extract the `width`. | ||
|
||
```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 because the property | ||
// 'width' does not exist until frames are being produced. | ||
const height = videoSourceStats?.width; | ||
``` | ||
## Specifications | ||
{{Specifications}} | ||
## Browser compatibility | ||
{{Compat}} |