Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(moderation) display green mic icon only for active speaker (#9744)

Avram Tudor6d3a4b920b82
diff --git a/css/_base.scss b/css/_base.scss
index f0fa7b7c3d..67ad368b7e 100644
--- a/css/_base.scss
+++ b/css/_base.scss
@@ -51,8 +51,10 @@ body {
}
}
-.jitsi-icon svg {
- fill: white;
+.jitsi-icon {
+ &-default svg {
+ fill: white;
+ }
}
.disabled .jitsi-icon svg {
diff --git a/react/features/base/icons/components/Icon.js b/react/features/base/icons/components/Icon.js
index 42fb9ce4a9..4aa49fa999 100644
--- a/react/features/base/icons/components/Icon.js
+++ b/react/features/base/icons/components/Icon.js
@@ -153,6 +153,8 @@ export default function Icon(props: Props) {
}
}, [ onClick, onKeyPress ]);
+ const jitsiIconClassName = calculatedColor ? 'jitsi-icon' : 'jitsi-icon jitsi-icon-default';
+
return (
<Container
{ ...rest }
@@ -163,7 +165,7 @@ export default function Icon(props: Props) {
aria-haspopup = { ariaHasPopup }
aria-label = { ariaLabel }
aria-pressed = { ariaPressed }
- className = { `jitsi-icon ${className || ''}` }
+ className = { `${jitsiIconClassName} ${className || ''}` }
id = { containerId }
onClick = { onClick }
onKeyDown = { onKeyDown }
diff --git a/react/features/participants-pane/components/web/ParticipantItem.js b/react/features/participants-pane/components/web/ParticipantItem.js
index 65620335c9..2aab244a72 100644
--- a/react/features/participants-pane/components/web/ParticipantItem.js
+++ b/react/features/participants-pane/components/web/ParticipantItem.js
@@ -4,17 +4,16 @@ import React, { type Node } from 'react';
import { Avatar } from '../../../base/avatar';
import {
- Icon,
- IconCameraEmpty,
- IconCameraEmptyDisabled,
- IconMicrophoneEmpty,
- IconMicrophoneEmptySlash
-} from '../../../base/icons';
-import { ACTION_TRIGGER, MEDIA_STATE, type ActionTrigger, type MediaState } from '../../constants';
+ ACTION_TRIGGER,
+ AudioStateIcons,
+ MEDIA_STATE,
+ type ActionTrigger,
+ type MediaState,
+ VideoStateIcons
+} from '../../constants';
import { RaisedHandIndicator } from './RaisedHandIndicator';
import {
- ColoredIcon,
ParticipantActionsHover,
ParticipantActionsPermanent,
ParticipantContainer,
@@ -32,54 +31,6 @@ const Actions = {
[ACTION_TRIGGER.PERMANENT]: ParticipantActionsPermanent
};
-/**
- * Icon mapping for possible participant audio states.
- */
-const AudioStateIcons: {[MediaState]: React$Element<any> | null} = {
- [MEDIA_STATE.FORCE_MUTED]: (
- <ColoredIcon color = '#E04757'>
- <Icon
- size = { 16 }
- src = { IconMicrophoneEmptySlash } />
- </ColoredIcon>
- ),
- [MEDIA_STATE.MUTED]: (
- <Icon
- size = { 16 }
- src = { IconMicrophoneEmptySlash } />
- ),
- [MEDIA_STATE.UNMUTED]: (
- <ColoredIcon color = '#1EC26A'>
- <Icon
- size = { 16 }
- src = { IconMicrophoneEmpty } />
- </ColoredIcon>
- ),
- [MEDIA_STATE.NONE]: null
-};
-
-/**
- * Icon mapping for possible participant video states.
- */
-const VideoStateIcons = {
- [MEDIA_STATE.FORCE_MUTED]: (
- <Icon
- size = { 16 }
- src = { IconCameraEmptyDisabled } />
- ),
- [MEDIA_STATE.MUTED]: (
- <Icon
- size = { 16 }
- src = { IconCameraEmptyDisabled } />
- ),
- [MEDIA_STATE.UNMUTED]: (
- <Icon
- size = { 16 }
- src = { IconCameraEmpty } />
- ),
- [MEDIA_STATE.NONE]: null
-};
-
type Props = {
/**
diff --git a/react/features/participants-pane/components/web/styled.js b/react/features/participants-pane/components/web/styled.js
index 5bbe47f826..b1152bbdb1 100644
--- a/react/features/participants-pane/components/web/styled.js
+++ b/react/features/participants-pane/components/web/styled.js
@@ -190,12 +190,6 @@ export const Heading = styled.div`
margin: 8px 0 ${props => props.theme.panePadding}px;
`;
-export const ColoredIcon = styled.div`
- & > div > svg {
- fill: ${props => props.color || '#fff'};
- }
-`;
-
export const ParticipantActionButton = styled(Button)`
height: ${props => props.theme.participantActionButtonHeight}px;
padding: 6px 10px;
diff --git a/react/features/participants-pane/constants.js b/react/features/participants-pane/constants.js
index c9b5b91a8b..db194ef5b2 100644
--- a/react/features/participants-pane/constants.js
+++ b/react/features/participants-pane/constants.js
@@ -25,17 +25,19 @@ export const ACTION_TRIGGER: {HOVER: ActionTrigger, PERMANENT: ActionTrigger} =
PERMANENT: 'Permanent'
};
-export type MediaState = 'Muted' | 'ForceMuted' | 'Unmuted' | 'None';
+export type MediaState = 'DominantSpeaker' | 'Muted' | 'ForceMuted' | 'Unmuted' | 'None';
/**
* Enum of possible participant media states.
*/
export const MEDIA_STATE: {
+ DOMINANT_SPEAKER: MediaState,
MUTED: MediaState,
FORCE_MUTED: MediaState,
UNMUTED: MediaState,
NONE: MediaState,
} = {
+ DOMINANT_SPEAKER: 'DominantSpeaker',
MUTED: 'Muted',
FORCE_MUTED: 'ForceMuted',
UNMUTED: 'Unmuted',
@@ -61,6 +63,12 @@ export const QUICK_ACTION_BUTTON: {
* Icon mapping for possible participant audio states.
*/
export const AudioStateIcons: {[MediaState]: React$Element<any> | null} = {
+ [MEDIA_STATE.DOMINANT_SPEAKER]: (
+ <Icon
+ color = '#1EC26A'
+ size = { 16 }
+ src = { IconMicrophoneEmpty } />
+ ),
[MEDIA_STATE.FORCE_MUTED]: (
<Icon
color = '#E04757'
@@ -74,7 +82,6 @@ export const AudioStateIcons: {[MediaState]: React$Element<any> | null} = {
),
[MEDIA_STATE.UNMUTED]: (
<Icon
- color = '#1EC26A'
size = { 16 }
src = { IconMicrophoneEmpty } />
),
diff --git a/react/features/participants-pane/functions.js b/react/features/participants-pane/functions.js
index 6b30810502..5a112cca9d 100644
--- a/react/features/participants-pane/functions.js
+++ b/react/features/participants-pane/functions.js
@@ -8,6 +8,7 @@ import {
import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
import {
+ getDominantSpeakerParticipant,
getParticipantCount,
isLocalParticipantModerator,
isParticipantModerator
@@ -74,6 +75,12 @@ export function isForceMuted(participant: Object, mediaType: MediaType, state: O
* @returns {MediaState}
*/
export function getParticipantAudioMediaState(participant: Object, muted: Boolean, state: Object) {
+ const dominantSpeaker = getDominantSpeakerParticipant(state);
+
+ if (participant === dominantSpeaker) {
+ return MEDIA_STATE.DOMINANT_SPEAKER;
+ }
+
if (muted) {
if (isForceMuted(participant, MEDIA_TYPE.AUDIO, state)) {
return MEDIA_STATE.FORCE_MUTED;