useHuddle01

useHuddle01

Once done, initialize your project by calling the initialize() method and pass projectId in params.

This method should be invoked first at all times

NameTypeDescription
initialize(projectId: string)Functioninitializes and sets up the app state required by the library.
isInitializedbooleanstate for whether the app is initialized
meobjectContains current user's `role`, `displayName`, `meId`, and `avatarUrl`.
roomState`IDLE` | `INIT` | `LOBBY` | `ROOM`States the current state of the room

Sample Code

 
import { useHuddle01 } from '@huddle01/react/hooks';
import Image from 'next/image';
 
const App = () => {
  const { initialize, isInitialized, me, roomState } = useHuddle01();
 
  useEffect(() => {
    // its preferable to use env vars to store projectId
    initialize('YOUR_PROJECT_ID');
  }, []);
 
  return (
    <div>
      {isInitialized ? 'Hello World!' : 'Please initialize'}
      <div>Room State: {roomState}</div>
      <Image src={me.avatarUrl} alt="avatar" width={50} height={50} />
      <div>DisplayName: {me.displayName}</div>
      <div>Role: {me.role}</div>
      <div>Peer ID: {me.meId}</div>
    </div>
  );
};
 
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.