feat(media) Disable desktopshare when the video sender limit is reached.

This commit is contained in:
Jaya Allamsetty 2021-12-10 13:44:35 -05:00 committed by Jaya Allamsetty
parent 11eb6689dc
commit 229e65133c
3 changed files with 13 additions and 5 deletions

View File

@ -638,8 +638,8 @@
"reactionSounds": "Disable sounds", "reactionSounds": "Disable sounds",
"reactionSoundsForAll": "Disable sounds for all", "reactionSoundsForAll": "Disable sounds for all",
"groupTitle": "Notifications", "groupTitle": "Notifications",
"videoUnmuteBlockedTitle": "Camera unmute blocked!", "videoUnmuteBlockedTitle": "Camera unmute and desktop sharing blocked!",
"videoUnmuteBlockedDescription": "Camera unmute operation has been temporarily blocked because of system limits." "videoUnmuteBlockedDescription": "Camera unmute and desktop sharing operation have been temporarily blocked because of system limits."
}, },
"participantsPane": { "participantsPane": {
"close": "Close", "close": "Close",

View File

@ -13,6 +13,7 @@ import {
showWarningNotification showWarningNotification
} from '../../notifications'; } from '../../notifications';
import { isForceMuted } from '../../participants-pane/functions'; import { isForceMuted } from '../../participants-pane/functions';
import { isScreenMediaShared } from '../../screen-share';
import { SET_AUDIO_ONLY, setAudioOnly } from '../audio-only'; import { SET_AUDIO_ONLY, setAudioOnly } from '../audio-only';
import { isRoomValid, SET_ROOM } from '../conference'; import { isRoomValid, SET_ROOM } from '../conference';
import { getLocalParticipant } from '../participants'; import { getLocalParticipant } from '../participants';
@ -114,8 +115,9 @@ MiddlewareRegistry.register(store => next => action => {
const state = store.getState(); const state = store.getState();
const tracks = state['features/base/tracks']; const tracks = state['features/base/tracks'];
const isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO); const isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
const isMediaShared = isScreenMediaShared(state);
if (blocked && isVideoMuted) { if (blocked && isVideoMuted && !isMediaShared) {
store.dispatch(showWarningNotification({ store.dispatch(showWarningNotification({
descriptionKey: 'notify.videoUnmuteBlockedDescription', descriptionKey: 'notify.videoUnmuteBlockedDescription',
titleKey: 'notify.videoUnmuteBlockedTitle' titleKey: 'notify.videoUnmuteBlockedTitle'

View File

@ -5,7 +5,7 @@ import { IconShareDesktop } from '../../../base/icons';
import JitsiMeetJS from '../../../base/lib-jitsi-meet/_'; import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components'; import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
import { isScreenVideoShared } from '../../../screen-share'; import { isScreenMediaShared, isScreenVideoShared } from '../../../screen-share';
type Props = AbstractButtonProps & { type Props = AbstractButtonProps & {
@ -113,7 +113,13 @@ class ShareDesktopButton extends AbstractButton<Props, *> {
* @returns {Object} * @returns {Object}
*/ */
const mapStateToProps = state => { const mapStateToProps = state => {
let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled(); const { muted, unmuteBlocked } = state['features/base/media'].video;
const videoOrShareInProgress = isScreenMediaShared(state) || !muted;
// Disable the screenshare button if the video sender limit is reached and there is no video or media share in
// progress.
let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled()
&& !(unmuteBlocked && !videoOrShareInProgress);
const { enableFeaturesBasedOnToken } = state['features/base/config']; const { enableFeaturesBasedOnToken } = state['features/base/config'];
let desktopSharingDisabledTooltipKey; let desktopSharingDisabledTooltipKey;