Class hierarchy
BaseTrack
Base class of all tracks, providing access to track metadata.id
kind
'audio' or 'video'.
desc
'camera_big' or 'screen'.
getInfo
Gets the full track info, such as resolution, bitrate, and sample rate.TrackInfo; see Types
When a local track is published to multiple channels at once, the same track has separate track info in each channel. In that casegetInfo()throws; usechannel.getPublishInfo(track)instead to query the track info in a given channel. See Multi-channel.
getUid
Gets the UID of the user who owns the track.getMediaStreamTrack
Gets the underlyingMediaStreamTrack, for scenarios such as the Web Audio API or custom post-processing.
LocalAudioTrack
Base class for local audio tracks, also used for custom audio streams, such as the return value ofsrtc.createLocalCustomAudioTrack(...).
Extends BaseTrack.
startPlay
Plays the audio, for local monitoring.stopPlay
Stops playback and releases the playback device.getVolume
Gets the current audio input volume, in the range 0–100.isPlaying
Whether it’s currently playing.setProcessor
Attaches an audio processor (such as RNN noise suppression or voice changing). Call it afterstartCapture has produced a track; when you pass an array, the processors are chained in order. Published tracks can also have processors attached, and the SDK switches without renegotiation; after a device switch, processors are reattached automatically. See Audio/video processors.
removeProcessor
Detaches the attached processor, restores the original captured track, and releases processor resources.LocalMicTrack
Local microphone track, extendsLocalAudioTrack, created with srtc.createLocalMicTrack.
startCapture
Starts capture and requests microphone permission from the user.stopCapture
Stops capture and releases the microphone device.changeDeviceId
Hot-switches the microphone device.LocalScreenAudioTrack
System audio track that comes with screen sharing, extendsLocalAudioTrack.
You usually don’t create this class manually; get it through LocalScreenTrack.getAudioTrack().
stopCapture
Stops system audio capture.The other playback methods are inherited fromLocalAudioTrack, such asstartPlay(),stopPlay(), andisPlaying().
LocalVideoTrack
Base class for local video tracks, also used for custom video streams, such as the return value ofsrtc.createLocalCustomVideoTrack(...).
Extends BaseTrack.
addPlayView
Renders the video into the given HTML container element.hasPlayView
Checks whether there’s already a render container.removePlayView
Removes the given render container.removeAllPlayViews
Removes all render containers.enterPictureInPicture
Puts the video of the given container into picture-in-picture mode.
Document PiP is preferred by default. If the browser doesn’t support it, it falls back automatically to the traditional video.requestPictureInPicture().
exitPictureInPicture
Exits picture-in-picture mode for the given container.isPictureInPicture
Checks whether the given container is in picture-in-picture mode.popOutToWindow
Pops the video of the given container out to a separate browser window.closePopOutWindow
Closes the pop-out window of the given container.isPopOut
Checks whether the given container has been popped out to a separate window.getSimulcastTrack
Creates or gets a simulcast sub-track based on the given simulcast publish parameters.setProcessor
Attaches a video processor (such as a beauty filter or background blur). Call it afterstartCapture has produced a track; when you pass an array, the processors are chained in order. Published tracks can also have processors attached, and the SDK switches without renegotiation; after a device switch, processors are reattached automatically. See Audio/video processors.
removeProcessor
Detaches the attached processor, restores the original captured track, and releases processor resources.The PiP / pop-out methods above are all available onLocalCameraTrack,LocalScreenTrack, andRemoteVideoTrack. Whenoptions.hideOriginViewistrue(the default):
Document PiPandpop-out windowshide the original play view on the main page to avoid double rendering- Traditional
video PiPstill relies on the originalvideoelement, so the original view isn’t hidden
LocalCameraTrack
Local camera video track, extendsLocalVideoTrack, created with srtc.createLocalCameraTrack.
startCapture
Starts capture and requests camera permission from the user.stopCapture
Stops capture and releases the camera device.changeDeviceId
Hot-switches the camera device.switchFacingMode
Switches between the front and rear cameras; only takes effect on mobile.setMirror
Sets the mirroring switch for the local preview. The front camera is mirrored by default (like looking in a mirror), which you can adjust here; the rear camera doesn’t support mirroring, and calling this has no effect. Mirroring only affects rendering of the local preview (including picture-in-picture and pop-out windows) and doesn’t change the published data or the video remote users see. Switching between front and rear cameras recalculates the mirroring state automatically and keeps the user’s on/off preference for the front camera.isMirrored
Returns whether it’s currently mirrored (front camera with mirroring on). Alwaysfalse for the rear camera; you can use it to reflect the current mirroring state in the UI.
isFrontFacing
Checks whether the current camera is the front camera. AfacingMode specified explicitly at capture is the most reliable; if unspecified, it’s treated as front.
LocalScreenTrack
Local screen sharing video track, extendsLocalVideoTrack, created with srtc.createLocalScreenTrack.
startCapture
Starts screen capture; the browser shows a screen picker.stopCapture
Stops screen capture.getAudioTrack
Gets the system audio track captured at the same time. Only valid whenaudioPreset was passed to createLocalScreenTrack and the browser supports it.
For detailed usage, see Screen sharing - Capture system audio at the same time
RemoteAudioTrack
Single remote audio track, subscribed withsrtc.subscribeRemoteAudioTrack.
Extends BaseTrack.
startPlay
Plays the remote audio.stopPlay
Stops playback and releases the playback device.isPlaying
Whether it’s currently playing.setJitterBufferTarget
Sets the target delay of the receiver’s jitter buffer, in ms.
Not set by default; the browser adapts on its own. You generally don’t need to adjust it; use it only when you have explicit playback latency requirements.
This relies on the browser’s WebRTC receiver implementation. Chrome / Edge preferjitterBufferTargetand remain compatible with the olderplayoutDelayHint; Firefox / Safari silently ignore it when unsupported.
getJitterBufferTarget
Gets the currently set target delay of the receiver’s jitter buffer.undefined means it isn’t set and the browser’s default adaptive strategy is used.
RemoteAudioMixTrack
Remote channel-wide mixed audio track, extendsRemoteAudioTrack, subscribed with srtc.subscribeRemoteAudioMixTrack.
In most scenarios you only need to subscribe to this one mixed track, without subscribing to each user’s individual audio stream.
getFilterUids
Gets the list of user IDs currently excluded from the mix.Playback methods are inherited fromRemoteAudioTrack, such asstartPlay(),stopPlay(), andisPlaying().
RemoteVideoTrack
Remote video track, subscribed withsrtc.subscribeRemoteVideoTrack.
Extends BaseTrack.
setJitterBufferTarget
Sets the target delay of the receiver’s jitter buffer, in ms.This relies on the browser’s WebRTC receiver implementation. Chrome / Edge preferjitterBufferTargetand remain compatible with the olderplayoutDelayHint; Firefox / Safari silently ignore it when unsupported.
getJitterBufferTarget
Gets the currently set target delay of the receiver’s jitter buffer.undefined means it isn’t set and the browser’s default adaptive strategy is used.