MediaStreamTrack

The MediaStreamTrack interface of the Media Capture and Streams API represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well.

MDN Reference

Inheritors

Properties

Link copied to clipboard

The contentHint property of the MediaStreamTrack interface is a string that hints at the type of content the track contains.

Link copied to clipboard

The enabled property of the true if the track is allowed to render the source stream or false if it is not.

Link copied to clipboard
val id: String

The id read-only property of the MediaStreamTrack interface returns a string containing a unique identifier (GUID) for the track, which is generated by the user agent.

Link copied to clipboard

The kind read-only property of the MediaStreamTrack interface returns a string set to 'audio' if the track is an audio track and to 'video' if it is a video track.

Link copied to clipboard

The label read-only property of the MediaStreamTrack interface returns a string containing a user agent-assigned label that identifies the track source, as in 'internal microphone'.

Link copied to clipboard

The muted read-only property of the indicating whether or not the track is currently unable to provide media output.

Link copied to clipboard

The readyState read-only property of the MediaStreamTrack interface returns an enumerated value giving the status of the track.

Functions

Link copied to clipboard
suspend fun applyConstraints(constraints: MediaTrackConstraints = definedExternally)

The applyConstraints() method of the MediaStreamTrack interface applies a set of constraints to the track; these constraints let the website or app establish ideal values and acceptable ranges of values for the constrainable properties of the track, such as frame rate, dimensions, echo cancellation, and so forth.

Link copied to clipboard
fun applyConstraintsAsync(constraints: MediaTrackConstraints = definedExternally): Promise<Void>
Link copied to clipboard

The clone() method of the MediaStreamTrack interface creates a duplicate of the MediaStreamTrack.

Link copied to clipboard
Link copied to clipboard

The getCapabilities() method of the MediaStreamTrack interface returns an object detailing the accepted values or value range for each constrainable property of the associated MediaStreamTrack, based upon the platform and user agent.

Link copied to clipboard

The getConstraints() method of the MediaStreamTrack interface returns a recently established for the track using a prior call to constraints indicate values and ranges of values that the website or application has specified are required or acceptable for the included constrainable properties.

Link copied to clipboard

The getSettings() method of the object containing the current values of each of the constrainable properties for the current MediaStreamTrack.

Link copied to clipboard
fun stop()

The stop() method of the MediaStreamTrack interface stops the track.

Link copied to clipboard