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.

Before Getting Started

Step 1: Installation

Since the UI Kit uses the Dyte Core SDK, you must install the @dytesdk/react-native-core package along with the @dytesdk/react-native-ui-kit.

@dytesdk/react-native-ui-kitnpm version
@dytesdk/react-native-corenpm version
npm install @dytesdk/react-native-ui-kit @dytesdk/react-native-core

Install the required native dependencies

npm install @dyteinternals/react-native-webrtc react-native-document-picker react-native-file-viewer react-native-fs react-native-safe-area-context react-native-sound-player react-native-svg react-native-webview

Additional steps for interactive livestream product

Install the following dependencies only if you need livestream.

npm install amazon-ivs-react-native-player

info

The below instructions are for the release builds, debug builds should work without any additional steps.

  1. Edit your android/gradle.properties and add the following line
android.enableDexingArtifactTransform.desugaring=false
  1. Create / append to the file android/app/proguard-rules.pro
-keep class io.webrtc.** { *; }
-dontwarn org.chromium.build.BuildHooksAndroid
  1. In your android/app/build.gradle edit the release configuration and add the following line importing the proguard configuration
buildTypes {
release {
...
...
...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Step 2: Get Started with Dyte Prebuilt Components

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

  1. Set up DyteProvider. This provides the context that provides meeting object and other data to all the child components.
  2. Set up DyteUIProvider. This provides design system to child components.
  3. Initialize the Dyte client. Use the useDyteClient() hook and initMeeting to initialize a client.
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.

import React, { useEffect } from 'react';
import { DyteProvider, useDyteClient } from '@dytesdk/react-native-core';
import { DyteUIProvider, DyteMeeting } from '@dytesdk/react-native-ui-kit';

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

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

return (
<DyteProvider value={meeting}>
<DyteUIProvider>
<YourCustomMeetingComponent />
</DyteUIProvider>
</DyteProvider>
);
}

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.

function YourCustomMeetingComponent() {
const { meeting } = useDyteMeeting();

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