useRoom

Acess the following methods & states joinRoom() leaveRoom() isLoading isLobbyJoined error .

NameTypeDescription
joinRoom()Functionmoves user from lobby to actual room with other peers
leaveRoom()Functionremoves user from room, back to the lobby
isLoadingbooleanloading state
isRoomJoinedbooleanstate whether the room is joined or not
errorstringgives the error message
endRoom()FunctionEnds the room for all, only `host` has the ability to call this function

Sample Code

  import {Button, View} from 'react-native';
  import { useRoom } from '@huddle01/react-native/hooks';
 
  const App = () => {
    const { joinRoom, leaveRoom, isLoading, isRoomJoined, error, endRoom } = useRoom();
 
    return (
      <View>
        <View style={styles.button}>
          <Button
            title="JOIN_ROOM"
            disabled={!joinRoom.isCallable}
            onPress={joinRoom}
          />
        </View>
 
        <View style={styles.button}>
          <Button
            title="LEAVE_ROOM"
            disabled={!leaveRoom.isCallable}
            onPress={leaveRoom}
          />
        </View>
 
        <View style={styles.button}>
          <Button
            title="END_ROOM"
            disabled={!endRoom.isCallable}
            onPress={endRoom}
          />
        </View>
      </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.