MediaStreamTrack object
Represents an audio or video source on the user's machine.
Syntax
var mediastream = new MediaStream(sequence <MediaStreamTrack> tracks);
Members
The MediaStreamTrack object has these types of members:
Events
The MediaStreamTrack object has these events.
| Event | Description |
|---|---|
| onended |
This event is fired when the MediaStreamTrack source will no longer provide any data. |
| onmute |
This event is fired when the source for MediaStreamTrack becomes temporarily unavailable. |
| onoverconstrained |
This event is fired when the browser is no longer able to satisfy the constraints after a new constraint has been added. |
| onunmute |
This event is fired when the source for MediaStreamTrack becomes available after being temporarily unavailable. |
Methods
The MediaStreamTrack object has these methods.
| Method | Description |
|---|---|
| applyConstraints |
Applies constraints to the MediaStreamTrack object. |
| getCapabilities |
Returns the dictionary of the names of the containable properties that the object supports. |
| getConstraints |
Returns the constraints that were set by the applyConstraints method. |
| getSettings |
Returns the settings of a MediaStreamTrack object. |
| stop |
Stops the capture device. |
Properties
The MediaStreamTrack object has these properties.
| Property | Access type | Description |
|---|---|---|
|
Controls the enabled state for the MediaStreamTrack object. | ||
| Read-only |
The identifier string of an object. | |
| Read-only |
Describes the kind of the represented device. | |
|
A label describing the device. | ||
|
Returns true if the track is muted or false if the track is not muted. | ||
| Read-only |
Returns true if the track source (audio or video) is a local device, but is shared so that this track cannot modify the source's settings. | |
|
Returns the state of the track. | ||
| Read-only |
Returns true if the track is sourced by a non-local source. | |
|
Returns the MediaStreamTrack object for the MediaStreamTrackEvent. |
Remarks
MediaStreamTrack has two states, "live" and "ended". A new MediaStreamTrack can be either depending on how it was created. The current state is returned readyState for MediaStreamTrack.
A MediaStreamTrack can be muted (audio) where it renders silence, or enabled/disabled (video) where it renders black frames.
Multiple MediaStreamTrack objects can point to the same media source.