Skip to content

Commit

Permalink
simplify property access
Browse files Browse the repository at this point in the history
  • Loading branch information
Jxck committed Oct 5, 2017
1 parent 2af2c5d commit e5949bb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions getusermedia.html
Expand Up @@ -3804,7 +3804,7 @@ <h2>Constrainable Pattern</h2>
choose.</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["aspectRatio"]) {
if (!supports.aspectRatio) {
// Treat like an error.
}
const constraints = {
Expand All @@ -3825,7 +3825,7 @@ <h2>Constrainable Pattern</h2>
lighting conditions.</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["aspectRatio"] || !supports["frameRate"]) {
if (!supports.aspectRatio || !supports.frameRate) {
// Treat like an error.
}
const constraints = {
Expand All @@ -3849,7 +3849,7 @@ <h2>Constrainable Pattern</h2>
possible, give me a resolution as close to 1280x720 as possible."</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["width"] || !supports["height"]) {
if (!supports.width || !supports.height) {
// Treat like an error.
}
const constraints = {
Expand Down Expand Up @@ -4217,7 +4217,7 @@ <h2>Methods</h2>
<code>MediaStreamTrack</code></a>.</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["facingMode"]) {
if (!supports.facingMode) {
// Treat like an error.
}
const constraints = {
Expand All @@ -4237,7 +4237,7 @@ <h2>Methods</h2>
height:</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["deviceId"]) {
if (!supports.deviceId) {
// Treat like an error.
}
const constraints = {
Expand All @@ -4251,7 +4251,7 @@ <h2>Methods</h2>
<p>And here's one for an audio track:</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["deviceId"] || !supports["volume"]) {
if (!supports.deviceId || !supports.volume) {
// Treat like an error.
}
const constraints = {
Expand All @@ -4264,7 +4264,7 @@ <h2>Methods</h2>
<p>Here's an example of use of ideal:</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["aspectRatio"] || !supports["facingMode"]) {
if (!supports.aspectRatio || !supports.facingMode) {
// Treat like an error.
}
const stream = await navigator.mediaDevices.getUserMedia({
Expand All @@ -4283,7 +4283,7 @@ <h2>Methods</h2>
down to VGA.":</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["width"] || !supports["height"]) {
if (!supports.width || !supports.height) {
// Treat like an error.
}
const stream = await navigator.mediaDevices.getUserMedia({
Expand All @@ -4297,7 +4297,7 @@ <h2>Methods</h2>
VGA.":</p>
<pre class="example">
const supports = navigator.mediaDevices.getSupportedConstraints();
if (!supports["width"] || !supports["height"] || !supports["facingMode"]) {
if (!supports.width || !supports.height || !supports.facingMode) {
// Treat like an error.
}
const stream = await navigator.mediaDevices.getUserMedia({
Expand Down

0 comments on commit e5949bb

Please sign in to comment.