Interface MediaStreamTrack
contentHint: string;
enabled: boolean;
id: string;
kind: string;
label: string;
muted: boolean;
onended: ((this: MediaStreamTrack, ev: Event) => any) | null;
onmute: ((this: MediaStreamTrack, ev: Event) => any) | null;
onunmute: ((this: MediaStreamTrack, ev: Event) => any) | null;
readyState: MediaStreamTrackState;
addEventListener<K extends keyof MediaStreamTrackEventMap>(
type: K,
listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
applyConstraints(constraints?: MediaTrackConstraints): Promise<void>;
clone(): MediaStreamTrack;
dispatchEvent(event: Event): boolean;
getCapabilities(): MediaTrackCapabilities;
getConstraints(): MediaTrackConstraints;
getSettings(): MediaTrackSettings;
removeEventListener<K extends keyof MediaStreamTrackEventMap>(
type: K,
listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
stop(): void;
}
Hierarchy
- EventTarget
- MediaStreamTrack
Properties
contentHint
The contentHint property of the MediaStreamTrack interface is a string that hints at the type of content the track contains.
enabled
The enabled property of the true if the track is allowed to render the source stream or false if it is not.
Readonlyid
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.
Readonlykind
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.
Readonlylabel
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'.
Readonlymuted
The muted read-only property of the indicating whether or not the track is currently unable to provide media output.
onended
onmute
onunmute
ReadonlyreadyState
The readyState read-only property of the MediaStreamTrack interface returns an enumerated value giving the status of the track.
Methods
addEventListener
- addEventListener<K extends keyof MediaStreamTrackEventMap>(
type: K,
listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof MediaStreamTrackEventMap
Parameters
- type: K
- listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
applyConstraints
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.Parameters
Optionalconstraints: MediaTrackConstraints
Returns Promise<void>
clone
The
clone()method of the MediaStreamTrack interface creates a duplicate of theMediaStreamTrack.Returns MediaStreamTrack
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
getCapabilities
The
getCapabilities()method of the MediaStreamTrack interface returns an object detailing the accepted values or value range for each constrainable property of the associatedMediaStreamTrack, based upon the platform and user agent.Returns MediaTrackCapabilities
getConstraints
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.Returns MediaTrackConstraints
getSettings
The
getSettings()method of the object containing the current values of each of the constrainable properties for the currentMediaStreamTrack.Returns MediaTrackSettings
removeEventListener
- removeEventListener<K extends keyof MediaStreamTrackEventMap>(
type: K,
listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends keyof MediaStreamTrackEventMap
Parameters
- type: K
- listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
stop
The
stop()method of the MediaStreamTrack interface stops the track.Returns void
The
MediaStreamTrackinterface 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