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

Latest commit

 

History

History
57 lines (38 loc) · 1.82 KB

File metadata and controls

57 lines (38 loc) · 1.82 KB

useSession

The useSession hook gathers functions responsible for managing sessions.

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

Members

Name Type Description
openSession (ParticipantInfo) => {} Opens a new Dolby.io session.
closeSession () => {} Closes the current Dolby.io session.
participant Participant The object of the local participant in a session.

Examples

React

Open session

const { openSession } = useSession();

const open = async () => {
  await openSession({
    name: `John Doe`,
  });
};

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

Read more on ParticipantInfo model here

Close session

const { closeSession } = useSession();

const close = async () => {
  await closeSession();
};

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

Get local participant data

const { participant } = useSession();

<p>{participant.info.name}</p>;

Read more on Participant model here.