docs.rodeo

MDN Web Docs mirror

MediaStreamTrack

{{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}} 

Instance properties

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.

Instance methods

Events

Listen to these events using {{domxref("EventTarget.addEventListener", "addEventListener()")}}  or by assigning an event listener to the oneventname property of this interface:

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN