소스 검색

ref(StatusIndicators): Use audio muted from redux.

j8
Hristo Terezov 4 년 전
부모
커밋
b71d92a139

+ 2
- 2
modules/UI/UI.js 파일 보기

@@ -356,8 +356,8 @@ UI.askForNickname = function() {
356 356
 /**
357 357
  * Sets muted audio state for participant
358 358
  */
359
-UI.setAudioMuted = function(id, muted) {
360
-    VideoLayout.onAudioMute(id, muted);
359
+UI.setAudioMuted = function(id) {
360
+    // FIXME: Maybe this can be removed!
361 361
     if (APP.conference.isLocalId(id)) {
362 362
         APP.conference.updateAudioIconEnabled();
363 363
     }

+ 1
- 7
modules/UI/videolayout/RemoteVideo.js 파일 보기

@@ -198,7 +198,6 @@ export default class RemoteVideo extends SmallVideo {
198 198
                     <AtlasKitThemeProvider mode = 'dark'>
199 199
                         <RemoteVideoMenuTriggerButton
200 200
                             initialVolumeValue = { initialVolumeValue }
201
-                            isAudioMuted = { this.isAudioMuted }
202 201
                             menuPosition = { remoteMenuPosition }
203 202
                             onMenuDisplay
204 203
                                 = {this._onRemoteVideoMenuDisplay.bind(this)}
@@ -302,13 +301,8 @@ export default class RemoteVideo extends SmallVideo {
302 301
 
303 302
     /**
304 303
      * Updates the remote video menu.
305
-     *
306
-     * @param isMuted the new muted state to update to
307 304
      */
308
-    updateRemoteVideoMenu(isMuted) {
309
-        if (typeof isMuted !== 'undefined') {
310
-            this.isAudioMuted = isMuted;
311
-        }
305
+    updateRemoteVideoMenu() {
312 306
         this._generatePopupContent();
313 307
     }
314 308
 

+ 0
- 13
modules/UI/videolayout/SmallVideo.js 파일 보기

@@ -85,7 +85,6 @@ export default class SmallVideo {
85 85
      * Constructor.
86 86
      */
87 87
     constructor(VideoLayout) {
88
-        this.isAudioMuted = false;
89 88
         this.isScreenSharing = false;
90 89
         this.videoStream = null;
91 90
         this.audioStream = null;
@@ -218,17 +217,6 @@ export default class SmallVideo {
218 217
         this.updateIndicators();
219 218
     }
220 219
 
221
-    /**
222
-     * Shows / hides the audio muted indicator over small videos.
223
-     *
224
-     * @param {boolean} isMuted indicates if the muted element should be shown
225
-     * or hidden
226
-     */
227
-    showAudioIndicator(isMuted) {
228
-        this.isAudioMuted = isMuted;
229
-        this.updateStatusBar();
230
-    }
231
-
232 220
     /**
233 221
      * Shows / hides the screen-share indicator over small videos.
234 222
      *
@@ -262,7 +250,6 @@ export default class SmallVideo {
262 250
             <Provider store = { APP.store }>
263 251
                 <I18nextProvider i18n = { i18next }>
264 252
                     <StatusIndicators
265
-                        showAudioMutedIndicator = { this.isAudioMuted }
266 253
                         showScreenShareIndicator = { this.isScreenSharing }
267 254
                         participantID = { this.id } />
268 255
                 </I18nextProvider>

+ 1
- 21
modules/UI/videolayout/VideoLayout.js 파일 보기

@@ -173,9 +173,7 @@ const VideoLayout = {
173 173
         remoteVideo.addRemoteStreamElement(stream);
174 174
 
175 175
         // Make sure track's muted state is reflected
176
-        if (stream.getType() === 'audio') {
177
-            this.onAudioMute(id, stream.isMuted());
178
-        } else {
176
+        if (stream.getType() !== 'audio') {
179 177
             this.onVideoMute(id);
180 178
             remoteVideo.setScreenSharing(stream.videoType === 'desktop');
181 179
         }
@@ -329,24 +327,6 @@ const VideoLayout = {
329 327
         this._updateLargeVideoIfDisplayed(resourceJid, true);
330 328
     },
331 329
 
332
-    /**
333
-     * On audio muted event.
334
-     */
335
-    onAudioMute(id, isMuted) {
336
-        if (APP.conference.isLocalId(id)) {
337
-            localVideoThumbnail.showAudioIndicator(isMuted);
338
-        } else {
339
-            const remoteVideo = remoteVideos[id];
340
-
341
-            if (!remoteVideo) {
342
-                return;
343
-            }
344
-
345
-            remoteVideo.showAudioIndicator(isMuted);
346
-            remoteVideo.updateRemoteVideoMenu();
347
-        }
348
-    },
349
-
350 330
     /**
351 331
      * On video muted event.
352 332
      */

+ 11
- 7
react/features/filmstrip/components/web/StatusIndicators.js 파일 보기

@@ -25,6 +25,11 @@ type Props = {
25 25
      */
26 26
     _currentLayout: string,
27 27
 
28
+    /**
29
+     * Indicates if the audio muted indicator should be visible or not.
30
+     */
31
+    _showAudioMutedIndicator: Boolean,
32
+
28 33
     /**
29 34
      * Indicates if the moderator indicator should be visible or not.
30 35
      */
@@ -35,11 +40,6 @@ type Props = {
35 40
      */
36 41
     _showVideoMutedIndicator: Boolean,
37 42
 
38
-    /**
39
-     * Indicates if the audio muted indicator should be visible or not.
40
-     */
41
-    showAudioMutedIndicator: Boolean,
42
-
43 43
     /**
44 44
      * Indicates if the screen share indicator should be visible or not.
45 45
      */
@@ -66,8 +66,8 @@ class StatusIndicators extends Component<Props> {
66 66
     render() {
67 67
         const {
68 68
             _currentLayout,
69
+            _showAudioMutedIndicator,
69 70
             _showModeratorIndicator,
70
-            showAudioMutedIndicator,
71 71
             showScreenShareIndicator,
72 72
             _showVideoMutedIndicator
73 73
         } = this.props;
@@ -86,7 +86,7 @@ class StatusIndicators extends Component<Props> {
86 86
 
87 87
         return (
88 88
             <div>
89
-                { showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
89
+                { _showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
90 90
                 { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
91 91
                 { _showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
92 92
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
@@ -115,15 +115,19 @@ function _mapStateToProps(state, ownProps) {
115 115
 
116 116
     const tracks = state['features/base/tracks'];
117 117
     let isVideoMuted = true;
118
+    let isAudioMuted = true;
118 119
 
119 120
     if (participant?.local) {
120 121
         isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
122
+        isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
121 123
     } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
122 124
         isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
125
+        isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);
123 126
     }
124 127
 
125 128
     return {
126 129
         _currentLayout: getCurrentLayout(state),
130
+        _showAudioMutedIndicator: isAudioMuted,
127 131
         _showModeratorIndicator:
128 132
             !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
129 133
         _showVideoMutedIndicator: isVideoMuted

+ 15
- 10
react/features/remote-video-menu/components/web/RemoteVideoMenuTriggerButton.js 파일 보기

@@ -3,9 +3,11 @@
3 3
 import React, { Component } from 'react';
4 4
 
5 5
 import { Icon, IconMenuThumb } from '../../../base/icons';
6
+import { MEDIA_TYPE } from '../../../base/media';
6 7
 import { getLocalParticipant, PARTICIPANT_ROLE } from '../../../base/participants';
7 8
 import { Popover } from '../../../base/popover';
8 9
 import { connect } from '../../../base/redux';
10
+import { isRemoteTrackMuted } from '../../../base/tracks';
9 11
 
10 12
 import {
11 13
     GrantModeratorButton,
@@ -37,6 +39,11 @@ type Props = {
37 39
      */
38 40
     _disableRemoteMute: Boolean,
39 41
 
42
+    /**
43
+     * Whether or not the participant is currently muted.
44
+     */
45
+    _isAudioMuted: boolean,
46
+
40 47
     /**
41 48
      * Whether or not the participant is a conference moderator.
42 49
      */
@@ -48,11 +55,6 @@ type Props = {
48 55
      */
49 56
     initialVolumeValue: number,
50 57
 
51
-    /**
52
-     * Whether or not the participant is currently muted.
53
-     */
54
-    isAudioMuted: boolean,
55
-
56 58
     /**
57 59
      * Callback to invoke when the popover has been displayed.
58 60
      */
@@ -170,9 +172,9 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
170 172
         const {
171 173
             _disableKick,
172 174
             _disableRemoteMute,
175
+            _isAudioMuted,
173 176
             _isModerator,
174 177
             initialVolumeValue,
175
-            isAudioMuted,
176 178
             onRemoteControlToggle,
177 179
             onVolumeChange,
178 180
             remoteControlState,
@@ -185,7 +187,7 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
185 187
             if (!_disableRemoteMute) {
186 188
                 buttons.push(
187 189
                     <MuteButton
188
-                        isAudioMuted = { isAudioMuted }
190
+                        isAudioMuted = { _isAudioMuted }
189 191
                         key = 'mute'
190 192
                         participantID = { participantID } />
191 193
                 );
@@ -258,13 +260,16 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
258 260
  *     _isModerator: boolean
259 261
  * }}
260 262
  */
261
-function _mapStateToProps(state) {
262
-    const participant = getLocalParticipant(state);
263
+function _mapStateToProps(state, ownProps) {
264
+    const { participantID } = ownProps;
265
+    const tracks = state['features/base/tracks'];
266
+    const localParticipant = getLocalParticipant(state);
263 267
     const { remoteVideoMenu = {}, disableRemoteMute } = state['features/base/config'];
264 268
     const { disableKick } = remoteVideoMenu;
265 269
 
266 270
     return {
267
-        _isModerator: Boolean(participant?.role === PARTICIPANT_ROLE.MODERATOR),
271
+        _isAudioMuted: isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID) || false,
272
+        _isModerator: Boolean(localParticipant?.role === PARTICIPANT_ROLE.MODERATOR),
268 273
         _disableKick: Boolean(disableKick),
269 274
         _disableRemoteMute: Boolean(disableRemoteMute)
270 275
     };

Loading…
취소
저장