/
index.md
58 lines (41 loc) · 1.78 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: "MediaTrackSupportedConstraints: latency property"
short-title: latency
slug: Web/API/MediaTrackSupportedConstraints/latency
page-type: web-api-instance-property
browser-compat: api.MediaTrackSupportedConstraints.latency
---
{{APIRef("Media Capture and Streams")}}
The {{domxref("MediaTrackSupportedConstraints")}} dictionary's **`latency`** property is a read-only Boolean value which is present (and set to `true`) in the object returned by {{domxref("MediaDevices.getSupportedConstraints()")}} if and only if the {{Glossary("user agent")}} supports the `latency` constraint.
If the constraint isn't supported, it's not included in the list, so this value will never be `false`.
You can access the supported constraints dictionary by calling `navigator.mediaDevices.getSupportedConstraints()`.
## Value
This property is present in the dictionary (and its value is always `true`) if the user agent supports the `latency` constraint.
If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get {{jsxref("undefined")}} if you try to look at its value.
## Examples
```html hidden
<div id="result"></div>
```
```css hidden
#result {
font:
14px "Arial",
sans-serif;
}
```
```js
const result = document.getElementById("result");
const supported = navigator.mediaDevices.getSupportedConstraints().latency;
result.textContent = supported ? "Supported!" : "Not supported!";
```
### Result
{{ EmbedLiveSample('Examples', 600, 80) }}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Media Capture and Streams API](/en-US/docs/Web/API/Media_Capture_and_Streams_API)
- {{domxref("MediaDevices.getSupportedConstraints()")}}
- {{domxref("MediaTrackSupportedConstraints")}}
- {{domxref("MediaStreamTrack")}}