1- import { useMeeting , useParticipant } from "@videosdk.live/react-sdk" ;
1+ import {
2+ useMeeting ,
3+ useParticipant ,
4+ usePubSub ,
5+ } from "@videosdk.live/react-sdk" ;
26import {
37 Close ,
48 MoreVert ,
@@ -7,6 +11,8 @@ import {
711 Mic as MicIcon ,
812 VideocamOff as VideocamOffIcon ,
913 Videocam as VideocamIcon ,
14+ ScreenShareOutlined ,
15+ ScreenShare ,
1016} from "@material-ui/icons" ;
1117import {
1218 Avatar ,
@@ -35,6 +41,7 @@ function ParticipantListItem({
3541 participantExpandedId,
3642 setParticipantExpandedId,
3743} ) {
44+ const { presenterId } = useMeeting ( ) ;
3845 const {
3946 participant,
4047 micOn,
@@ -53,11 +60,18 @@ function ParticipantListItem({
5360 const {
5461 participantCanToggleOtherMic,
5562 participantCanToggleOtherWebcam,
63+ partcipantCanToogleOtherScreenShare,
5664 canRemoveOtherParticipant,
5765 canPin,
5866 animationsEnabled,
5967 } = useMeetingAppContext ( ) ;
6068
69+ const isParticipantPresenting = useMemo ( ( ) => {
70+ return presenterId === participantId ;
71+ } , [ presenterId , participantId ] ) ;
72+
73+ const { publish } = usePubSub ( `SCR_SHR_REQ_${ participantId } ` ) ;
74+
6175 const [ isParticipantKickoutVisible , setIsParticipantKickoutVisible ] =
6276 useState ( false ) ;
6377
@@ -284,6 +298,41 @@ function ParticipantListItem({
284298 </ Tooltip >
285299 </ Box >
286300 ) }
301+
302+ < Box ml = { 1 } mr = { 0 } >
303+ < Tooltip title = { `Screen share` } >
304+ < IconButton
305+ disabled = {
306+ ! (
307+ ! isLocal &&
308+ partcipantCanToogleOtherScreenShare &&
309+ ( presenterId ? isParticipantPresenting : true )
310+ )
311+ }
312+ style = { { padding : 0 } }
313+ onClick = { ( ) => {
314+ publish ( { setScreenShareOn : ! isParticipantPresenting } ) ;
315+ } }
316+ >
317+ < Box
318+ style = { {
319+ display : "flex" ,
320+ justifyContent : "center" ,
321+ alignItems : "center" ,
322+ borderRadius : 100 ,
323+ } }
324+ p = { 0.5 }
325+ >
326+ { isParticipantPresenting ? (
327+ < ScreenShare />
328+ ) : (
329+ < ScreenShareOutlined color = "#ffffff80" />
330+ ) }
331+ </ Box >
332+ </ IconButton >
333+ </ Tooltip >
334+ </ Box >
335+
287336 { ! isLocal && canRemoveOtherParticipant && (
288337 < Box ml = { 1 } mr = { 0 } >
289338 < Tooltip title = { `Remove` } >
0 commit comments