Commit cb91def6 authored by Thisara Kavinda's avatar Thisara Kavinda

fix: not publishing video and audio issue

parent 52f997c5
...@@ -7,9 +7,8 @@ import { ...@@ -7,9 +7,8 @@ import {
RemoteUser, RemoteUser,
useLocalCameraTrack, useLocalCameraTrack,
useLocalMicrophoneTrack, useLocalMicrophoneTrack,
useRTCClient,
useRemoteUsers, useRemoteUsers,
useClientEvent, usePublish,
} from 'agora-rtc-react' } from 'agora-rtc-react'
const MeetingGrid = () => { const MeetingGrid = () => {
...@@ -18,23 +17,11 @@ const MeetingGrid = () => { ...@@ -18,23 +17,11 @@ const MeetingGrid = () => {
const isMd = useMediaQuery(theme.breakpoints.up('md')) const isMd = useMediaQuery(theme.breakpoints.up('md'))
const isLg = useMediaQuery(theme.breakpoints.up('lg')) const isLg = useMediaQuery(theme.breakpoints.up('lg'))
const agoraEngine = useRTCClient()
const { localCameraTrack } = useLocalCameraTrack() const { localCameraTrack } = useLocalCameraTrack()
const { localMicrophoneTrack } = useLocalMicrophoneTrack() const { localMicrophoneTrack } = useLocalMicrophoneTrack()
usePublish([localMicrophoneTrack, localCameraTrack])
const remoteUsers = useRemoteUsers() const remoteUsers = useRemoteUsers()
useClientEvent(agoraEngine, 'user-joined', (user) => {
console.log('The user', user.uid, ' has joined the channel')
})
useClientEvent(agoraEngine, 'user-left', (user) => {
console.log('The user', user.uid, ' has left the channel')
})
useClientEvent(agoraEngine, 'user-published', (user, mediaType) => {
console.log('The user', user.uid, ' has published media in the channel')
})
const gridContainerRef = useRef<HTMLDivElement>(null) const gridContainerRef = useRef<HTMLDivElement>(null)
const [gridContainerHeight, setGridContainerHeight] = useState(0) const [gridContainerHeight, setGridContainerHeight] = useState(0)
...@@ -145,6 +132,17 @@ const MeetingGrid = () => { ...@@ -145,6 +132,17 @@ const MeetingGrid = () => {
} }
}, [totalUsers, isSm, isMd, isLg, gridContainerHeight, numOfItems]) }, [totalUsers, isSm, isMd, isLg, gridContainerHeight, numOfItems])
// const onUserPublish = async (user: IAgoraRTCRemoteUser, mediaType: 'video' | 'audio') => {
// if (mediaType === 'video') {
// const remoteTrack = await agoraEngine.subscribe(user, mediaType)
// remoteTrack.play('remote-video')
// }
// if (mediaType === 'audio') {
// const remoteTrack = await agoraEngine.subscribe(user, mediaType)
// remoteTrack.play()
// }
// }
return ( return (
<Box <Box
sx={{ sx={{
...@@ -175,7 +173,11 @@ const MeetingGrid = () => { ...@@ -175,7 +173,11 @@ const MeetingGrid = () => {
borderRadius: '15px', borderRadius: '15px',
}} }}
> >
<LocalVideoTrack track={localCameraTrack} play={true} /> <LocalVideoTrack
track={localCameraTrack}
play={true}
style={{ width: '100%', height: '100%', borderRadius: '20%' }}
/>
</Box> </Box>
</Grid> </Grid>
{remoteUsers.map((remoteUser, index) => ( {remoteUsers.map((remoteUser, index) => (
...@@ -187,7 +189,12 @@ const MeetingGrid = () => { ...@@ -187,7 +189,12 @@ const MeetingGrid = () => {
borderRadius: '15px', borderRadius: '15px',
}} }}
> >
<RemoteUser user={remoteUser} playVideo={true} playAudio={true} /> <RemoteUser
user={remoteUser}
playVideo={true}
playAudio={true}
style={{ width: '100%', height: '100%', borderRadius: '15px' }}
/>
</Box> </Box>
</Grid> </Grid>
))} ))}
......
...@@ -23,3 +23,7 @@ code { ...@@ -23,3 +23,7 @@ code {
padding: 0 5%; padding: 0 5%;
clear: both; clear: both;
} }
video {
border-radius: 15px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment