/* Copyright 2021 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import React, { useEffect, useMemo, useState, useRef } from "react"; import styles from "./Room.module.css"; import { useParams, useLocation } from "react-router-dom"; import { useVideoRoom } from "./ConferenceCallManagerHooks"; import { DevTools } from "./DevTools"; import { VideoGrid } from "./VideoGrid"; import { HangupButton, SettingsButton, MicButton, VideoButton, } from "./RoomButton"; import { Header, LeftNav, RightNav, CenterNav } from "./Header"; import { Button } from "./Input"; function useQuery() { const location = useLocation(); return useMemo(() => new URLSearchParams(location.search), [location.search]); } export function Room({ manager }) { const { roomId } = useParams(); const query = useQuery(); const { loading, joined, joining, room, participants, error, joinCall, leaveCall, toggleMuteVideo, toggleMuteAudio, videoMuted, audioMuted, } = useVideoRoom(manager, roomId); const debugStr = query.get("debug"); const [debug, setDebug] = useState(debugStr === "" || debugStr === "true"); useEffect(() => { function onKeyDown(event) { if ( document.activeElement.tagName !== "input" && event.code === "Backquote" ) { setDebug((prevDebug) => !prevDebug); } } window.addEventListener("keydown", onKeyDown); return () => { window.removeEventListener("keydown", onKeyDown); }; }, []); return (
Loading room...
Waiting for other participants...
Webcam permissions needed to join the call.
)}