Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1126639 of ConstrainBoolean

  • Revision slug: Web/API/ConstrainBoolean
  • Revision title: ConstrainBoolean
  • Revision id: 1126639
  • Created:
  • Creator: Sheppy
  • Is current revision? Yes
  • Comment

Revision Content

{{APIRef("Media Capture and Streams")}}

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.

Properties

exact
A Boolean which indicates a value the property must have.
ideal
A Boolean value indicating the ideal, but not required, value the property should ideally have. If possible, this value will be used, but the user agent will use the other value if it needs to in order to come up with a workable configuration.

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.

Specifications

Specification Status Comment
{{SpecName('Media Capture', '#idl-def-ConstrainBoolean', 'ConstrainBoolean')}} {{Spec2('Media Capture')}} 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 {{Glossary("WebIDL")}} syntax) is ignored here.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Microsoft Edge Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop(50)}} {{CompatNo}} {{CompatUnknown}} {{CompatNo}} {{CompatUnknown}}
Feature Android Android Webview Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatGeckoMobile(50)}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}} {{CompatVersionUnknown}}

See also

Revision Source

<div>{{APIRef("Media Capture and Streams")}}</div>

<p>The <strong><code>ConstrainBoolean</code></strong> 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.</p>

<h2 id="Properties">Properties</h2>

<dl>
 <dt><code>exact</code></dt>
 <dd>A Boolean which indicates a value the property must have.</dd>
 <dt><code>ideal</code></dt>
 <dd>A Boolean value indicating the ideal, but not required, value the property should ideally have. If possible, this value will be used, but the user agent will use the other value if it needs to in order to come up with a workable configuration.</dd>
</dl>

<p>You can also specify the value of the property as simply <code>true</code> or <code>false</code>, in which case the user agent will use that value if possible once all efforts have been made to match the <code>exact</code> and <code>ideal</code> values for other properties.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Media Capture', '#idl-def-ConstrainBoolean', 'ConstrainBoolean')}}</td>
   <td>{{Spec2('Media Capture')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<div class="note">
<p>Technically, <code>ConstrainBoolean</code> is actually based on an intermediary dictionary named <code>ConstrainBooleanParameters</code>, which adds <code>exact</code> and <code>ideal</code> to the simple Boolean type. However, for the sake of documentation clarity, the intermediate type (present only because of quirks in {{Glossary("WebIDL")}} syntax) is ignored here.</p>
</div>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Microsoft Edge</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(50)}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile(50)}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/API/Media_Streams_API">Media Capture and Streams API</a></li>
 <li><a href="/en-US/docs/Web/API/Media_Streams_API/Constraints">Capabilities, constraints, and settings</a></li>
 <li>{{domxref("MediaTrackConstraints")}}</li>
 <li>{{domxref("MediaTrackCapabilities")}}</li>
 <li>{{domxref("MediaTrackSupportedConstraints")}}</li>
</ul>
Revert to this revision