files/en-us/web/api/mediastreamtrack/index.md
{{APIRef("Media Capture and Streams")}}
The MediaStreamTrack interface of the {{domxref("Media Capture and Streams API", "", "", "nocode")}} represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well.
Some user agents subclass this interface to provide more precise information or functionality, such as {{domxref("CanvasCaptureMediaStreamTrack")}}.
{{InheritanceDiagram}}
In addition to the properties listed below, MediaStreamTrack has constrainable properties which can be set using {{domxref("MediaStreamTrack.applyConstraints", "applyConstraints()")}} and accessed using {{domxref("MediaStreamTrack.getConstraints", "getConstraints()")}} and {{domxref("MediaStreamTrack.getSettings", "getSettings()")}}. See Capabilities, constraints, and settings to learn how to correctly work with constrainable properties. Not doing so correctly will result in your code being unreliable.
{{domxref("MediaStreamTrack.contentHint")}}
{{domxref("MediaStreamTrack.enabled")}}
: A Boolean whose 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.
[!NOTE] You can implement standard "mute" functionality by setting
enabledtofalse. Themutedproperty refers to a condition in which there's no media because of a technical issue.
{{domxref("MediaStreamTrack.id")}} {{ReadOnlyInline}}
{{domxref("MediaStreamTrack.kind")}} {{ReadOnlyInline}}
"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 disassociated from its source.{{domxref("MediaStreamTrack.label")}} {{ReadOnlyInline}}
"internal microphone". The string may be left empty and is empty as long as no source has been connected. When the track is disassociated from its source, the label is not changed.{{domxref("MediaStreamTrack.muted")}} {{ReadOnlyInline}}
: Returns a Boolean value indicating whether the track is unable to provide media data due to a technical issue.
[!NOTE] You can implement standard "mute" functionality by setting
enabledtofalse, and unmute the media by setting it back totrueagain.
{{domxref("MediaStreamTrack.readyState")}} {{ReadOnlyInline}}
"live" 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 {{domxref("MediaStreamTrack.enabled", "enabled")}} attribute."ended" which indicates that the input is not giving any more data and will never provide new data.MediaStreamTrack.MediaStreamTrack.MediaStreamTrack.MediaStreamTrack's constrainable properties.ended.Listen to these events using {{domxref("EventTarget.addEventListener", "addEventListener()")}} or by assigning an event listener to the oneventname property of this interface:
ended), except when the track is ended by calling {{domxref("MediaStreamTrack.stop")}}.MediaStreamTrack when the value of the {{domxref("MediaStreamTrack.muted", "muted")}} property is changed to true, indicating that the track is unable to provide data temporarily (such as when the network is experiencing a service malfunction).muted state.{{Specifications}}
{{Compat}}