useRoomConnection
The useRoomConnection
hook provides the ability to connect participants in a given room, subscribe to state updates, and perform actions on the connection like toggling the camera or microphone.
useRoomConnection(roomUrl: string, roomConnectionOptions: RoomConnectionOptions): Object | null
Parameter | Required | Type | Description |
---|---|---|---|
roomUrl |
| The URL of the Whereby room. Refer to our REST api reference to learn how to create these. | |
roomConnectionOptions | Additional options for the room connection |
Return type
The hook returns a RoomConnectionReference
object with the following properties.
Property | Type | Description |
---|---|---|
state | Object representing the state of the room | |
actions | Object representing the available actions in the room | |
components | Object representing the pre-bound components available for the room |
state
The current state of the room. Use this state to render your custom video experience.
Property | Type | Description |
---|---|---|
chatMessages | The chat messages which have been sent in the room since connecting. | |
cloudRecording | Indicates whether cloud recording is active in the room. | |
connectionStatus | Overall status of the room connection | |
localScreenshareStatus | Status of your local screen share | |
localParticipant | A representation of the local participant in the call (you) | |
remoteParticipants |
| A list of the remote participants in the room |
screenshares | List of active screenshares in the room | |
liveStream | Set if live stream is enabled for the room | |
waitingParticipants | A list of participants waiting to enter a locked room. |
actions
The actions property contains a map of functions which can be invoked to perform an action in the room. All these functions are sync and return void
, and you should rely on the state to render the effect of their invocation.
Property | Type | Description |
---|---|---|
sendChatMessage |
| Send a chat message to the room |
| Let the room host know that the local participant is waiting and wants to join | |
setDisplayName |
| Change your display name |
toggleCamera |
| Change the state of your camera |
toggleMicrophone |
| Change the state of your microphone |
toggleLowDataMode |
| Change the state of low data mode |
acceptWaitingParticipant |
| Accept waiting participant |
rejectWaitingParticipant |
| Reject waiting participant |
startScreenshare |
| Start screen share |
stopScreenshare |
| Stop screen share |
| [Host only] Lock ( | |
| [Host only] Mute remote participants | |
| [Host only] Remove the specified remote participant from the meeting | |
| [Host only] End the meeting for all remote participants |
components
Components are JSX elements bound to the room connection to make it easier for you to render
Property | Type | Description |
---|---|---|
VideoView | A React component to be used for rendering the participant video and audio. |
Usage
Last updated