Skip to main content

Quickstart

This quickstart shows how to use Dyte's UI Kit prebuilt components to add live video and audio to your React application with minimal coding and a variety of meeting UI customization options.

Dyte also offers the flexibility to build your own UI using various individual components. This offers limitless customization options to tailor the UI to fit your requirements. For more information, see the Build your own UI section.

For getting started quickly, you can use our sample code. You can clone and run a sample application from the React UI Kit GitHub repository.

Objective

You'll learn how to:

  • Install the Dyte SDK
  • Initialize Dyte Client
  • Pass the meeting object to UI Kit
  • Go live!

Before Getting Started

Step 1: Install the SDK

Since the UI Kit is built on top of the Core SDK, you must install the react-web-core package along with the ui-kit.

react-web-core consists of hooks written on top of web-core which makes it easy to use web-core in React applications.

You can install the package using npm or Yarn.

npm install @dytesdk/react-ui-kit @dytesdk/react-web-core
Import Errors

If you get errors when importing the react-ui-kit and react-web-core packages, try installing them separately.

Version

@dytesdk/react-ui-kitnpm version
@dytesdk/react-web-corenpm version

Step 2: Get Started with Dyte Prebuilt Components

Here's a series of steps that you need to perform:

  1. Set up DyteProvider. You need it to import the DyteProvider from the dytesdk/react-web-core. DyteProvider basically is a hook wrapper on dytesdk/web-core. This provides a meeting object to child components.
  2. Initialize the Dyte client. Use the useDyteClient() hook and initMeeting to initialize a client.
  3. 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.
  1. Pass the meeting object to UI Kit, which will use it to retrieve meeting information and display it on the user interface.

    The meeting object serves as the link between web-core and UI Kit, allowing them to communicate with one another. Once the UI Kit has the meeting object, it can join and leave meetings, and so on.

import { useEffect } from 'react';
import { useDyteClient } from '@dytesdk/react-web-core';
import { DyteMeeting } from '@dytesdk/react-ui-kit';

export default function App() {
const [meeting, initMeeting] = useDyteClient();

useEffect(() => {
initMeeting({
authToken: '<auth-token>',
defaults: {
audio: false,
video: false,
},
});
}, []);

return <DyteMeeting meeting={meeting} />;
}

Example: Using Prebuilt DyteMeeting Component

In the following example, a meeting is created using the useDyteMeeting component. useDyteMeeting essentially returns the meeting object you passed to the DyteProvider.

DyteMeeting renders the entire meeting UI. It loads your preset and renders the UI based on it. With this component, you don't have to handle all the states, dialogs, and other smaller bits of managing the application.

For more information on the other props of DyteMeeting, see DyteMeeting.