Skip to main content
Version: 1.0.x

Start or Join Room

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 room.

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

1. Configuration

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

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

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

Token generation API is necessary for both scenario.


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

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

Currently the below regions are supported:

  • sg001 Region Code for Singapore, SG.
  • in002 Region Code for Bangalore, IN.
  • 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.

import 'dart:convert';
import 'package:http/http.dart' as http; // For API Calling, you need to add third party package "http"
import 'package:videosdk/videosdk.dart';

// States Defined in Stateful Component.
String? roomId;
String? token;

void _getRoomIdAndToken() async {
final LOCAL_SERVER_URL = dotenv.env['LOCAL_SERVER_URL'];

// Calling get-token API.
final Uri tokenUrl = Uri.parse('$LOCAL_SERVER_URL/get-token');
final http.Response tokenResponse = await http.get(tokenUrl);

final dynamic _token = json.decode(tokenResponse.body)['token'];

// Calling create-room API.
final Uri roomIdUrl =

final http.Response roomIdResponse =
await, body: {"token": _token,"region": "sg001"});

final _roomId = json.decode(roomIdResponse.body)['roomId'];

// Setting into states of stateful widget
setState(() {
token = _token;
roomId = _roomId;

// This API is for validate the room id
// Not require to call this API after create room API

dynamic validateRoom(token, roomId) async {
final String LOCAL_SERVER_URL = dotenv.env['LOCAL_SERVER_URL'];
final Uri validateRoomUrl =
final http.Response validateRoomResponse =
await, body: {"token": token});
final _roomId = json.decode(validateRoomResponse.body)['roomId'];
if (_roomId != null) {
return _roomId;
} else {
return null;

2. Initialization

After configuration, you will have to Initialize

room by providing name, roomId, micEnabled, camEnabled & maxResolution.

import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';

class MyApp extends StatelessWidget {
final Room = VideoSDK.createRoom(
roomId: "<Id-of-Room>",
displayName: "<Name-of-participant>",
micEnabled: "<Flag-to-enable-mic>",
camEnabled: "<Flag-to-enable-cam>",
token: "<Authentication-token>",
notification: const NotificationInfo(
title: "Video SDK",
message: "Video SDK is sharing screen",
icon: "notification_share",
Widget build(BuildContext context) {
return return Container(); // Returning widget

3. Join

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

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

// Join the room