Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Latest commit

 

History

History
78 lines (55 loc) · 4.55 KB

useConference.md

File metadata and controls

78 lines (55 loc) · 4.55 KB

useConference

The useConference hook gathers functions responsible for managing conferences.

import { useConference } from '@dolbyio/comms-uikit-react';

Members

Name Type Description
conference Conference The object of the current conference.
createConference (ConferenceOption) => Promise<Conference> Creates a conference.
fetchConference (id) => Promise<Conference> Fetches a conference.
joinConference (Conference, JoinOptions) => Promise<Conference> Joins a conference.
leaveConference () => Promise<void> Leaves a conference.
maxVideoForwarding number Retrieves maximum video forwarding for current user
setVideoForwarding (maxVideoForwarding: number, options?: Partial) => Promise<void> Sets videoForwarding for limiting incomming video streams

Examples

React

Get conference data

const { conference } = useConference();

<span>{conference.alias}</span>;

Read more on Conference model here.

Create and join conference

const { createConference, joinConference } = useConference();

const conferenceOptions = {
  alias: 'My Conference',
  params: {
    dolbyVoice: true,
  },
};
const newConference = await createConference(conferenceOptions);

const joinOptions = {
  constraints: {
    audio: true,
    video: false,
  },
};

await joinConference(newConference, joinOptions);

Read more on JoinOptions model here.

Leave conference

const { leaveConference } = useConference();

<button onClick={leaveConference}>...</button>;

Set videoForwarding conference

const { setVideoForwarding } = useConference();

<button onClick={() => setVideoForwarding({ maxVideoForwarding: 2, options: { strategy: 'lastSpeakerStrategy' } })}>
  ...
</button>;

Read more on VideoFowardingStrategy model here.