Skip to main content

Quickstart

This quickstart shows how to use Dyte's core SDKs to add live video and audio to your JavaScript based applications.

Objective

You'll learn how to:

  • Install the Dyte SDK
  • Initialize Dyte Client
  • Connect to the meeting
  • Go live!

Before Getting Started

Step 1: Install the SDK

You can install the package using CDN, npm or Yarn.

Install the SDK using npm.

npm install @dytesdk/web-core

npm version

Step 2: Initialize the SDK

  1. Initialize the Dyte client.
  2. Call the init() method and pass the authToken.
authTokenAfter you've created the meeting, add each participant to the meeting using the Add Participant API. The API response contains the authToken.
const meeting = await DyteClient.init({
authToken,
});

Step 3: Connect to the meeting

Now, you have established the connection with the Dyte meeting server successfully. Next step is to join the room.

Join the room

To join the meeting room, call join() method on the DyteClient instance as shown below.

await meeting.join();
info

Once the join room process completes roomJoined event is emitted on meeting.self namespace.

If you want to perform any actions, such as enabling audio, video, or starting and stopping recording, you can do so after the roomJoined event is fired.

For example:

meeting.self.on('roomJoined', () => {
console.log('User has joined the room', meeting.self.roomJoined);
// run my actions.
});

await meeting.join();

Leave the room

Once the meeting is over, you can leave the meeting room.

To leave the meeting room, call leaveRoom() method on the dyteClient as shown below.

await meeting.leaveRoom();