--- title: MediaTrackSupportedConstraints.channelCount slug: Web/API/MediaTrackSupportedConstraints/channelCount translation_of: Web/API/MediaTrackSupportedConstraints/channelCount --- <p>{{APIRef("Media Capture and Streams")}}</p> <p><a href="https://developer.mozilla.org/ja/docs/Web/API/MediaTrackSupportedConstraints" title="MediaTrackSupportedConstraintsディクショナリは、MediaStreamTrackオブジェクトを実装しているuser agentやブラウザによって理解できる制約可能なプロパティの一覧を表します。MediaDevices.getSupportedConstraints()によって、MediaTrackSupportedConstraintsに適合するオブジェクトが戻り値として返されます。"><code>MediaTrackSupportedConstraints</code></a>ディクショナリーの<strong><code>channelCount</code></strong>プロパティは読み取り専用のBooleanの値です。<a href="https://developer.mozilla.org/ja/docs/Glossary/user_agent" rel="nofollow" title="この用語 (user agent) の定義はまだ書かれていません。ぜひご寄稿ください!">user agent</a>が<strong><code>channelCount</code></strong>の制約をサポートしている場合、<a href="https://developer.mozilla.org/ja/docs/Web/API/MediaDevices/getSupportedConstraints" title="MediaDevices インタフェースのgetSupportedConstraints() メソッドは、MediaTrackSupportedConstraintsディクショナリをベースとするオブジェクトを戻り値として返します。このオブジェクトのメンバーフィールドは、user agentが扱えるメディア制約に関するプロパティを表しています。"><code>MediaDevices.getSupportedConstraints()</code></a>の戻り値のオブジェクトに含まれ<code>true</code>が設定されます。この制約がサポートされない場合は含まれないため、<code>false</code>になることはありません。</p> <p>サポートされている制約のディクショナリーは<code>navigator.mediaDevices.getSupportedConstraints()</code>を呼び出すことで取得できます。</p> <h2 id="文法">文法</h2> <pre class="syntaxbox"><em>channelCountConstraintSupported</em> = <em>supportedConstraintsDictionary</em>["channelCount"];</pre> <h3 id="値">値</h3> <p>ユーザエージェント<code>channelCount</code>の制約をサポートしている場合、このプロパティはディクショナリーの中に含まれ、その値は常に<code>true</code>の値です。このプロパティが存在しない場合は、サポートされている制約ディクショナリーには存在しないため、<a href="https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/undefined" title="グローバルプロパティ undefined はプリミティブ値 undefined を表します。これは JavaScript におけるプリミティブ型の一つです。"><code>undefined</code></a>の値を取ることになります。</p> <h2 id="Example" name="Example">例</h2> <div class="hidden"> <h3 id="HTML">HTML</h3> <pre class="brush: html"><div id="result"> </div></pre> <h3 id="CSS">CSS</h3> <pre class="brush: css">#result { font: 14px "Arial", sans-serif; }</pre> <h3 id="JavaScript">JavaScript</h3> </div> <pre class="brush: js">let result = document.getElementById("result"); if (navigator.mediaDevices.getSupportedConstraints()["channelCount"]) { result.innerHTML = "Supported!"; } else { result.innerHTML = "Not supported!"; }</pre> <h3 id="結果">結果</h3> <p>{{ EmbedLiveSample('Example', 600, 80) }}</p> <h2 id="仕様">仕様</h2> <table class="standard-table"> <thead> <tr> <th scope="col">仕様</th> <th scope="col">状況</th> <th scope="col">コメント</th> </tr> </thead> <tbody> <tr> <td>{{ SpecName('Media Capture', '#widl-MediaTrackSupportedConstraints-channelCount', 'channelCount') }}</td> <td>{{ Spec2('Media Capture') }}</td> <td>初版</td> </tr> </tbody> </table> <h2 id="ブラウザ互換性">ブラウザ互換性</h2> <p>{{CompatibilityTable}}</p> <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>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>{{CompatVersionUnknown}}</td> <td>{{ CompatGeckoDesktop(50) }}</td> <td>{{CompatNo}}</td> <td>{{CompatVersionUnknown}}</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 Mobile</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>{{CompatUnknown}}</td> <td>{{CompatUnknown}}</td> <td>{{CompatVersionUnknown}}</td> </tr> </tbody> </table> </div> <h2 id="関連項目">関連項目</h2> <ul> <li><a href="/en-US/docs/Web/API/Media_Streams_API">Media Capture and Streams API</a></li> <li>{{domxref("MediaDevices.getSupportedConstraints()")}}</li> <li>{{domxref("MediaTrackSupportedConstraints")}}</li> <li>{{domxref("MediaStreamTrack")}}</li> </ul>