ADDING ICONS
WE ADD ICONS TO CONTROL THE AUDIO, VIDEO AND TO END THE CALL.
VIDEOCONFERENCE.JSX
mport { Badge, IconButton } from "@mui/material";
import ScreenShareTwoToneIcon from "@mui/icons-material/ScreenShareTwoTone";
import StopScreenShareTwoToneIcon from "@mui/icons-material/StopScreenShareTwoTone";
import SettingsVoiceSharpIcon from "@mui/icons-material/SettingsVoiceSharp";
import MicOffOutlinedIcon from "@mui/icons-material/MicOffOutlined";
import VideocamOffOutlinedIcon from "@mui/icons-material/VideocamOffOutlined";
import ForumOutlinedIcon from "@mui/icons-material/ForumOutlined";
import CallEndOutlinedIcon from "@mui/icons-material/CallEndOutlined";
import VideocamOutlinedIcon from "@mui/icons-material/VideocamOutlined";
import ForumIcon from "@mui/icons-material/Forum";
const [videoAvailable, setVideoAvailable] = useState(true);
const [audioAvailable, setAudioAvailable] = useState(true);
const handleMic = () => {
setAudio(!audio);
};
const handleVideo = () => {
setVideo(!video);
};
let handleCallEnd = () => {
try {
let tracks = localVideoRef.current.srcObject.getTracks();
tracks.forEach((track) => track.stop());
} catch (e) {
console.log(e);
}
(window.location.href = "/");
};
<div className={styles.Icons}>
<IconButton onClick={handleMic} style={{ color: "white" }}>
{audio === true ? (
<SettingsVoiceSharpIcon />
) : (
<MicOffOutlinedIcon />
)}
</IconButton>
<IconButton onClick={handleVideo} style={{ color: "white" }}>
{video === true ? (
<VideocamOutlinedIcon />
) : (
<VideocamOffOutlinedIcon />
)}
</IconButton>
<IconButton
onClick={handleScreenShare}
style={{ color: "white" }}
>
{screen === true ? (
<StopScreenShareTwoToneIcon />
) : (
<ScreenShareTwoToneIcon />
)}
</IconButton>
<IconButton onClick={handleCallEnd} style={{ color: "red" }}>
<CallEndOutlinedIcon />{" "}
</IconButton>
<Badge
color="secondary"
onClick={() => setShowChat(!showChat)}
badgeContent={newMessages}
max={999}
sx={{
"&:hover": {
opacity: "0.5",
cursor: "pointer",
},
}}
>
{" "}
{showChat ? (
<ForumOutlinedIcon style={{ color: "white" }} />
) : (
<ForumIcon style={{ color: "white" }} />
)}
</Badge>
</div>
.Icons {
bottom: 0;
position: relative;
width: 100%;
display: flex;
justify-content: space-evenly;
align-items: center;
z-index: 10;
background-color: rgb(30, 29, 29);
}

Comments
Post a Comment