Skip to main content

Class hierarchy


BaseTrack

Base class of all tracks, providing access to track metadata.

id

Track ID, uniquely identifying the track within the channel.

kind

Track type: 'audio' or 'video'.

desc

Track description, specified when publishing, such as 'camera_big' or 'screen'.

getInfo

Gets the full track info, such as resolution, bitrate, and sample rate.
Returns: 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 case getInfo() throws; use channel.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 underlying MediaStreamTrack, 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 of srtc.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 after startCapture 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, extends LocalAudioTrack, 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, extends LocalAudioTrack. You usually don’t create this class manually; get it through LocalScreenTrack.getAudioTrack().

stopCapture

Stops system audio capture.
The other playback methods are inherited from LocalAudioTrack, such as startPlay(), stopPlay(), and isPlaying().

LocalVideoTrack

Base class for local video tracks, also used for custom video streams, such as the return value of srtc.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 after startCapture 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 on LocalCameraTrack, LocalScreenTrack, and RemoteVideoTrack. When options.hideOriginView is true (the default):
  • Document PiP and pop-out windows hide the original play view on the main page to avoid double rendering
  • Traditional video PiP still relies on the original video element, so the original view isn’t hidden

LocalCameraTrack

Local camera video track, extends LocalVideoTrack, 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). Always false 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. A facingMode specified explicitly at capture is the most reliable; if unspecified, it’s treated as front.

LocalScreenTrack

Local screen sharing video track, extends LocalVideoTrack, 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 when audioPreset 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 with srtc.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.
Parameters: 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 prefer jitterBufferTarget and remain compatible with the older playoutDelayHint; Firefox / Safari silently ignore it when unsupported.

getJitterBufferTarget

Gets the currently set target delay of the receiver’s jitter buffer.
The return value is the target delay currently set by your app, in ms; undefined means it isn’t set and the browser’s default adaptive strategy is used.

RemoteAudioMixTrack

Remote channel-wide mixed audio track, extends RemoteAudioTrack, 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 from RemoteAudioTrack, such as startPlay(), stopPlay(), and isPlaying().

RemoteVideoTrack

Remote video track, subscribed with srtc.subscribeRemoteVideoTrack. Extends BaseTrack.

setJitterBufferTarget

Sets the target delay of the receiver’s jitter buffer, in ms.
Parameters:
This relies on the browser’s WebRTC receiver implementation. Chrome / Edge prefer jitterBufferTarget and remain compatible with the older playoutDelayHint; Firefox / Safari silently ignore it when unsupported.

getJitterBufferTarget

Gets the currently set target delay of the receiver’s jitter buffer.
The return value is the target delay currently set by your app, in ms; undefined means it isn’t set and the browser’s default adaptive strategy is used.

addPlayView

Renders the remote 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 remote video of the given container into picture-in-picture mode.

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 remote video out to a separate 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.