Skip to main content
Version: 3.x.x

VideoSDK Class

The entry point into real-time communication SDK.

using VideoSDK Class​

The VideoSDK Class includes methods and events to initialize and configure the SDK. It is a factory class.

initialize(), config() and initMeeting() are regular functions. meeting.join() and most other meeting actions are suspend functions, so call them from a coroutine.

For every method, property and event of VideoSDK, see VideoSDK Class.

Parameters​

These are the main parameters of initMeeting(). Only context and meetingId are required. For the other optional parameters, such as mode, multiStream, customTracks and metaData, see Initializing a Meeting.

  • contextrequiredContext

    any Android context; only its application context is kept
  • meetingIdrequiredString

    set meeting id; an empty id throws VideoSDKException 3073 (ERROR_INVALID_PARAMETER)
  • nameoptionalString?(default:null)

    set local participant's name; if null, the name is empty
  • micEnabledoptionalBoolean(default:true)

    set local participant's mic state when joining
  • webcamEnabledoptionalBoolean(default:true)

    set local participant's webcam state when joining
  • participantIdoptionalString?(default:null)

    set local participant's Id; if null or empty, one is generated

Methods​

  • initialize(context: Context)Unit

    initialize the SDK; call it once before any other VideoSDK method, for example in Application.onCreate()
  • config(token: String?)Unit

    configure the token; a null or empty token throws VideoSDKException 3073 (ERROR_INVALID_PARAMETER)
  • initMeeting( context: Context, meetingId: String, name: String? = null, micEnabled: Boolean = true, webcamEnabled: Boolean = true, participantId: String? = null, ... )Meeting

    initialize the meeting; nothing connects until you call meeting.join()

Example​

initMeeting
// Initialize the SDK
VideoSDK.initialize(applicationContext)

// Configure the token
VideoSDK.config(token)

// Initialize the meeting
val meeting = VideoSDK.initMeeting(
context = this, // required
meetingId = meetingId, // required
name = name,
micEnabled = micEnabled,
webcamEnabled = webcamEnabled,
)

// Join the meeting from a coroutine
lifecycleScope.launch {
try {
meeting.join()
} catch (e: VideoSDKException) {
Log.e("VideoSDK", "Join failed: ${e.code} ${e.name}")
}
}

Got a Question? Ask us on discord