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

Latest commit

 

History

History
28 lines (20 loc) · 1.47 KB

useSpeaker.md

File metadata and controls

28 lines (20 loc) · 1.47 KB

useSpeaker

The useSpeaker hook gathers functions responsible for managing speakers.

Members

Name Type Description
speakers MediaDeviceInfo[] Holds the list of the available speakers. getSpeakers should be invoked to set this variable
getSpeakers () => void Gets a list of the available speakers and saves it to speakers variable
selectSpeaker (string) => Promise Selects a speaker.
getDefaultLocalSpeaker () => Promise<MediaDeviceInfo|null> Gets data of default speaker.
getSelectedSpeaker () => MediaDeviceInfo | undefined Gets currently selected speaker in the conference.

Examples

React

Select main speaker

const { speakers, getSpeakers, selectSpeaker } = useSpeaker();
useEffect(() => {
  getSpeakers();
}, []);

return speakers.map((s) => <div onClick={() => selectSpeaker(s)}>...</div>);