Moderator: disable screen sharing

auto_join_3.3
Luca 2020-05-12 19:04:41 +02:00
parent 2623ef2eaa
commit 5ea482d01f
6 changed files with 96 additions and 2 deletions

View File

@ -1432,6 +1432,26 @@ export default class RoomClient
peerActions.setStopPeerVideoInProgress(peerId, false));
}
async stopPeerScreenSharing(peerId)
{
logger.debug('stopPeerScreenSharing() [peerId:"%s"]', peerId);
store.dispatch(
peerActions.setStopPeerScreenSharingInProgress(peerId, true));
try
{
await this.sendRequest('moderator:stopScreenSharing', { peerId });
}
catch (error)
{
logger.error('stopPeerScreenSharing() failed: %o', error);
}
store.dispatch(
peerActions.setStopPeerScreenSharingInProgress(peerId, false));
}
async muteAllPeers()
{
logger.debug('muteAllPeers()');
@ -2592,7 +2612,6 @@ export default class RoomClient
case 'moderator:stopVideo':
{
this.disableWebcam();
this.disableScreenSharing();
store.dispatch(requestActions.notify(
{
@ -2605,6 +2624,21 @@ export default class RoomClient
break;
}
case 'moderator:stopScreenSharing':
{
this.disableScreenSharing();
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
id : 'moderator.muteScreenSharingModerator',
defaultMessage : 'Moderator stopped your screen sharing'
})
}));
break;
}
case 'moderator:kick':
{
// Need some feedback

View File

@ -86,3 +86,10 @@ export const setStopPeerVideoInProgress = (peerId, flag) =>
type : 'STOP_PEER_VIDEO_IN_PROGRESS',
payload : { peerId, flag }
});
export const setStopPeerScreenSharingInProgress = (peerId, flag) =>
({
type : 'STOP_PEER_SCREEN_SHARING_IN_PROGRESS',
payload : { peerId, flag }
});

View File

@ -306,6 +306,33 @@ const ListPeer = (props) =>
</IconButton>
</Tooltip>
}
{ isModerator && screenConsumer &&
<Tooltip
title={intl.formatMessage({
id : 'tooltip.muteScreenSharing',
defaultMessage : 'Mute participant screen share globally'
})}
placement='bottom'
>
<IconButton
className={classes.buttons}
style={{ color: green[500] }}
disabled={!isModerator || peer.stopPeerScreenSharingInProgress}
onClick={(e) =>
{
e.stopPropagation();
roomClient.stopPeerScreenSharing(peer.id);
}}
>
{ !screenConsumer.remotelyPaused ?
<ScreenIcon />
:
<ScreenOffIcon />
}
</IconButton>
</Tooltip>
}
{children}
</div>
);

View File

@ -82,6 +82,11 @@ const peer = (state = initialState, action) =>
stopPeerVideoInProgress : action.payload.flag
};
case 'STOP_PEER_SCREEN_SHARING_IN_PROGRESS':
return {
...state,
stopPeerScreenSharingInProgress : action.payload.flag
};
default:
return state;
}
@ -118,6 +123,7 @@ const peers = (state = initialState, action) =>
case 'REMOVE_PEER_ROLE':
case 'STOP_PEER_AUDIO_IN_PROGRESS':
case 'STOP_PEER_VIDEO_IN_PROGRESS':
case 'STOP_PEER_SCREEN_SHARING_IN_PROGRESS':
{
const oldPeer = state[action.payload.peerId];

View File

@ -183,5 +183,6 @@
"moderator.clearChat": "Moderator cleared the chat",
"moderator.clearFiles": "Moderator cleared the files",
"moderator.muteAudio": "Moderator muted your audio",
"moderator.muteVideo": "Moderator muted your video"
"moderator.muteVideo": "Moderator muted your video",
"moderator.muteScreenSharing": "Moderator muted your screen sharing"
}

View File

@ -1441,6 +1441,25 @@ class Room extends EventEmitter
break;
}
case 'moderator:stopScreenSharing':
{
if (!this._hasPermission(peer, MODERATE_ROOM))
throw new Error('peer not authorized');
const { peerId } = request.data;
const stopVideoPeer = this._peers[peerId];
if (!stopVideoPeer)
throw new Error(`peer with id "${peerId}" not found`);
this._notification(stopVideoPeer.socket, 'moderator:stopScreenSharing');
cb();
break;
}
case 'moderator:closeMeeting':
{
if (!this._hasPermission(peer, MODERATE_ROOM))