Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions whereby-for-web-browser/react-based-browser-sdk/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The Browser SDK centers around the `useRoomConnection` hook, which manages the c

```javascript
import React, { useEffect } from "react";
import { useRoomConnection } from "@whereby.com/browser-sdk/react";
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";
```

2. **Set up the room connection**:
Expand All @@ -50,16 +50,15 @@ import { useRoomConnection } from "@whereby.com/browser-sdk/react";
const ROOM_URL = "https://your-subdomain.whereby.com/your-room-id";

function MyVideoApp() {
const { state, actions, components } = useRoomConnection(ROOM_URL, {
const { state, actions } = useRoomConnection(ROOM_URL, {
localMediaOptions: {
audio: true,
video: true,
}
});

const { connectionState, localParticipant, remoteParticipants } = state;
const { connectionStatus, localParticipant, remoteParticipants } = state;
const { joinRoom, leaveRoom } = actions;
const { VideoView } = components;

useEffect(() => {
joinRoom();
Expand Down Expand Up @@ -126,7 +125,7 @@ function MyVideoApp() {
const [isCameraOn, setIsCameraOn] = React.useState(true);
const [isMicrophoneOn, setIsMicrophoneOn] = React.useState(true);

const { state, actions, components } = useRoomConnection(ROOM_URL, {
const { state, actions } = useRoomConnection(ROOM_URL, {
localMediaOptions: {
audio: true,
video: true,
Expand All @@ -135,7 +134,6 @@ function MyVideoApp() {

const { localParticipant, remoteParticipants } = state;
const { joinRoom, leaveRoom, toggleCamera, toggleMicrophone } = actions;
const { VideoView } = components;

useEffect(() => {
joinRoom();
Expand Down Expand Up @@ -184,7 +182,7 @@ Here's a fully functional video app that demonstrates the core Browser SDK featu

```javascript
import React, { useEffect, useState } from "react";
import { useRoomConnection } from "@whereby.com/browser-sdk/react";
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";

const ROOM_URL = "https://your-subdomain.whereby.com/your-room-id";

Expand All @@ -201,23 +199,22 @@ function MyVideoApp() {
const [isCameraOn, setIsCameraOn] = useState(true);
const [isMicrophoneOn, setIsMicrophoneOn] = useState(true);

const { state, actions, components } = useRoomConnection(ROOM_URL, {
const { state, actions } = useRoomConnection(ROOM_URL, {
localMediaOptions: {
audio: true,
video: true,
}
});

const { localParticipant, remoteParticipants, connectionState } = state;
const { localParticipant, remoteParticipants, connectionStatus } = state;
const { joinRoom, leaveRoom, toggleCamera, toggleMicrophone } = actions;
const { VideoView } = components;

useEffect(() => {
joinRoom();
return () => leaveRoom();
}, [joinRoom, leaveRoom]);

if (connectionState === "connecting") {
if (connectionStatus === "connecting") {
return <div>Connecting to room...</div>;
}

Expand Down