Whether a media track is playing on the webpage:
true
: The media track is playing on the webpage.false
: The media track is not playing on the webpage.The type of a media track:
"audio"
: Audio track."video"
: Video track.DEPRECATED from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]getLocalVideoStats and [AgoraRTCClient.getLocalAudioStats]getLocalAudioStats instead.
Gets the statistics of a local track.
Note: When getting the statistics of a local video track, you cannot get the
encodeDelay
property on iOS.
Gets the label of a local track.
The label that the SDK returns may include:
createMicrophoneAudioTrack
or createCameraVideoTrack
.sourceId
property, if the track is created by calling createScreenVideoTrack
.createCustomAudioTrack
or createCustomVideoTrack
.Listens for a specified event.
When the specified event happens, the SDK triggers the callback that you pass.
The event name.
The callback to trigger.
Occurs when a audio or video track ends.
Reasons may include:
ILocalTrack
Events
Plays a media track on the webpage.
Optional
element: string | HTMLElementSpecifies a DOM element. The SDK will create a <video>
element under the specified DOM element to play the video track. You can specify a DOM element in either of following ways:
string
: Specify the ID of the DOM element.HTMLElement
: Pass a DOM object.Since
4.0.0
Enables/Disables the track.
After a track is disabled, the SDK stops playing and publishing the track.
- Disabling a track does not trigger the [LocalTrack.on("track-ended")]event_track_ended event.
- If a track is published, disabling this track triggers the [user-unpublished]IAgoraRTCClient.event_user_unpublished event on the remote client, and re-enabling this track triggers the [user-published]IAgoraRTCClient.event_user_published event.
Whether to enable the track:
true
: Enable the track.false
: Disable the track.Sends or stops sending the media data of the track.
Since
4.6.0
Calling setMuted(true)
does not stop capturing audio or video and takes shorter time to take effect than setEnabled. For details, see What are the differences between setEnabled and setMuted?.
If the track is published, a successful call of setMuted(true)
triggers the [user-unpublished]IAgoraRTCClient.event_user_unpublished event on the remote client, and a successful call of setMuted(false)
triggers the [user-published]IAgoraRTCClient.event_user_published event.
Whether to stop sending the media data of the track:
true
: Stop sending the media data of the track.false
: Resume sending the media data of the track.Generated using TypeDoc
LocalTrack
is the basic interface for local tracks, providing public methods for [LocalAudioTrack]ILocalAudioTrack and [LocalVideoTrack]ILocalVideoTrack.