Overview
TheJitsiLocalTrack class represents a single local media track (either audio or video). One JitsiLocalTrack corresponds to one WebRTC MediaStreamTrack captured from the user’s device.
Constructor
Object containing track configuration:
constraints: The constraints used for creating the trackrtcId: The ID assigned by the RTC modulestream: The WebRTC MediaStream (parent of the track)track: The underlying WebRTC MediaStreamTrackmediaType: The MediaType (‘audio’ or ‘video’)videoType: The VideoType (‘camera’ or ‘desktop’)effects: Array of effects to be applieddeviceId: The ID of the local devicefacingMode: The camera facing mode (mobile only)sourceId: The Chrome media source ID for desktop sharingsourceType: The type of source the track originates from
Methods
mute()
Asynchronously mutes this track.Resolves when the track is successfully muted
unmute()
Asynchronously unmutes this track.Resolves when the track is successfully unmuted
dispose()
Stops sending the media track and removes it from the HTML.Resolves when disposal is complete
isLocal()
Returns true for local tracks.Always returns true
isMuted()
Checks if the stream is muted.True if the stream is muted, false otherwise
isEnded()
Returns if the associated MediaStreamTrack is in the ‘ended’ state.True if the track has ended
isReceivingData()
Checks whether the attached MediaStream is receiving data from source.True if the stream is receiving data, false otherwise
getCameraFacingMode()
Returns the camera facing mode for video tracks from camera.‘user’ or ‘environment’ for camera tracks, undefined for other types
getCaptureResolution()
Returns the capture resolution of the video track.The capture resolution in pixels
getDeviceId()
Returns the device ID associated with the track.The device identifier
getDuration()
Returns the duration of the track.The duration of the track in seconds
getParticipantId()
Returns the participant ID which owns the track.The ID of the participant (corresponds to Colibri endpoint ID/MUC nickname)
getSourceName()
Returns the source name associated with the track.The source name identifier
getSsrc()
Returns the primary SSRC associated with the track.The synchronization source identifier
setConference()
Sets the JitsiConference object associated with the track.The JitsiConference object to associate with the track
setEffect()
Sets the effect and switches between the modified stream and original one.The effect instance to be used. Pass undefined to remove the current effect
Resolves when the effect is successfully applied
setSourceName()
Sets the source name to be used for signaling the track.The source name to assign
setSsrc()
Sets the primary SSRC for the track.The SSRC to assign to the track
stopStream()
Stops the associated MediaStream.toString()
Creates a text representation of this local track instance.String representation in format: LocalTrack[rtcId,mediaType]
applyConstraints()
Applies media constraints to the current MediaStreamTrack.Media constraints to apply:
autoGainControl: Enable/disable automatic gain controlechoCancellation: Enable/disable echo cancellationnoiseSuppression: Enable/disable noise suppressionchannelCount: Number of audio channels
Resolves when constraints are successfully applied
onByteSentStatsReceived()
Handles bytes sent statistics (used only for audio tracks to detect audio issues).The peer connection reporting the bytes sent stat
The new bytes sent value
Properties
The ID assigned by the RTC module on instance creation
The ID of the local device for this track
The Chrome media source ID for desktop sharing tracks
The type of source the track originates from
The capture resolution for video tracks
The maximum enabled resolution for video tracks
Track metadata including timestamp and display surface information
Events
JitsiLocalTrack extends JitsiTrack and emits additional events:LOCAL_TRACK_STOPPED- Fired when the track stopsTRACK_MUTE_CHANGED- Fired when the mute status changesNO_DATA_FROM_SOURCE- Fired when no data is received from the sourceNO_AUDIO_INPUT- Fired when no audio input is detected