VideoSDK

object VideoSDK

Entry point for the SDK: process-wide setup, device lists and the track factories.

Call initialize, then createRoom with your auth token to build a Room, then Room.join to connect. Neither setup call suspends — only Room.join and the room actions do.

VideoSDK.initialize(applicationContext)

val room = VideoSDK.createRoom(
roomId = roomId,
token = authToken,
participantName = "Ada",
)
room.addEventListener(object : RoomEventListener() {
override fun onRoomJoined(switchRoomId: String?) {
// you are in the room
}
})
lifecycleScope.launch { room.join() }

The SDK runs one room per process: leave the current room before joining another.

Types

Link copied to clipboard

Transport the media connection prefers. Pass one to createRoom.

Functions

Link copied to clipboard
fun checkPermissions(context: Context, permission: List<Permission>, rationale: String? = null, options: Permissions.Options? = null, permissionHandler: PermissionHandler)

Requests the runtime permissions a call needs, prompting the user when any are missing and reporting the outcome on permissionHandler. When all of them are already held it reports success without showing anything.

Link copied to clipboard
suspend fun createCameraVideoTrack(encoderConfig: CustomCameraTrackConfig? = null, facingMode: FacingMode? = null, multiStream: Boolean = true, cameraId: String? = null, maxLayer: EncodingLayer? = null, bitrateMode: BitrateMode? = null, codec: VideoCodec? = null): CustomStreamTrack

Creates a camera track and opens the camera for a self-view: pass CustomStreamTrack.track to VideoView.addTrack to preview before join, and the track to createRoom / Room.enableCam(track) to publish that camera without reopening it.

Link copied to clipboard
suspend fun createMicrophoneAudioTrack(encoderConfig: CustomMicrophoneTrackConfig? = null, microphoneId: String? = null, noiseConfig: NoiseConfig? = null): CustomStreamTrack

Creates a microphone track and opens the input. Pass it to createRoom as customMicrophoneTrack or to Room.unmuteMic(track); nothing is sent until it is published, and CustomStreamTrack.stop closes the microphone. There is no level API.

Link copied to clipboard
fun createRoom(roomId: String, token: String, participantName: String? = null, micEnabled: Boolean = true, camEnabled: Boolean = true, participantId: String? = null, mode: Mode? = null, multiStream: Boolean? = null, customCameraTrack: CustomStreamTrack? = null, customMicrophoneTrack: CustomStreamTrack? = null, metaData: JSONObject? = null, signalingBaseUrl: String? = null, preferredProtocol: VideoSDK.PreferredProtocol? = null, codecSwitchEnabled: Boolean = true, enableBatching: Boolean = true, translationLanguage: String? = null, speakingLanguage: String? = null, maxResolution: MaxResolution? = null, defaultCamera: FacingMode = FacingMode.front, autoConsume: Boolean = true, dynaCast: Boolean = false): Room

Creates a Room for roomId without connecting to it.

Link copied to clipboard
fun createScreenShareVideoTrack(encoderConfig: String? = null, data: Intent?, multiStream: Boolean = false, withAudio: Boolean = false): CustomStreamTrack?

Creates a screen-share video track from the user's MediaProjection consent.

Link copied to clipboard

Stops sending telemetry to VideoSDK's backend: the pending batch is flushed, then the pipeline shuts down for the rest of the process. Read the flag back with isTelemetryEnabled.

Link copied to clipboard

Marks backend telemetry as enabled, which it already is when the SDK starts.

Link copied to clipboard

Returns the route the OS is really playing through, which can differ from getSelectedAudioDevice while a route change is still settling. null before initialize.

Link copied to clipboard

The video effects configuration currently in force.

Link copied to clipboard

Returns the cameras Camera2 reports. Empty until initialize has run.

Link copied to clipboard

Returns every camera, then every audio route: CameraDeviceInfo and MicrophoneDeviceInfo entries, the same ones getCameras and getMics list. Empty until initialize has run.

Link copied to clipboard

Returns a JSONObject mapping every catalogue name (e.g. "INVALID_API_KEY") to its numeric code (e.g. 4001):

Link copied to clipboard

Returns the configured BaseKeyProvider, or null if not set.

Link copied to clipboard

Returns the log level set with setLogLevel; LogLevel.INFO until it is called.

Link copied to clipboard

Returns the audio routes currently attached — speaker, earpiece, wired headset, Bluetooth. Empty until initialize has run.

Link copied to clipboard

Returns the audio route the SDK is set to use. Picks a sensible default on the first read, so it is null only before initialize or when the device reports no route at all. Room.setAudioDevice changes it.

Link copied to clipboard

Returns the camera the SDK last opened or was last pointed at, or null before any camera has been used.

Link copied to clipboard
fun initialize(context: Context)

Starts the SDK for this process: begins audio routing, enumerates devices and hooks the activity lifecycle that pauses the webcam in the background.

Link copied to clipboard

Returns whether backend telemetry is currently enabled.

Link copied to clipboard
fun publishFramingSubject(cx: Float, cy: Float, width: Float, height: Float)

Publishes the subject that auto-framing follows, as a box normalised to 0.0..1.0.

Link copied to clipboard

Turns end-to-end encryption off and forgets the provider set with setKeyProvider.

Link copied to clipboard
suspend fun runPreCallTest(options: PreCallTestOptions, onStatsChange: (PreCallNetworkQuality) -> Unit? = null): PreCallTestResult

Runs a pre-call test: checks the camera and microphone, publishes them to a test server for the sampling window in options, and scores the uplink and downlink. Run it before createRoom: from that call until the room is left, the test fails with ERROR_PRECALL_AFTER_INIT. Joining a room stops a running test.

Link copied to clipboard

Limits the webcam auto-pause/resume to activity's stop and resume events. Without it the SDK reacts to any activity in the process, so opening a settings screen would stop the camera. See setEnableActivityLifecycle for what stopping and resuming do.

Link copied to clipboard
fun setEnableActivityLifecycle(enableActivityLifecycle: Boolean)

Enables (default) or disables pausing the local webcam while the app is backgrounded.

Link copied to clipboard

Turns on end-to-end encryption with the keys provider holds. Call it before Room.join — a provider set later does not encrypt the session already running.

Link copied to clipboard
fun setLogLevel(level: LogLevel = LogLevel.INFO)

Sets how much the SDK logs to the VideoSDK.* logcat tags. Takes effect immediately and applies to the whole process.

Link copied to clipboard
fun setMediaMode(mode: Int)

Overrides the system audio mode the SDK runs the call in. The SDK already picks one; this is for apps that must coexist with another audio stack.

Link copied to clipboard
fun setParticipantKey(participantId: String, key: String?)

Sets, rotates or removes one participant's E2EE key, including mid-call.

Link copied to clipboard

Turns on the proximity sensor so holding the phone to your ear moves audio from the speaker to the earpiece, as a phone call does.

Link copied to clipboard

Sets how a front camera without a flash unit is lit when Participant.captureImage runs with CaptureFlash.ON.

Link copied to clipboard
fun setSelectedVideoDevice(selectedVideoDevice: CameraDeviceInfo)

Records which camera the SDK should treat as current. It does not open, close or switch anything — use Room.changeCam to actually move a running camera.

Link copied to clipboard

Sets the video effects configuration before a room is joined.

Link copied to clipboard

Stops the running pre-call test, if any. Asynchronous; the suspended runPreCallTest call still receives its outcome.