useRoomMetadata

useRoomMetadata

The useRoomMetadata hook returns the metadata associated with the room and the function to update it.

NameDescriptionReturn TypeParams
metadataThe room metadataunknown
updateMetadataUpdates the room metadatavoidmetadata: unknown

Example Usage

const {
    roomData,
    updateMetadata,
  } = useRoomMetadata<{title: string}>({
    onMetadataUpdated(metadata:unknown) {},
    onLeave(data: {
            reason: 'LEFT' | 'CLOSED' | 'KICKED' | 'DENIED';
            message?: string;
    }) {}
  });
 
const updateMetadata = () => {
    updateMetadata({
        string: "Huddle01 Room"
    });
}

Props

The useRoomMetadata hook accepts an object with the following fields as props.

onMetadataUpdated

Optional
DescriptionType
This function will be called when the room metadata gets updated.void

Example Usage

const devices = useRoomMetadata({ onMetadataUpdated:() => {
    console.log("Triggered when metadata updated")
}});

onLeave

Optional
DescriptionType
This function will be called when the peer leaves.void

Example Usage

const devices = useRoomMetadata({ onLeave:() => {
    console.log("Triggered when peer leaves")
}});
Audio/Video Infrastructure designed for developers to empower them to ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2024 Graphene 01, Inc. All Rights Reserved.