Skip to content

Commit

Permalink
MediaStreamTrack.getCapabilities() | add detail return value & fix …
Browse files Browse the repository at this point in the history
…incorrect usage of macros (#31161)

* add

* update links

* fix
  • Loading branch information
skyclouds2001 authored Dec 20, 2023
1 parent e72890b commit f01d367
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
8 changes: 6 additions & 2 deletions files/en-us/web/api/inputdeviceinfo/getcapabilities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ None.

### Return value

A `MediaTrackCapabilities` object containing the following members:
A `MediaTrackCapabilities` object which specifies the value or range of values which are supported for each of the user agent's supported constrainable properties, containing the following members:

- `deviceId`
- : A [`ConstrainDOMString`](/en-US/docs/Web/API/MediaTrackConstraints#constraindomstring) object containing the device ID.
- `groupId`
- : A [`ConstrainDOMString`](/en-US/docs/Web/API/MediaTrackConstraints#constraindomstring) object containing a group ID.
- `autoGainControl`>
- `autoGainControl`
- : A [`ConstrainBoolean`](/en-US/docs/Web/API/MediaTrackConstraints#constrainboolean) object reporting if the source can do auto gain control.
If the feature can be controlled by a script the source will report both true and false as possible values.
- `channelCount`
Expand Down Expand Up @@ -84,3 +84,7 @@ navigator.mediaDevices.enumerateDevices().then((devices) => {
## Browser compatibility

{{Compat}}

## See also

- {{domxref("MediaStreamTrack.getCapabilities()")}}, which also return a `MediaTrackCapabilities` object.
45 changes: 41 additions & 4 deletions files/en-us/web/api/mediastreamtrack/getcapabilities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ browser-compat: api.MediaStreamTrack.getCapabilities

The **`getCapabilities()`** method of
the {{domxref("MediaStreamTrack")}} interface returns a
{{domxref('MediaTrackCapabilities')}} object which specifies the values or range of
values which each constrainable property, based upon the platform and {{Glossary("user
agent")}}.
`MediaTrackCapabilities` object which specifies the values or range of
values which each constrainable property, based upon the platform and {{Glossary("user agent")}}.

Once you know what the browser's capabilities are, your script can use
{{domxref("MediaStreamTrack.applyConstraints", "applyConstraints()")}} to ask for the
Expand All @@ -30,7 +29,41 @@ None.

### Return value

A {{domxref('MediaTrackCapabilities')}} object which specifies the value or range of values which are supported for each of the user agent's supported constrainable properties.
A `MediaTrackCapabilities` object which specifies the value or range of values which are supported for each of the user agent's supported constrainable properties, containing the following members:

- `deviceId`
- : A [`ConstrainDOMString`](/en-US/docs/Web/API/MediaTrackConstraints#constraindomstring) object containing the device ID.
- `groupId`
- : A [`ConstrainDOMString`](/en-US/docs/Web/API/MediaTrackConstraints#constraindomstring) object containing a group ID.
- `autoGainControl`
- : A [`ConstrainBoolean`](/en-US/docs/Web/API/MediaTrackConstraints#constrainboolean) object reporting if the source can do auto gain control.
If the feature can be controlled by a script the source will report both true and false as possible values.
- `channelCount`
- : A [`ConstrainULong`](/en-US/docs/Web/API/MediaTrackConstraints#constrainulong) containing the channel count or range of channel counts.
- `echoCancellation`
- : A [`ConstrainBoolean`](/en-US/docs/Web/API/MediaTrackConstraints#constrainboolean) object reporting if the source can do echo cancellation.
If the feature can be controlled by a script the source will report both true and false as possible values.
- `latency`
- : A [`ConstrainDouble`](/en-US/docs/Web/API/MediaTrackConstraints#constraindouble) containing the latency or range of latencies.
- `noiseSuppression`
- : A [`ConstrainBoolean`](/en-US/docs/Web/API/MediaTrackConstraints#constrainboolean) object reporting if the source can do noise suppression.
If the feature can be controlled by a script the source will report both true and false as possible values.
- `sampleRate`
- : A [`ConstrainULong`](/en-US/docs/Web/API/MediaTrackConstraints#constrainulong) containing the sample rate or range of sample rates.
- `sampleSize`
- : A [`ConstrainULong`](/en-US/docs/Web/API/MediaTrackConstraints#constrainulong) containing the sample size or range of sample sizes.
- `aspectRatio`
- : A [`ConstrainDouble`](/en-US/docs/Web/API/MediaTrackConstraints#constraindouble) containing the video aspect ratio (width in pixels divided by height in pixels) or range of aspect ratios.
- `facingMode`
- : A [`ConstrainDOMString`](/en-US/docs/Web/API/MediaTrackConstraints#constraindomstring) object containing the camera facing mode. A camera may report multiple facings, for example "left" and "user".
- `frameRate`
- : A [`ConstrainDouble`](/en-US/docs/Web/API/MediaTrackConstraints#constraindouble) containing the frame rate or range of frame rates which are acceptable.
- `height`
- : A [`ConstrainULong`](/en-US/docs/Web/API/MediaTrackConstraints#constrainulong) containing the video height or range of heights in pixels.
- `width`
- : A [`ConstrainULong`](/en-US/docs/Web/API/MediaTrackConstraints#constrainulong) containing the video width or range of widths in pixels.
- `resizeMode`
- : A [`ConstrainDOMString`](/en-US/docs/Web/API/MediaTrackConstraints#constraindomstring) object containing the mode or an array of modes the UA can use to derive the resolution of the video track.

## Specifications

Expand All @@ -39,3 +72,7 @@ A {{domxref('MediaTrackCapabilities')}} object which specifies the value or rang
## Browser compatibility

{{Compat}}

## See also

- {{domxref("InputDeviceInfo.getCapabilities()")}}, which also return a `MediaTrackCapabilities` object.

0 comments on commit f01d367

Please sign in to comment.