Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaStreamTrack.getCapabilities() | add detail return value & fix incorrect usage of macros #31161

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.