--- title: MediaStreamTrack slug: Web/API/MediaStreamTrack translation_of: Web/API/MediaStreamTrack ---
{{APIRef("Media Capture and Streams")}}

Resumo

A interface MediaStream representa uma stream de conteúdo de mídia. Uma stream consiste em várias tracks, como faixas de áudio e vídeo.

Properties

{{domxref("MediaStreamTrack.enabled")}}
Is a Boolean value with a value of true if the track is enabled, that is allowed to render the media source stream; or false 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.
{{domxref("MediaStreamTrack.id")}} {{readonlyInline}}
Returns a {{domxref("DOMString")}} containing a unique identifier (GUID) for the track; it is generated by the browser.
{{domxref("MediaStreamTrack.kind")}} {{readonlyInline}}
Returns a {{domxref("DOMString")}} set to "audio" if the track is an audio track and to "video", if it is a video track. It doesn't change if the track is deassociated from its source.
{{domxref("MediaStreamTrack.label")}} {{readonlyInline}}
Returns a {{domxref("DOMString")}} containing a user agent-assigned label that identifies the track source, as in "internal microphone". 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.
{{domxref("MediaStreamTrack.muted")}} {{readonlyInline}}
Returns a Boolean value with a value of true if the track is muted, false otherwise.
{{domxref("MediaStreamTrack.readonly")}} {{readonlyInline}}
Returns a Boolean value with a value of true if the track is readonly (such a video file source or a camera that settings can't be modified),false otherwise.
{{domxref("MediaStreamTrack.readyState")}} {{readonlyInline}}
Returns an enumerated value giving the status of the track.It takes one of the following values:
{{domxref("MediaStreamTrack.remote")}} {{readonlyInline}}
Returns a boolean value with a value of true if the track is sourced by a {{domxref("RTCPeerConnection")}}, false otherwise.

Event handlers

{{domxref("MediaStreamTrack.onstarted")}}
Is a {{domxref("EventHandler")}} 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.
{{domxref("MediaStreamTrack.onmute")}}
Is a {{domxref("EventHandler")}} containing the action to perform when an {{event("mute")}} event is fired on the object, that is when the streaming is terminating.
{{domxref("MediaStreamTrack.onunmute")}}
Is a {{domxref("EventHandler")}} 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.
{{domxref("MediaStreamTrack.onoverconstrained")}}
Is a {{domxref("EventHandler")}} 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.
{{domxref("MediaStreamTrack.oneended")}}
Is a {{domxref("EventHandler")}} 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.

Methods

{{domxref("MediaStreamTrack.getConstraints()")}}
 
{{domxref("MediaStreamTrack.applyConstraints()")}}
 
{{domxref("MediaStreamTrack.getSettings()")}}
 
{{domxref("MediaStreamTrack.getCapabilities()")}}
 
{{domxref("MediaStreamTrack.clone()")}}
 
{{domxref("MediaStreamTrack.stop()")}}
Stops playing the source associated to the track, both the source and the track are deassociated. The track state is set to ended.

Specifications

Specification Status Comment
{{SpecName('Media Capture', '#mediastreamtrack', 'MediaStreamTrack')}} {{Spec2('Media Capture')}} Initial definition

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}}
stop() {{CompatUnknown}} {{CompatGeckoDesktop(34)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
muted, onmuted, onunmuted, readonly, readyState, remote, onstarted, onended, onoverconstrained, appendConstraint(), applyConstraints(), constraints(), getConstraints() {{CompatUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}}
stop()
{{CompatUnknown}} {{CompatGeckoDesktop(34)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
muted, onmuted, onunmuted, readonly, readyState, remote, onstarted, onended, onoverconstrained, appendConstraint(), applyConstraints(), constraints(), getConstraints() {{CompatUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}}

See also