Skip to main content
Version: 0.0.x

Start or Join Meeting

After the successful installation of videoSDK, the next step is to integrate videoSDK features with your webApp/MobileApp.

To Communicate with other participant's audio or video call, you will need to join the meeting.

This guide will provide an overview of how to configure, initialize and join a VideoSDK meeting.

1. Configuration

To configure a meeting, you will need generated token and meetingId, we had discussed in Server Setup. This code snippet calls API from local server

Scenario 1 - Suppose you don't have any meetingId, you can simply generate meetingId by invoking create-meeting API.

Scenario 2 - Suppose you have meetingId, now you don't have to call create-meeting API to generate meetingId, instead you can call validate-meeting API to validate meetingId.

Token generation API is necessary for both scenario.

note

You can take advantage of regional API to decrease latency in video calling.

To achieve region based meetings, just pass region : REGION_CODE parameter in create-meeting request Body.

Currently the below regions are supported:

  • sg001 Region Code for Singapore, SG.
  • uk001 Region Code for London, UK.
  • us001 Region Code for Fremont, CA.
  • eu001 Region Code for Frankfurt, DE.

In case you are not providing any region code, the default region will be sg001.

package live.videosdk.rtc.android.java;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import org.json.JSONException;
import org.json.JSONObject;

class JoinActivity : AppCompatActivity() {
private val apiServerUrl = "http://localhost:9000"

// ...
// onCreate() and other methods
private fun getToken(@Nullable meetingId: String?) {
AndroidNetworking
.get("$apiServerUrl/get-token")
.build()
.getAsJSONObject(
object : JSONObjectRequestListener {
override fun onResponse(response: JSONObject) {
try
{
token = response.getString("token")
if (meetingId == null) {
createMeeting(token)
} else {
joinMeeting(token, meetingId)
}
} catch (e: JSONException) {
e.printStackTrace()
}
}

override fun onError(anError: ANError) {
anError.printStackTrace()
}
}
)
}

private fun createMeeting(token: String) {
AndroidNetworking
.post("$apiServerUrl/create-meeting")
.addBodyParameter("token", token)
.addBodyParameter("region", "sg001")
.build()
.getAsJSONObject(
object : JSONObjectRequestListener {
override fun onResponse(response: JSONObject) {
try {
// final String meetingId = response.getString("meetingId");

// Intent intent = new Intent(JoinActivity.this, MainActivity.class);
// intent.putExtra("token", token);
// intent.putExtra("meetingId", meetingId);

// startActivity(intent);
} catch (e: JSONException) {
e.printStackTrace()
}
}

override fun onError(anError: ANError) {
anError.printStackTrace()
}
}
)
}

private fun joinMeeting(token: String, meetingId: String) {
AndroidNetworking
.post("$apiServerUrl/validate-meeting/{meetingId}")
.addPathParameter("meetingId", meetingId)
.addBodyParameter("token", token)
.build()
.getAsJSONObject(
object : JSONObjectRequestListener {
override fun onResponse(response: JSONObject) {
// Intent intent = new Intent(JoinActivity.this, MainActivity.class);
// intent.putExtra("token", token);
// intent.putExtra("meetingId", meetingId);

// startActivity(intent);
}

override fun onError(anError: ANError) {
anError.printStackTrace()
}
}
)
}
}

2. Initialization

After configuration, you will have to Initialize

meeting by providing name, meetingId, micEnabled, webcamEnabled & maxResolution.

NOTE : For React & React native developer, you have

to be familiar with hooks concept. You can understand hooks concept on React Hooks.

import live.videosdk.rtc.android.VideoSDK;
import live.videosdk.rtc.android.Meeting;

class MainActivity : AppCompatActivity() {
private var meeting: Meeting? = null

override fun onCreate(savedInstanceState: Bundle?) {
// Configure parameters
val token = intent.getStringExtra("token")
val meetingId = intent.getStringExtra("meetingId")
val participantName = "John Doe"
val micEnabled = true
val webcamEnabled = true
val paticipantId="demo@123" // If you passed `null` then SDK will create an Id by itself and will use that id.

// Configure authentication token
VideoSDK.config(token)

// create a new meeting instance
meeting = VideoSDK.initMeeting(
this@MainActivity,
meetingId,
participantName,
micEnabled,
webcamEnabled,
paticipantId
)
}
}

3. Join

After configuration & initialization, the third step is to call join() to join a meeting.

After joining, you will be able to Manage Participant in a meeting.

// After receiving mic and webcam access permissions
// join the meeting
meeting!!.join()