CustomStreamTrack

A custom audio or video track created by a VideoSDK factory method.

A camera or microphone track opens its device when it is created, so it can be previewed before join: track is what VideoView renders. Passing it to createRoom, Room.enableCam, Room.unmuteMic, Room.changeCam or Room.changeMic publishes the open device without reopening it; from then on the room owns it and its disable or leave releases it. stop releases a track the room has not taken.

Instances come only from the factory methods, never from application code.

Properties

Link copied to clipboard

How the encoder trades quality against bitrate.

Link copied to clipboard
val cameraId: String? = null

Camera device id, or null when the camera is chosen by facingMode.

Link copied to clipboard
val codec: VideoCodec? = null

Codec requested for this camera track, or null for the SDK's default (VP8). Read VideoCodec before choosing one — anything else costs simulcast.

Link copied to clipboard
val encoderConfig: String? = null

Encoder profile this track was created with — a camera profile such as "h720p_w1280p", a screen-share one such as "h720p_15fps", or a microphone one.

Link copied to clipboard

The camera that was actually opened.

Link copied to clipboard
val frameRate: Int = 0

Target capture frame rate, or 0 if not set.

Link copied to clipboard
val height: Int = 0

Encoded video height, or 0 when the encoder config does not imply one.

Link copied to clipboard

True once the track has ended: stop, a rejected publish, its device closing (disable, leave, a newer preview), or a failed open. Publishing an ended track reports 3031 (camera) or 3032 (microphone) on onError and opens a fresh device instead.

Link copied to clipboard
val maxLayer: EncodingLayer? = null

How many simulcast layers the camera publishes, or null when the track carries no layer preference (audio and screen-share tracks).

Link copied to clipboard
val microphoneId: String? = null

Microphone this audio track captures from (a VideoSDK.getMics device id), or null for the current one.

Link copied to clipboard
val multiStream: Boolean = true

Whether the camera publishes a simulcast ladder. A non-VP8 codec overrides this to a single layer whatever it says.

Link copied to clipboard

Audio-processing flags, or null to keep the encoder profile's own.

Link copied to clipboard

Called once, on the main thread, when this track ends; null removes it. The factory already threw if the device would not open, so this reports what happens afterwards: the device failing, with why (3023 / 3026 / 3024 …), or null when the track was stopped, disabled, replaced or released by leaving the room. Set after the track ended, it is called at once and not kept.

Link copied to clipboard
val track: MediaStreamTrack?

The underlying media track: a VideoTrack for a camera track, which VideoView.addTrack renders as the local preview, or an AudioTrack for a microphone track. null for a screen-share track. Disposing it releases the device, as stop does.

Link copied to clipboard
val width: Int = 0

Encoded video width, or 0 when the encoder config does not imply one.

Link copied to clipboard
val withAudio: Boolean = false

Whether a screen-share track also captures system audio, mixed into the microphone track. Set by VideoSDK.createScreenShareVideoTrack; ignored by camera and microphone tracks.

Functions

Link copied to clipboard
fun stop()

Releases the camera or microphone this track opened.