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 {View, Text, Image} from 'react-native';
import { useHuddle01 } from '@huddle01/react-native';
 
const App = () => {
  const { initialize, isInitialized, me, roomState } = useHuddle01();
 
  useEffect(() => {
    // its preferable to use env vars to store projectId
    initialize('YOUR_PROJECT_ID');
  }, []);
 
  return (
    <View>
      {isInitialized ? <Text>'Hello World!' </Text>: <Text>'Please initialize'</Text>}
      <Text> Room State: {roomState} </Text>
      <Image source={{uri: me.avatarUrl}} />
      <Text> displayName: {me.displayName} </Text>
      <Text> Role: {me.role} </Text>
      <Text> Peer ID: {me.meId} </Text>
    </View>;
};
 
 
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.