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.

EventDescription
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.

MethodDescription
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.

PropertyAccess typeDescription

enabled

Controls the enabled state for the MediaStreamTrack object.

id

Read-only

The identifier string of an object.

kind

Read-only

Describes the kind of the represented device.

label

A label describing the device.

muted

Returns true if the track is muted or false if the track is not muted.

readonly

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.

readyState

Returns the state of the track.

remote

Read-only

Returns true if the track is sourced by a non-local source.

track

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.

 

 

Show: