Created
April 8, 2020 08:06
-
-
Save MHDYousuf/9faceb3d70621f46d623381ef3d4cc16 to your computer and use it in GitHub Desktop.
ui for video calling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
margin: 10px; | |
padding: 10px; | |
text-align: center; | |
} | |
.container input { | |
display: block; | |
text-align: center; | |
margin: 0.5em auto; | |
padding: 0.5em; | |
} | |
.stream { | |
width: 480px; | |
height: 320px; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
const [joined, setJoined] = useState(false); | |
const channelRef = useRef(""); | |
const remoteRef = useRef(""); | |
const leaveRef = useRef(""); | |
return ( | |
<> | |
<div className="container"> | |
<input | |
type="text" | |
ref={channelRef} | |
id="channel" | |
placeholder="Enter Channel name" | |
/> | |
<input | |
type="submit" | |
value="Join" | |
onClick={handleSubmit} | |
disabled={joined ? true : false} | |
/> | |
<input | |
type="button" | |
ref={leaveRef} | |
value="Leave" | |
onClick={handleLeave} | |
disabled={joined ? false : true} | |
/> | |
</div> | |
{joined ? ( | |
<> | |
<div id="local-stream" className="stream local-stream"></div> | |
<div | |
id="remote-stream" | |
ref={remoteRef} | |
className="stream remote-stream" | |
></div> | |
</> | |
) : null} | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment