
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@dolbyio/comms-uikit-react
Advanced tools
The Dolby.io Communications UIKit for React is designed to help React developers reduce the complexity of building apps based on the Dolby.io Communications SDK for Web.
The package consists of four basic elements:
Providers
: The main components for initializing integration with Dolby.io Communications APIs and state management.Hooks
: Functions responsible for video call logic of video call applications.UI components
: Components that cover the most popular patterns of video conferencing applications.Conference components
: UI components with built-in logic for the most widely used video call/live events features.If you prefer to get started by reviewing a complete code sample of this guide, see the example here.
For a complete list of components and their usage, go to the documentation folder.
The following Dolby.io sample projects demonstrates the UIkit in action:
This UI kit is tested to work best with the following browser versions
This guide demonstrates how to use UI components to quickly build the essential components of a Dolby.IO Communications SDK based app. Be sure to complete the Connect your app to Dolby.io section before moving onto the Adding components section.
Each component demonstrated within Add video call components can be built independent of the others. The code blocks within each section only include the code for that individual component, and exclude the components from other sections.
If you prefer to get started by reviewing a complete code sample containing all the features in this guide, see the example here.
Note: This guide is written with Yarn in mind. You can swap out yarn for NPM or a different package manager if you like.
# Create a new React application
npx create-react-app my-app
# Change into the app directory
cd my-app
# Install UI kit
yarn add @voxeet/voxeet-web-sdk @dolbyio/comms-uikit-react
# Start the dev server
yarn run start
To setup your Dolby.io account, go to Dolby.io dashboard and complete the form. After confirming your email address, you will be logged in.
You will need to generate a client access token to run this app. Follow the steps to obtain a token.
Go to the Dashboard, and find the Applications menu item,
On the next screen, there is a token field where you can copy the client access token to your clipboard. The generated token is active for the indicated amount of time.
This section will guide you on connecting to the Dolby.io APIs, which will enable the use of our Communications related features.
Dolby.io integration is provided by a CommsProvider
component (for communication with our APIs), which should be imported and configured at the root of your web app, eg. src/App.js
. Replace the placeholder value for token
with your client access token from the Dolby.io dashboard.
For the purpose of this demo, you will only be working in
src/App.js
. This file follows the structure below:
Import statements
Global variables
AppBase Component
Content Component
App
// src/App.js
// 1. Import `CommsProvider` and `ThemeProvider` from the UI kit.
import { CommsProvider, InfoBar } from '@dolbyio/comms-uikit-react';
// 2. Define the `CommsProvider` configuration. We need two properties, a `token` and an async function that refreshes it.
const token = 'YOUR_CLIENT_ACCESS_TOKEN_HERE';
const refreshToken = async () => token;
// 3. Create wrapper with `CommsProvider` for entire app. Pass the `token` and `refreshToken` properties.
const AppBase = ({ children }) => {
return (
<CommsProvider token={token} refreshToken={refreshToken}>
{children}
</CommsProvider>
);
};
// 4. Create `Content` component. It will be main component of our app. Wrap it with previously created `AppBase`. We'll also add a fixed height to the content as we'll need this later in the guide.
function Content() {
// 5. Define styles for the main content and button containers
const contentContainerStyle = {
minHeight: '100vh',
gap: '10px',
display: 'flex',
flexDirection: 'column',
alignItems: 'stretch',
justifyContent: 'center',
backgroundColor: '#14141A',
padding: '20px 0',
boxSizing: 'border-box',
};
const buttonContainerStyle = {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
};
return (
<div className="App" style={contentContainerStyle}>
<InfoBar text="Voxeet Web SDK has been initialized." style={{ margin: '0 auto' }} />
...
</div>
);
}
// 6. Connect `BaseApp` with `Content` component.
const App = () => {
return (
<AppBase>
<Content />
</AppBase>
);
};
export default App;
This approach is only for demo purposes. To properly initialize your app for production, see API Authentication and Client Authentication.
A session is a connection between the client application and the Dolby.io Communications APIs.
Session
from the UI kit.import { Session } from '@dolbyio/comms-uikit-react';
Session
configurations in the Content
Component. You should provide a name using a participantInfo
object, eg. the name of the participant who established the session.const participantInfo = { name: 'John Doe' };
Session
component inside the return statement in Content
component.<Session participantInfo={participantInfo}>
<InfoBar text="Session has been created." style={{ margin: '0 auto' }} />
</Session>
If you would like to create a session using your own component, refer to the useSession hook.
Once your app has made the connection to Dolby.io, you can access its features.
A session connects participants to one another, enabling them to communicate using audio and/or video.
Conference
, JoinConferenceButton
and LeaveConferenceButton
from the UI kit. Import useState
from React.import { Conference, JoinConferenceButton, LeaveConferenceButton } from '@dolbyio/comms-uikit-react';
import { useState } from 'react';
JoinConferenceButton
configuration in the Content
component. The joinOptions
property allows you to specify whether to join the conference with audio and/or video enabled, in addition to a meetingName and username (usually the name of current user) which can be made visible to all participants.const joinOptions = {
constraints: {
audio: true,
video: true,
},
};
JoinOrLeave
with a state for conference ID. Insert the Conference
, JoinConferenceButton
and LeaveConferenceButton
components, along with the joinOptions
and meetingName
. We want to show JoinConferenceButton
when there is no conference ID, and Conference
(which includes the LeaveConferenceButton
) when there is. You can customise the toolipText
property each respective join/leave buttons. Now, insert <JoinOrLeave>
component inside the return statement in Content
component (ie. Nested inside Session
).We also pass setConferenceId
as a callback to the onSuccess
properties for both buttons which will set (or unset) the conference ID when the action is successful.
IMPORTANT: Rendering a component will establish a call using Dolby.io, If you are using your free minutes for this demo, remember to leave the conference or close the browser tab when you're done!
const JoinOrLeave = () => {
const [conferenceId, setConferenceId] = useState();
return !conferenceId ? (
<div style={buttonContainerStyle}>
<JoinConferenceButton
joinOptions={joinOptions}
meetingName="My Meeting"
username={participantInfo.name}
tooltipText="Join Meeting"
onSuccess={(id) => setConferenceId(id)}
>
Join Video Call
</JoinConferenceButton>
</div>
) : (
<Conference id={conferenceId}>
<div style={buttonContainerStyle}>
<LeaveConferenceButton tooltipText="Leave Meeting" onSuccess={() => setConferenceId(null)} />
</div>
</Conference>
);
};
If you would like to create, join or leave a conference using your own components, refer to the useConference hook.
All of the video call components below are assumed to be wrapped within an Conference
component that resides within the Session
Component. The components are all defined and rendered within the Content
component. See below for the skeleton:
// import { Session, Conference } from '@dolbyio/comms-uikit-react';
<Session participantInfo={participantInfo}>
<Conference id={conferenceId}>...</Conference>
</Session>
Conference
component contains other optional properties includingalias
(string),audio
(bool),video
(bool),liveRecording
(bool).
The ParticipantsList
component can display a list of participants in the current conference and their status, eg. whether the participant is currently speaking.
ParticipantsList
from the UI kit.import { ParticipantsList } from '@dolbyio/comms-uikit-react';
ParticipantsList
component anywhere inside of Conference
. You can customize the text properties shown for each participant and their status.<ParticipantsList localText="you" muteText="mute" unmuteText="unmute" soundOnText="sound on" soundOffText="sound off" />
If you would like to display participants using your own component, refer to the useParticipants hook.
The ParticipantsGrid
component displays the video streams of conference participants in a grid tile layout.
ParticipantsGrid
from the UI kit.import { ParticipantsGrid } from '@dolbyio/comms-uikit-react';
ParticipantsGrid
component anywhere inside of Conference
.You can customize the localText
property, which is shown for the local participant.<ParticipantsGrid localText="you" additionalContainerStyle={{ height: 400 }} />
The LocalToggleAudioButton
and LocalToggleVideoButton
components enable the local participant to toggle their microphone and camera on or off.
LocalToggleAudioButton
and LocalToggleVideoButton
from the UI kit.import { LocalToggleAudioButton, LocalToggleVideoButton } from '@dolbyio/comms-uikit-react';
LocalToggleAudioButton
and LocalToggleVideoButton
components anywhere inside of Conference
.<div style={buttonContainerStyle}>
<LocalToggleAudioButton />
<LocalToggleVideoButton />
</div>
If you would like to control audio or video using your own components, refer to the useAudio and useVideo hooks.
The local participant can change their preferred camera, microphone or output speaker using the CameraSelect
, MicrophoneSelect
and SpeakersSelect
components.
CameraSelect
, MicrophoneSelect
and SpeakersSelect
from the UI kit.import { CameraSelect, MicrophoneSelect, SpeakersSelect } from '@dolbyio/comms-uikit-react';
CameraSelect
, MicrophoneSelect
and SpeakersSelect
components, along with the label
and placeholder
properties, anywhere inside of Conference
. You can customize the text shown for the label
prop (shown above the component) and a placeholder
prop (shown when no option is selected).<CameraSelect label="Camera" placeholder="Choose a camera" labelColor="white" />
<MicrophoneSelect label="Microphone" placeholder="Choose a microphone" labelColor="white" />
<SpeakersSelect label="Speaker" placeholder="Choose a speaker" labelColor="white" />
If you would like to control input devices using your own components, refer to the useCamera, useMicrophone and useSpeaker hooks.
You can use the installed VoxeedSDK's APIs in the application directly without relying on our UIKit components. Let's enhance our example app to observe the participants' status.
useEffect
from React.import VoxeetSDK from '@voxeet/voxeet-web-sdk';
import { useEffect } from 'react';
Content
component. This hook subscribes to the participantUpdated
event from the voxeet SDK. Define the effect of the handler. Here, you observe the participant's status and the state of their audio through the console.useEffect(() => {
// define the event handler here
const handler = (participant) => {
console.log(participant.info.name, 'status:', participant.status);
console.log(participant.info.name, 'has audio enabled:', participant.audioTransmitting);
};
// register the handler for 'participantUpdated' event
VoxeetSDK.conference.on('participantUpdated', handler);
return () => {
// unregister the handler
VoxeetSDK.conference.removeListener('participantUpdated', handler);
};
}, []);
You can learn more about the Voxeet WebSDK here
Download the sample source code here.
Please see the additional configuration options guide to learn more about other features including:
The Dolby.io Communications UIKit for React and its repository are licensed under the MIT License. Before using the package @dolbyio/comms-uikit-react
, please review and accept the Dolby Software License Agreement.
Third-party licenses can be found here.
© Dolby, 2023
FAQs
Dolby.io Communications UIKit for React
The npm package @dolbyio/comms-uikit-react receives a total of 92 weekly downloads. As such, @dolbyio/comms-uikit-react popularity was classified as not popular.
We found that @dolbyio/comms-uikit-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.