VideoCall.tsx 910 Bytes
Newer Older
Thisara Kavinda's avatar
Thisara Kavinda committed
1 2 3 4
import { useState } from 'react'
import AgoraRTC from 'agora-rtc-sdk-ng'
import { AgoraRTCProvider, useRTCClient } from 'agora-rtc-react'
import { AgoraManager } from '../../Services/AgoraManager/AgoraManager'
5 6
import Lobby from '../../Components/Lobby/Lobby'
import { Box } from '@mui/material'
Thisara Kavinda's avatar
Thisara Kavinda committed
7 8 9 10 11 12 13 14 15 16

const VideoCall = () => {
  const agoraEngine = useRTCClient(AgoraRTC.createClient({ codec: 'vp8', mode: 'rtc' }))
  const [joined, setJoined] = useState(false)

  const handleJoinClick = () => {
    setJoined(true)
  }

  return (
17 18
    <Box sx={{ height: '100vh', width: '100vw', overflow: 'hidden' }}>
      {joined ? (
Thisara Kavinda's avatar
Thisara Kavinda committed
19
        <AgoraRTCProvider client={agoraEngine}>
20
          <AgoraManager setJoined={setJoined}>
Thisara Kavinda's avatar
Thisara Kavinda committed
21 22 23
            <div>asas</div>
          </AgoraManager>
        </AgoraRTCProvider>
24 25
      ) : (
        <Lobby handleJoinClick={handleJoinClick} />
Thisara Kavinda's avatar
Thisara Kavinda committed
26
      )}
27
    </Box>
Thisara Kavinda's avatar
Thisara Kavinda committed
28 29 30 31
  )
}

export default VideoCall