Procházet zdrojové kódy

ref(StatusIndicators): Use audio muted from redux.

master
Hristo Terezov před 5 roky
rodič
revize
b71d92a139

+ 2
- 2
modules/UI/UI.js Zobrazit soubor

356
 /**
356
 /**
357
  * Sets muted audio state for participant
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
     if (APP.conference.isLocalId(id)) {
361
     if (APP.conference.isLocalId(id)) {
362
         APP.conference.updateAudioIconEnabled();
362
         APP.conference.updateAudioIconEnabled();
363
     }
363
     }

+ 1
- 7
modules/UI/videolayout/RemoteVideo.js Zobrazit soubor

198
                     <AtlasKitThemeProvider mode = 'dark'>
198
                     <AtlasKitThemeProvider mode = 'dark'>
199
                         <RemoteVideoMenuTriggerButton
199
                         <RemoteVideoMenuTriggerButton
200
                             initialVolumeValue = { initialVolumeValue }
200
                             initialVolumeValue = { initialVolumeValue }
201
-                            isAudioMuted = { this.isAudioMuted }
202
                             menuPosition = { remoteMenuPosition }
201
                             menuPosition = { remoteMenuPosition }
203
                             onMenuDisplay
202
                             onMenuDisplay
204
                                 = {this._onRemoteVideoMenuDisplay.bind(this)}
203
                                 = {this._onRemoteVideoMenuDisplay.bind(this)}
302
 
301
 
303
     /**
302
     /**
304
      * Updates the remote video menu.
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
         this._generatePopupContent();
306
         this._generatePopupContent();
313
     }
307
     }
314
 
308
 

+ 0
- 13
modules/UI/videolayout/SmallVideo.js Zobrazit soubor

85
      * Constructor.
85
      * Constructor.
86
      */
86
      */
87
     constructor(VideoLayout) {
87
     constructor(VideoLayout) {
88
-        this.isAudioMuted = false;
89
         this.isScreenSharing = false;
88
         this.isScreenSharing = false;
90
         this.videoStream = null;
89
         this.videoStream = null;
91
         this.audioStream = null;
90
         this.audioStream = null;
218
         this.updateIndicators();
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
      * Shows / hides the screen-share indicator over small videos.
221
      * Shows / hides the screen-share indicator over small videos.
234
      *
222
      *
262
             <Provider store = { APP.store }>
250
             <Provider store = { APP.store }>
263
                 <I18nextProvider i18n = { i18next }>
251
                 <I18nextProvider i18n = { i18next }>
264
                     <StatusIndicators
252
                     <StatusIndicators
265
-                        showAudioMutedIndicator = { this.isAudioMuted }
266
                         showScreenShareIndicator = { this.isScreenSharing }
253
                         showScreenShareIndicator = { this.isScreenSharing }
267
                         participantID = { this.id } />
254
                         participantID = { this.id } />
268
                 </I18nextProvider>
255
                 </I18nextProvider>

+ 1
- 21
modules/UI/videolayout/VideoLayout.js Zobrazit soubor

173
         remoteVideo.addRemoteStreamElement(stream);
173
         remoteVideo.addRemoteStreamElement(stream);
174
 
174
 
175
         // Make sure track's muted state is reflected
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
             this.onVideoMute(id);
177
             this.onVideoMute(id);
180
             remoteVideo.setScreenSharing(stream.videoType === 'desktop');
178
             remoteVideo.setScreenSharing(stream.videoType === 'desktop');
181
         }
179
         }
329
         this._updateLargeVideoIfDisplayed(resourceJid, true);
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
      * On video muted event.
331
      * On video muted event.
352
      */
332
      */

+ 11
- 7
react/features/filmstrip/components/web/StatusIndicators.js Zobrazit soubor

25
      */
25
      */
26
     _currentLayout: string,
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
      * Indicates if the moderator indicator should be visible or not.
34
      * Indicates if the moderator indicator should be visible or not.
30
      */
35
      */
35
      */
40
      */
36
     _showVideoMutedIndicator: Boolean,
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
      * Indicates if the screen share indicator should be visible or not.
44
      * Indicates if the screen share indicator should be visible or not.
45
      */
45
      */
66
     render() {
66
     render() {
67
         const {
67
         const {
68
             _currentLayout,
68
             _currentLayout,
69
+            _showAudioMutedIndicator,
69
             _showModeratorIndicator,
70
             _showModeratorIndicator,
70
-            showAudioMutedIndicator,
71
             showScreenShareIndicator,
71
             showScreenShareIndicator,
72
             _showVideoMutedIndicator
72
             _showVideoMutedIndicator
73
         } = this.props;
73
         } = this.props;
86
 
86
 
87
         return (
87
         return (
88
             <div>
88
             <div>
89
-                { showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
89
+                { _showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
90
                 { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
90
                 { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
91
                 { _showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
91
                 { _showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
92
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
92
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
115
 
115
 
116
     const tracks = state['features/base/tracks'];
116
     const tracks = state['features/base/tracks'];
117
     let isVideoMuted = true;
117
     let isVideoMuted = true;
118
+    let isAudioMuted = true;
118
 
119
 
119
     if (participant?.local) {
120
     if (participant?.local) {
120
         isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
121
         isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
122
+        isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
121
     } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
123
     } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
122
         isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
124
         isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
125
+        isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);
123
     }
126
     }
124
 
127
 
125
     return {
128
     return {
126
         _currentLayout: getCurrentLayout(state),
129
         _currentLayout: getCurrentLayout(state),
130
+        _showAudioMutedIndicator: isAudioMuted,
127
         _showModeratorIndicator:
131
         _showModeratorIndicator:
128
             !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
132
             !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
129
         _showVideoMutedIndicator: isVideoMuted
133
         _showVideoMutedIndicator: isVideoMuted

+ 15
- 10
react/features/remote-video-menu/components/web/RemoteVideoMenuTriggerButton.js Zobrazit soubor

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

Načítá se…
Zrušit
Uložit