Browse Source

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

master
Avram Tudor 3 years ago
parent
commit
6d3a4b920b
No account linked to committer's email address

+ 4
- 2
css/_base.scss View File

51
     }
51
     }
52
 }
52
 }
53
 
53
 
54
-.jitsi-icon svg {
55
-    fill: white;
54
+.jitsi-icon {
55
+    &-default svg {
56
+        fill: white;
57
+    }
56
 }
58
 }
57
 
59
 
58
 .disabled .jitsi-icon svg {
60
 .disabled .jitsi-icon svg {

+ 3
- 1
react/features/base/icons/components/Icon.js View File

153
         }
153
         }
154
     }, [ onClick, onKeyPress ]);
154
     }, [ onClick, onKeyPress ]);
155
 
155
 
156
+    const jitsiIconClassName = calculatedColor ? 'jitsi-icon' : 'jitsi-icon jitsi-icon-default';
157
+
156
     return (
158
     return (
157
         <Container
159
         <Container
158
             { ...rest }
160
             { ...rest }
163
             aria-haspopup = { ariaHasPopup }
165
             aria-haspopup = { ariaHasPopup }
164
             aria-label = { ariaLabel }
166
             aria-label = { ariaLabel }
165
             aria-pressed = { ariaPressed }
167
             aria-pressed = { ariaPressed }
166
-            className = { `jitsi-icon ${className || ''}` }
168
+            className = { `${jitsiIconClassName} ${className || ''}` }
167
             id = { containerId }
169
             id = { containerId }
168
             onClick = { onClick }
170
             onClick = { onClick }
169
             onKeyDown = { onKeyDown }
171
             onKeyDown = { onKeyDown }

+ 7
- 56
react/features/participants-pane/components/web/ParticipantItem.js View File

4
 
4
 
5
 import { Avatar } from '../../../base/avatar';
5
 import { Avatar } from '../../../base/avatar';
6
 import {
6
 import {
7
-    Icon,
8
-    IconCameraEmpty,
9
-    IconCameraEmptyDisabled,
10
-    IconMicrophoneEmpty,
11
-    IconMicrophoneEmptySlash
12
-} from '../../../base/icons';
13
-import { ACTION_TRIGGER, MEDIA_STATE, type ActionTrigger, type MediaState } from '../../constants';
7
+    ACTION_TRIGGER,
8
+    AudioStateIcons,
9
+    MEDIA_STATE,
10
+    type ActionTrigger,
11
+    type MediaState,
12
+    VideoStateIcons
13
+} from '../../constants';
14
 
14
 
15
 import { RaisedHandIndicator } from './RaisedHandIndicator';
15
 import { RaisedHandIndicator } from './RaisedHandIndicator';
16
 import {
16
 import {
17
-    ColoredIcon,
18
     ParticipantActionsHover,
17
     ParticipantActionsHover,
19
     ParticipantActionsPermanent,
18
     ParticipantActionsPermanent,
20
     ParticipantContainer,
19
     ParticipantContainer,
32
     [ACTION_TRIGGER.PERMANENT]: ParticipantActionsPermanent
31
     [ACTION_TRIGGER.PERMANENT]: ParticipantActionsPermanent
33
 };
32
 };
34
 
33
 
35
-/**
36
- * Icon mapping for possible participant audio states.
37
- */
38
-const AudioStateIcons: {[MediaState]: React$Element<any> | null} = {
39
-    [MEDIA_STATE.FORCE_MUTED]: (
40
-        <ColoredIcon color = '#E04757'>
41
-            <Icon
42
-                size = { 16 }
43
-                src = { IconMicrophoneEmptySlash } />
44
-        </ColoredIcon>
45
-    ),
46
-    [MEDIA_STATE.MUTED]: (
47
-        <Icon
48
-            size = { 16 }
49
-            src = { IconMicrophoneEmptySlash } />
50
-    ),
51
-    [MEDIA_STATE.UNMUTED]: (
52
-        <ColoredIcon color = '#1EC26A'>
53
-            <Icon
54
-                size = { 16 }
55
-                src = { IconMicrophoneEmpty } />
56
-        </ColoredIcon>
57
-    ),
58
-    [MEDIA_STATE.NONE]: null
59
-};
60
-
61
-/**
62
- * Icon mapping for possible participant video states.
63
- */
64
-const VideoStateIcons = {
65
-    [MEDIA_STATE.FORCE_MUTED]: (
66
-        <Icon
67
-            size = { 16 }
68
-            src = { IconCameraEmptyDisabled } />
69
-    ),
70
-    [MEDIA_STATE.MUTED]: (
71
-        <Icon
72
-            size = { 16 }
73
-            src = { IconCameraEmptyDisabled } />
74
-    ),
75
-    [MEDIA_STATE.UNMUTED]: (
76
-        <Icon
77
-            size = { 16 }
78
-            src = { IconCameraEmpty } />
79
-    ),
80
-    [MEDIA_STATE.NONE]: null
81
-};
82
-
83
 type Props = {
34
 type Props = {
84
 
35
 
85
     /**
36
     /**

+ 0
- 6
react/features/participants-pane/components/web/styled.js View File

190
   margin: 8px 0 ${props => props.theme.panePadding}px;
190
   margin: 8px 0 ${props => props.theme.panePadding}px;
191
 `;
191
 `;
192
 
192
 
193
-export const ColoredIcon = styled.div`
194
-  & > div > svg {
195
-    fill: ${props => props.color || '#fff'};
196
-  }
197
-`;
198
-
199
 export const ParticipantActionButton = styled(Button)`
193
 export const ParticipantActionButton = styled(Button)`
200
   height: ${props => props.theme.participantActionButtonHeight}px;
194
   height: ${props => props.theme.participantActionButtonHeight}px;
201
   padding: 6px 10px;
195
   padding: 6px 10px;

+ 9
- 2
react/features/participants-pane/constants.js View File

25
     PERMANENT: 'Permanent'
25
     PERMANENT: 'Permanent'
26
 };
26
 };
27
 
27
 
28
-export type MediaState = 'Muted' | 'ForceMuted' | 'Unmuted' | 'None';
28
+export type MediaState = 'DominantSpeaker' | 'Muted' | 'ForceMuted' | 'Unmuted' | 'None';
29
 
29
 
30
 /**
30
 /**
31
  * Enum of possible participant media states.
31
  * Enum of possible participant media states.
32
  */
32
  */
33
 export const MEDIA_STATE: {
33
 export const MEDIA_STATE: {
34
+    DOMINANT_SPEAKER: MediaState,
34
     MUTED: MediaState,
35
     MUTED: MediaState,
35
     FORCE_MUTED: MediaState,
36
     FORCE_MUTED: MediaState,
36
     UNMUTED: MediaState,
37
     UNMUTED: MediaState,
37
     NONE: MediaState,
38
     NONE: MediaState,
38
 } = {
39
 } = {
40
+    DOMINANT_SPEAKER: 'DominantSpeaker',
39
     MUTED: 'Muted',
41
     MUTED: 'Muted',
40
     FORCE_MUTED: 'ForceMuted',
42
     FORCE_MUTED: 'ForceMuted',
41
     UNMUTED: 'Unmuted',
43
     UNMUTED: 'Unmuted',
61
  * Icon mapping for possible participant audio states.
63
  * Icon mapping for possible participant audio states.
62
  */
64
  */
63
 export const AudioStateIcons: {[MediaState]: React$Element<any> | null} = {
65
 export const AudioStateIcons: {[MediaState]: React$Element<any> | null} = {
66
+    [MEDIA_STATE.DOMINANT_SPEAKER]: (
67
+        <Icon
68
+            color = '#1EC26A'
69
+            size = { 16 }
70
+            src = { IconMicrophoneEmpty } />
71
+    ),
64
     [MEDIA_STATE.FORCE_MUTED]: (
72
     [MEDIA_STATE.FORCE_MUTED]: (
65
         <Icon
73
         <Icon
66
             color = '#E04757'
74
             color = '#E04757'
74
     ),
82
     ),
75
     [MEDIA_STATE.UNMUTED]: (
83
     [MEDIA_STATE.UNMUTED]: (
76
         <Icon
84
         <Icon
77
-            color = '#1EC26A'
78
             size = { 16 }
85
             size = { 16 }
79
             src = { IconMicrophoneEmpty } />
86
             src = { IconMicrophoneEmpty } />
80
     ),
87
     ),

+ 7
- 0
react/features/participants-pane/functions.js View File

8
 import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
8
 import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
9
 import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
9
 import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
10
 import {
10
 import {
11
+    getDominantSpeakerParticipant,
11
     getParticipantCount,
12
     getParticipantCount,
12
     isLocalParticipantModerator,
13
     isLocalParticipantModerator,
13
     isParticipantModerator
14
     isParticipantModerator
74
  * @returns {MediaState}
75
  * @returns {MediaState}
75
  */
76
  */
76
 export function getParticipantAudioMediaState(participant: Object, muted: Boolean, state: Object) {
77
 export function getParticipantAudioMediaState(participant: Object, muted: Boolean, state: Object) {
78
+    const dominantSpeaker = getDominantSpeakerParticipant(state);
79
+
80
+    if (participant === dominantSpeaker) {
81
+        return MEDIA_STATE.DOMINANT_SPEAKER;
82
+    }
83
+
77
     if (muted) {
84
     if (muted) {
78
         if (isForceMuted(participant, MEDIA_TYPE.AUDIO, state)) {
85
         if (isForceMuted(participant, MEDIA_TYPE.AUDIO, state)) {
79
             return MEDIA_STATE.FORCE_MUTED;
86
             return MEDIA_STATE.FORCE_MUTED;

Loading…
Cancel
Save