aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/mediadevices/getsupportedconstraints/index.html
blob: 973a1776743908fde0d1004c8a32e3c43729a225 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
title: MediaDevices.getSupportedConstraints()
slug: Web/API/MediaDevices/getSupportedConstraints
translation_of: Web/API/MediaDevices/getSupportedConstraints
---
<p>{{APIRef("Media Capture and Streams")}}</p>

<p>{{domxref("MediaDevices")}} インタフェースの<code><strong>getSupportedConstraints</strong></code><strong><code>()</code></strong> メソッドは、{{domxref("MediaTrackSupportedConstraints")}}ディクショナリをベースとするオブジェクトを戻り値として返します。このオブジェクトのメンバーフィールドは、{{Glossary("user agent")}}が扱えるメディア制約に関するプロパティを表しています。</p>

<h2 id="文法">文法</h2>

<pre class="syntaxbox">var <em>supportedConstraints</em> = navigator.mediaDevices.getSupportedConstraints();</pre>

<h3 id="パラメータ">パラメータ</h3>

<p>なし。</p>

<h3 id="戻り値">戻り値</h3>

<p>{{domxref("MediaTrackSupportedConstraints")}}ディクショナリをベースにした新しいオブジェクトです。このオブジェクトはユーザエージェントが扱えるメディア制約の一覧を含みます。この一覧に含まれているものはユーザエージェントが取り扱えるものだけなので、全てのBoolean型のプロパティは<code>true</code>の値になっています。</p>

<h2 id="Example" name="Example"></h2>

<p>この例は、実行中のブラウザでサポートされている制約の一覧を出力するものです。</p>

<div class="hidden">
<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;p&gt;あなたのブラウザは、以下のメディア制約をサポートしています。&lt;/p&gt;

&lt;ul id="constraintList"&gt;
&lt;/ul&gt;</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css">body {
  font: 15px Arial, sans-serif;
}</pre>

<h3 id="JavaScript">JavaScript</h3>
</div>

<pre class="brush: js">let constraintList = document.getElementById("constraintList");
let supportedConstraints = navigator.mediaDevices.getSupportedConstraints();

for (let constraint in supportedConstraints) {
  if (supportedConstraints.hasOwnProperty(constraint)) {
    let elem = document.createElement("li");

    elem.innerHTML = "&lt;code&gt;" + constraint + "&lt;/code&gt;";
    constraintList.appendChild(elem);
  }
}</pre>

<h3 id="実行結果">実行結果</h3>

<p>{{ EmbedLiveSample('Example', 600, 350) }}</p>

<h2 id="仕様">仕様</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">仕様</th>
   <th scope="col">状態</th>
   <th scope="col">コメント</th>
  </tr>
  <tr>
   <td>{{SpecName('Media Capture', '#widl-MediaDevices-getSupportedConstraints-MediaTrackSupportedConstraints', 'getSupportedConstraints()')}}</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>Microsoft Edge</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(53)}}</td>
   <td>{{CompatGeckoDesktop(44) }}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{ CompatUnknown }}</td>
   <td>{{CompatOpera(40)}}</td>
   <td>{{CompatSafari(11)}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android Webview</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(53)}}</td>
   <td>{{CompatChrome(52)}}</td>
   <td>{{ CompatGeckoMobile(50) }}</td>
   <td>{{ CompatUnknown }}</td>
   <td>{{CompatOperaMobile(40)}}</td>
   <td>{{CompatSafari(11)}}</td>
  </tr>
 </tbody>
</table>
</div>