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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
---
title: MediaStreamTrack
slug: Web/API/MediaStreamTrack
translation_of: Web/API/MediaStreamTrack
---
<div>{{APIRef("Media Capture and Streams")}}</div>
<h2 id="Resumo">Resumo</h2>
<p>A interface <strong><code>MediaStream</code></strong><strong> r</strong>epresenta uma stream de conteúdo de mídia. Uma stream consiste em várias <em>tracks</em>, como faixas de áudio e vídeo.</p>
<h2 id="Properties">Properties</h2>
<dl>
<dt>{{domxref("MediaStreamTrack.enabled")}}</dt>
<dd>Is a Boolean value with a value of <code>true</code> if the track is enabled, that is allowed to render the media source stream; or <code>false</code> if it is disabled, that is not rendering the media source stream but silence and blackness. If the track has been disconnected, this value can be changed but has no more effect.</dd>
<dt>{{domxref("MediaStreamTrack.id")}} {{readonlyInline}}</dt>
<dd>Returns a {{domxref("DOMString")}} containing a unique identifier (GUID) for the track; it is generated by the browser.</dd>
<dt>{{domxref("MediaStreamTrack.kind")}} {{readonlyInline}}</dt>
<dd>Returns a {{domxref("DOMString")}} set to <code>"audio"</code> if the track is an audio track and to <code>"video"</code>, if it is a video track. It doesn't change if the track is deassociated from its source.</dd>
<dt>{{domxref("MediaStreamTrack.label")}} {{readonlyInline}}</dt>
<dd>Returns a {{domxref("DOMString")}} containing a user agent-assigned label that identifies the track source, as in <code>"internal microphone"</code>. The string may be left empty and is empty as long as no source has been connected. When the track is deassociated from its source, the label is not changed.</dd>
<dt>{{domxref("MediaStreamTrack.muted")}} {{readonlyInline}}</dt>
<dd>Returns a Boolean value with a value of <code>true</code> if the track is muted, <code>false</code> otherwise.</dd>
<dt>{{domxref("MediaStreamTrack.readonly")}} {{readonlyInline}}</dt>
<dd>Returns a Boolean value with a value of <code>true</code> if the track is readonly (such a video file source or a camera that settings can't be modified),<code>false</code> otherwise.</dd>
<dt>{{domxref("MediaStreamTrack.readyState")}} {{readonlyInline}}</dt>
<dd>Returns an enumerated value giving the status of the track.It takes one of the following values:
<ul>
<li><code>"live"</code> which indicates that an input is connected and does its best-effort in providing real-time data. In that case, the output of data can be switched on or off using the <code>MediaStreamTrack.enabled</code> attribute.</li>
<li><code>"ended"</code> which indicates that the input is not giving any more data and will never provide new data.</li>
</ul>
</dd>
<dt>{{domxref("MediaStreamTrack.remote")}} {{readonlyInline}}</dt>
<dd>Returns a boolean value with a value of <code>true</code> if the track is sourced by a {{domxref("RTCPeerConnection")}}, <code>false</code> otherwise.</dd>
</dl>
<h3 id="Event_handlers">Event handlers</h3>
<dl>
<dt>{{domxref("MediaStreamTrack.onstarted")}}</dt>
<dd>Is a {{event("Event_handlers")}} containing the action to perform when an {{event("started")}} event is fired on the object, that is when a new {{domxref("MediaStreamTrack")}} object is added.</dd>
<dt>{{domxref("MediaStreamTrack.onmute")}}</dt>
<dd>Is a {{event("Event_handlers")}} containing the action to perform when an {{event("mute")}} event is fired on the object, that is when the streaming is terminating.</dd>
<dt>{{domxref("MediaStreamTrack.onunmute")}}</dt>
<dd>Is a {{event("Event_handlers")}} containing the action to perform when an {{event("unmute")}} event is fired on the object, that is when a {{domxref("MediaStreamTrack")}} object is removed from it.</dd>
<dt>{{domxref("MediaStreamTrack.onoverconstrained")}}</dt>
<dd>Is a {{event("Event_handlers")}} containing the action to perform when an {{event("overconstrained")}} event is fired on the object, that is when a {{domxref("MediaStreamTrack")}} object is removed from it.</dd>
<dt>{{domxref("MediaStreamTrack.oneended")}}</dt>
<dd>Is a {{event("Event_handlers")}} containing the action to perform when an {{event("ended_(MediaStream)", "ended")}} event is fired on the object, that is when a {{domxref("MediaStreamTrack")}} object is removed from it.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<dl>
<dt>{{domxref("MediaStreamTrack.getConstraints()")}}</dt>
<dd> </dd>
<dt>{{domxref("MediaStreamTrack.applyConstraints()")}}</dt>
<dd> </dd>
<dt>{{domxref("MediaStreamTrack.getSettings()")}}</dt>
<dd> </dd>
<dt>{{domxref("MediaStreamTrack.getCapabilities()")}}</dt>
<dd> </dd>
<dt>{{domxref("MediaStreamTrack.clone()")}}</dt>
<dd> </dd>
<dt>{{domxref("MediaStreamTrack.stop()")}}</dt>
<dd>Stops playing the source associated to the track, both the source and the track are deassociated. The track state is set to <code>ended</code>.</dd>
</dl>
<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', '#mediastreamtrack', 'MediaStreamTrack')}}</td>
<td>{{Spec2('Media Capture')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<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>Opera</th>
<th>Safari (WebKit)</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatUnknown}}</td>
</tr>
<tr>
<td><code>stop()</code></td>
<td>{{CompatUnknown}}</td>
<td>{{CompatGeckoDesktop(34)}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
<tr>
<td><code>muted</code>, <code>onmuted</code>, <code>onunmuted</code>, <code>readonly</code>, <code>readyState</code>, <code>remote</code>, <code>onstarted</code>, <code>onended</code>, <code>onoverconstrained</code>, <code>appendConstraint()</code>, <code>applyConstraints()</code>, <code>constraints()</code>, <code>getConstraints()</code></td>
<td>{{CompatUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</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>Firefox Mobile (Gecko)</th>
<th>IE Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatUnknown}}</td>
</tr>
<tr>
<td>
<table class="compat-table">
<tbody>
<tr>
<td><code>stop()</code></td>
</tr>
</tbody>
</table>
</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatGeckoDesktop(34)}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
<tr>
<td><code>muted</code>, <code>onmuted</code>, <code>onunmuted</code>, <code>readonly</code>, <code>readyState</code>, <code>remote</code>, <code>onstarted</code>, <code>onended</code>, <code>onoverconstrained</code>, <code>appendConstraint()</code>, <code>applyConstraints()</code>, <code>constraints()</code>, <code>getConstraints()</code></td>
<td>{{CompatUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/WebRTC/MediaStream_API" title="/en-US/docs/WebRTC/MediaStream_API">Using the MediaStream API</a></li>
</ul>
|