Easiest way to add a video huddle to your application
Tags: video, tutorial, javascript, frontend
Published: 2024-02-02 16:43:54

Video conferences have become an integral part of our work routines, especially after COVID-19. For many companies, schools, and medical centers, the possibility of conducting meetings in non-face-to-face ways means a great reduction in cost and stress, and with that, we increasingly see apps and websites having video call integration directly within them.

SuperViz's Video SDK is an excellent tool to implement this experience quickly. In this article, it will be shown how to install the tool, configure it to open a video call.

## What is SuperViz

SuperViz is a complete collaboration SDK and JavaScript library for developers. It allows you to easily add presence, video, and contextual comments to your web app in only a few hours. It provides a flexible and low-code solution for enhancing your web app’s collaborative functionalities.

We provide a versatile solution that can be integrated into your project in multiple ways. You can use it as a npm package, or you can include it directly in your HTML using a **`<script>`** tag with CDN. To ensure maximum flexibility and adaptability, it’s designed to work with a variety of JavaScript frameworks including React, Angular, Svelte, as well as with Vanilla JS.

## How to get started

### Create an account and retrieve a key

To get started, create a free account on [superviz.com](http://dashboard.superviz.com/), with no credit card required for development and testing purposes. You can develop with up to 1,000 participant minutes for free.

After creating your account, log into the [dashboard](http://dashboard.superviz.com/), navigate to the [developer page](https://dashboard.superviz.com/developer), and generate the token. You will need this key later in the process.

### Install the SDK

To use SuperViz, you must first install the **`@superviz/sdk`** package using npm or yarn. For npm users, execute **`npm install @superviz/sdk`** in your terminal. Yarn users should run **`yarn add @superviz/sdk`**.

After installing the package, import it into your project as follows:

```jsx
import SuperViz from "@superviz/sdk"
```

### Create a room for collaboration

To incorporate the [Video Conference](https://docs.superviz.com/components/video/video-conference) feature into your application, initialize a room with SuperViz. A room is a virtual space for users to join and collaborate. When creating a room, you assign it a unique ID.

Utilize the **`SuperVizRoom`** from the SDK package, providing the Developer Key and an object with the following properties:

- **`id`**: A unique string ID for the room, shared among its participants.
- **`participant`**: An object with details about the current user, such as **`name`** and **`id`**.
- **`group`**: An object with information about the user's group, including **`name`** and **`id`**.

Example of room creation:

```jsx
// Import the SuperViz SDK
import SuperVizRoom from '@superviz/sdk';

// Create a room object
const room = await SuperVizRoom(DEVELOPER_KEY, {
  roomId: "<ROOM-ID>",
  group: {
    id: "<GROUP-ID>",
    name: "<GROUP-NAME>",
  },
  participant: {
    id: "<USER-ID>",
    name: "<USER-NAME>"
  },
});
```

With the room created, you can add components to it.

## Video Conference

To add a Video Conference to your application, use the following code:

```jsx
import { VideoConference } from "@superviz/sdk/lib/components";

video = new VideoConference({
  camsOff: false,
  chatOff: false,
	collaborationMode: {
    enabled: "true",
    position: "right",
    modalPosition: "right",
    initialView: "list"
  },  
  defaultToolbar: false,
  devices: {
    audioInput: false,
    audioOutput: false,
    videoInput: false
  },
  screenshareOff: false,
  skipMeetingSettings: false,
});

room.addComponent(video);
```

Upon initialization, the Video Conference component inserts a SuperViz-enabled *iframe* into the Document Object Model (DOM) and, if necessary, requests browser permission to access the participant's camera and microphone.

With the required permissions granted, participants can configure their input and output devices and join the meeting room.

We offer various options to customize the participant experience within the room. We encourage you to explore our [documentation](https://docs.superviz.com/components/video/video-conference) for more details.

For practical examples and code snippets on using our SDK, visit our [samples repository](https://github.com/superviz/samples).