aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/mediastreamtrack/getcapabilities/index.html
blob: cc44f48f133acddaa7403795033c8590fd7e1d44 (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
---
title: MediaStreamTrack.getCapabilities()
slug: Web/API/MediaStreamTrack/getCapabilities
tags:
  - API
  - Media Capture and Streams API
  - Media Streams API
  - MediaStreamTrack
  - getCapabilities
  - 媒体API
translation_of: Web/API/MediaStreamTrack/getCapabilities
---
<p>{{APIRef("Media Capture and Streams")}}</p>

<p><span class="seoSummary">{{domxref("MediaStreamTrack")}} 接口的 <strong><code>getCapabilities()</code></strong> 方法返回一个  {{domxref('MediaTrackCapabilities')}} 对象,此对象表示每个可调节属性的值或者范围,该特性依赖于平台和{{Glossary("user agent")}}.</span></p>

<p>一旦你知道了浏览器的功能,你的脚本可以通过调用 {{domxref("MediaStreamTrack.applyConstraints", "applyConstraints()")}} 来请求配置为匹配理想或可接受的设置。参考{{SectionOnPage("/zh-CN/docs/Web/API/Media_Streams_API", "Capabilities and constraints")}} 以了解受限制属性的具体细节。</p>

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

<pre class="syntaxbox">var <em>capabilities</em> = <em>MediaStreamTrack</em>.getCapabilities();</pre>

<h3 id="参数">参数</h3>

<p>没有参数。</p>

<h3 id="返回值"><span style="font-size: 1.714rem; letter-spacing: -0.021em; line-height: 1;">返回值</span></h3>

<p>{{domxref('MediaTrackCapabilities')}} object which specifies the value or range of values which are supported for each of the user agent's supported constrainable properties.</p>

<h2 id="规范">规范</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', '#dom-mediastreamtrack-getconstraints', 'getConstraints()')}}</td>
   <td>{{Spec2('Media Capture')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("api.MediaStreamTrack.getCapabilities")}}</p>