VideoCall.tsx 839 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

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

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

export default VideoCall