if peerId is passed peerId and peers will be empty arrays

The peerId is the unique identifier for the peer. The mic and cam are the MediaStreamTrack objects for the audio and video streams respectively.

The usePeers hook can be used to access the audio and video streams for the peers and can be used in the following way to render the audio and video streams:

peerIds[]Array<string>array of the peerIds
peersObjectobject contains mic,cam properties
errorstringgives the error message
//Example Type
interface IPeers {
  [peerId: string]: {
    peerId: string;
    role: IRoleEnum;
    mic: MediaStreamTrack;
    cam: MediaStreamTrack;
// IRoleEnum: "host" | "moderator" | "speaker" | "listener" | "peer";

Sample Code

Getting access to data related to peers


import {Text, View} from 'react-native';
import { usePeers } from '@huddle01/react-native/hooks';
export default function() {
  const peers = usePeers();
  return <View><Text>{JSON.stringify(peers)}</Text></View>

Output: (Example Output for 1 peer)

    peerId: "sdksjdsjd",
    mic: MediaStreamTrack,
    cam: MediaStreamTrack
  import {Button, View} from 'react-native';
  import { usePeers } from '@huddle01/react-native/hooks';
  import {Video, Audio} from '@huddle01/react-native/components';
  const App = () => {
    const { peerIds } = usePeers();
    return (
          { => (
              <Video key={peer.peerId} peerId={peer.peerId} debug />
          { => (
              <Audio key={peer.peerId} peerId={peer.peerId} debug />
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.