Skip to main content

MediaTrack

Properties

PropertyModifierTypeDescription
idreadonlystringA unique identifier for the track same as MediaStreamTrack.id if track is available otherwise it uses the id from the construction or the kind. See MediaTrackInit
stopped?readonlybooleanIt maps to MediaStreamTrack['readyState'] When true the track's readyState is ended, false means live otherwise the track is not available
suspended?readonlybooleanIndicate that the media has been suspended by the User Agent, and it could happen at any time. undefined means the track is not available
kindreadonly"audioinput" | "videoinput"-
label?readonlystring-
previousMediaTrack?readonlyMediaTrack-
track?readonlyMediaStreamTrackThe MediaStreamTrack object representing the track See https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack
input?readonlyMediaDeviceInfoLikeThe MediaDeviceInfo object representing the device that the track is connected to. See https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
expectedInput?readonlyMediaDeviceInfoLikeThe MediaDeviceInfo object representing the device that the track is expected to be connected to. See https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
muted?publicbooleanThe current mute state of the track. undefined means the track is not available
sourcereadonlyMediaTrackThe source track that it is originated from

Methods

mute()

mute(toMute, soft?): void;

Mute the track

Parameters

ParameterTypeDescription
toMutebooleantrue to mute the track, false to unmute
soft?booleantrue to indicate a soft mute i.e. setting the track to NOT enabled false or undefined for default mute

Returns

void


getSettings()

getSettings(): ExtendedMediaTrackSettings;

Returns

ExtendedMediaTrackSettings


getConstraints()

getConstraints(): InputDeviceConstraint;

Returns

InputDeviceConstraint


applyConstraints()

applyConstraints(constraints): Promise<void>;

Parameters

ParameterType
constraintsInputDeviceConstraint

Returns

Promise<void>


release()

release(): Promise<void>;

Returns

Promise<void>


clone()

clone(signals?, label?): MediaTrack;

Parameters

ParameterType
signals?MediaSignals
label?string

Returns

MediaTrack


toJSON()

toJSON(): unknown;

Returns

unknown