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.Gets an MediaStreamTrack object.
An MediaStreamTrack object.
Gets the RTCRtpTransceiver instance of the current track.
This method is currently mainly used for end-to-end encryption of video streams (Beta).
If the SDK experiences a reconnection, the
RTCRtpTransceiverinstance corresponding to the current track might change. You can obtain the newRTCRtpTransceiverinstance through the following callbacks:
- For a local track: [ILocalTrack.transceiver-updated]event_transceiver_updated
- For a remote track: [IRemoteTrack.transceiver-updated]event_transceiver_updated_2
Optional type: StreamTypeThe type of the video stream. See StreamType.
The RTCRtpTransceiver instance of the current track.
from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]IAgoraRTCClient.getLocalVideoStats and [AgoraRTCClient.getLocalAudioStats]IAgoraRTCClient.getLocalAudioStats instead.
Gets the statistics of a local track.
Note: When getting the statistics of a local video track, you cannot get the
encodeDelayproperty 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.The event name.
See [track-updated]event_track_updated.
Triggers when a media track is updated.
The media stream track. See MediaStreamTrack.
Events
The event name.
See [track-ended]event_track_ended.
Occurs when a audio or video track ends.
Reasons may include:
MediaStreamTrack.ILocalTrack
Events
Adds an event listener.
The event name.
See [ILocalTrack.transceiver-updated]event_transceiver_updated.
Occurs when the RTCRtpTransceiver instance of the current track is updated.
The new RTCRtpTransceiver instance.
Optional type: StreamTypeThe type of the video stream to which the current track belongs. See StreamType.
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.Whether to enable the track:
true: Enable the track.false: Disable the track.
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.
- Do not call
setEnabledandsetMutedtogether.
Sends or stops sending the media data of the track.
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.
4.6.0
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.
- 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?.- Do not call
setEnabledandsetMutedtogether.
LocalTrackis the basic interface for local tracks, providing public methods for [LocalAudioTrack]ILocalAudioTrack and [LocalVideoTrack]ILocalVideoTrack.