The ConstrainBoolean
dictionary is used to specify a constraint for a property whose value is a Boolean value. You can specify an exact value which must be matched, an ideal value that should be matched if at all possible, and a fallback value to attempt to match once all more specific constraints have been applied.
exact
ideal
You can also specify the value of the property as simply true
or false
, in which case the user agent will use that value if possible once all efforts have been made to match the exact
and ideal
values for other properties.
Specification | Status | Comment |
---|---|---|
Media Capture and Streams The definition of 'ConstrainBoolean' in that specification. | Candidate Recommendation | Initial definition |
Technically, ConstrainBoolean
is actually based on an intermediary dictionary named ConstrainBooleanParameters
, which adds exact
and ideal
to the simple Boolean type. However, for the sake of documentation clarity, the intermediate type (present only because of quirks in WebIDL syntax) is ignored here.
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | ? | 50 | No | Yes | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | ? | 50 | Yes | ? | ? |
MediaTrackConstraints
MediaTrackCapabilities
MediaTrackSupportedConstraints
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ConstrainBoolean