This React application demonstrates two advanced features of VideoSDK:
- Seamless Room Switching: Moving a participant from Room A to Room B without full reconnection.
- Media Relay: Broadcasting a participant's audio/video from Room A to Room B without leaving Room A.
- Join Screen: Create or join a meeting room.
- Meeting Controls: Toggle Mic/Webcam, Leave.
- Switch Room: Seamlessly transition to another room ID.
- Media Relay: Project your presence (A/V) to another room ID.
- Responsive UI: Built with Tailwind CSS.
-
Install Dependencies:
npm install
-
Configure env variable: Create a .env file in the root directory of the project and Add the variable of your valid VideoSDK JWT Token to the .env file:
VITE_VIDEOSDK_TOKEN=<your_generated_auth_token_here>
-
Run the Application:
npm run dev
- Open Tab 1 and join a room (e.g.,
ROOM-A). - Open Tab 2 and join a different room (e.g.,
ROOM-B). - In Tab 1, enter
ROOM-Bin the "Target Room ID" input at the top. - Click Switch To.
- Observe Tab 1 leaving Room A and joining Room B (Tab 2 sees the user appear).
- Refresh both tabs.
- Join
ROOM-Ain Tab 1. - Join
ROOM-Bin Tab 2. - In Tab 1, enter
ROOM-Bin the "Target Room ID" input. - Click Relay Media.
- Observe Tab 1 staying in Room A.
- Observe Tab 2 seeing the video feed from the user in Tab 1 (as if they are a participant).
We use the switchTo method from useMeeting. This keeps the socket connection alive while changing the room context on the server side, resulting in a faster transition than a full disconnect/reconnect.
We use requestMediaRelay to "pipe" the media streams to a destination meeting. This is useful for:
- Webinars where a host speaks to multiple breakout rooms.
- "PK Battles" or cross-stream collaborations.
- Announcements across rooms.