Selaa lähdekoodia

ref(StatusIndicators): Use video muted from redux.

master
Hristo Terezov 5 vuotta sitten
vanhempi
commit
ca2343c31a

+ 1
- 1
conference.js Näytä tiedosto

3039
      * @param {boolean} muted - New muted status.
3039
      * @param {boolean} muted - New muted status.
3040
      */
3040
      */
3041
     setVideoMuteStatus(muted) {
3041
     setVideoMuteStatus(muted) {
3042
-        APP.UI.setVideoMuted(this.getMyUserId(), muted);
3042
+        APP.UI.setVideoMuted(this.getMyUserId());
3043
         APP.API.notifyVideoMutedStatusChanged(muted);
3043
         APP.API.notifyVideoMutedStatusChanged(muted);
3044
     },
3044
     },
3045
 
3045
 

+ 2
- 2
modules/UI/UI.js Näytä tiedosto

366
 /**
366
 /**
367
  * Sets muted video state for participant
367
  * Sets muted video state for participant
368
  */
368
  */
369
-UI.setVideoMuted = function(id, muted) {
370
-    VideoLayout.onVideoMute(id, muted);
369
+UI.setVideoMuted = function(id) {
370
+    VideoLayout.onVideoMute(id);
371
     if (APP.conference.isLocalId(id)) {
371
     if (APP.conference.isLocalId(id)) {
372
         APP.conference.updateVideoIconEnabled();
372
         APP.conference.updateVideoIconEnabled();
373
     }
373
     }

+ 0
- 1
modules/UI/shared_video/SharedVideoThumb.js Näytä tiedosto

26
         this.$container = $(this.container);
26
         this.$container = $(this.container);
27
         this._setThumbnailSize();
27
         this._setThumbnailSize();
28
         this.bindHoverHandler();
28
         this.bindHoverHandler();
29
-        this.isVideoMuted = true;
30
         this.updateDisplayName();
29
         this.updateDisplayName();
31
         this.container.onclick = this._onContainerClick;
30
         this.container.onclick = this._onContainerClick;
32
     }
31
     }

+ 1
- 0
modules/UI/videolayout/LocalVideo.js Näytä tiedosto

63
 
63
 
64
         this.addAudioLevelIndicator();
64
         this.addAudioLevelIndicator();
65
         this.updateIndicators();
65
         this.updateIndicators();
66
+        this.updateStatusBar();
66
 
67
 
67
         this.container.onclick = this._onContainerClick;
68
         this.container.onclick = this._onContainerClick;
68
     }
69
     }

+ 10
- 6
modules/UI/videolayout/RemoteVideo.js Näytä tiedosto

12
 import {
12
 import {
13
     JitsiParticipantConnectionStatus
13
     JitsiParticipantConnectionStatus
14
 } from '../../../react/features/base/lib-jitsi-meet';
14
 } from '../../../react/features/base/lib-jitsi-meet';
15
+import { MEDIA_TYPE } from '../../../react/features/base/media';
15
 import {
16
 import {
17
+    getParticipantById,
16
     getPinnedParticipant,
18
     getPinnedParticipant,
17
     pinParticipant
19
     pinParticipant
18
 } from '../../../react/features/base/participants';
20
 } from '../../../react/features/base/participants';
21
+import { isRemoteTrackMuted } from '../../../react/features/base/tracks';
19
 import { PresenceLabel } from '../../../react/features/presence-status';
22
 import { PresenceLabel } from '../../../react/features/presence-status';
20
 import {
23
 import {
21
     REMOTE_CONTROL_MENU_STATES,
24
     REMOTE_CONTROL_MENU_STATES,
310
     }
313
     }
311
 
314
 
312
     /**
315
     /**
313
-     * @inheritDoc
314
-     * @override
316
+     * Video muted status changed handler.
315
      */
317
      */
316
-    setVideoMutedView(isMuted) {
317
-        super.setVideoMutedView(isMuted);
318
+    onVideoMute() {
319
+        super.updateView();
318
 
320
 
319
         // Update 'mutedWhileDisconnected' flag
321
         // Update 'mutedWhileDisconnected' flag
320
         this._figureOutMutedWhileDisconnected();
322
         this._figureOutMutedWhileDisconnected();
328
      */
330
      */
329
     _figureOutMutedWhileDisconnected() {
331
     _figureOutMutedWhileDisconnected() {
330
         const isActive = this.isConnectionActive();
332
         const isActive = this.isConnectionActive();
333
+        const isVideoMuted
334
+            = isRemoteTrackMuted(APP.store.getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, this.id);
331
 
335
 
332
-        if (!isActive && this.isVideoMuted) {
336
+        if (!isActive && isVideoMuted) {
333
             this.mutedWhileDisconnected = true;
337
             this.mutedWhileDisconnected = true;
334
-        } else if (isActive && !this.isVideoMuted) {
338
+        } else if (isActive && !isVideoMuted) {
335
             this.mutedWhileDisconnected = false;
339
             this.mutedWhileDisconnected = false;
336
         }
340
         }
337
     }
341
     }

+ 16
- 17
modules/UI/videolayout/SmallVideo.js Näytä tiedosto

11
 import { AudioLevelIndicator } from '../../../react/features/audio-level-indicator';
11
 import { AudioLevelIndicator } from '../../../react/features/audio-level-indicator';
12
 import { Avatar as AvatarDisplay } from '../../../react/features/base/avatar';
12
 import { Avatar as AvatarDisplay } from '../../../react/features/base/avatar';
13
 import { i18next } from '../../../react/features/base/i18n';
13
 import { i18next } from '../../../react/features/base/i18n';
14
+import { MEDIA_TYPE } from '../../../react/features/base/media';
14
 import {
15
 import {
16
+    getLocalParticipant,
17
+    getParticipantById,
15
     getParticipantCount,
18
     getParticipantCount,
16
     getPinnedParticipant,
19
     getPinnedParticipant,
17
     pinParticipant
20
     pinParticipant
18
 } from '../../../react/features/base/participants';
21
 } from '../../../react/features/base/participants';
22
+import { isLocalTrackMuted, isRemoteTrackMuted } from '../../../react/features/base/tracks';
19
 import { ConnectionIndicator } from '../../../react/features/connection-indicator';
23
 import { ConnectionIndicator } from '../../../react/features/connection-indicator';
20
 import { DisplayName } from '../../../react/features/display-name';
24
 import { DisplayName } from '../../../react/features/display-name';
21
 import {
25
 import {
82
      */
86
      */
83
     constructor(VideoLayout) {
87
     constructor(VideoLayout) {
84
         this.isAudioMuted = false;
88
         this.isAudioMuted = false;
85
-        this.isVideoMuted = false;
86
         this.isScreenSharing = false;
89
         this.isScreenSharing = false;
87
         this.videoStream = null;
90
         this.videoStream = null;
88
         this.audioStream = null;
91
         this.audioStream = null;
242
         this.updateStatusBar();
245
         this.updateStatusBar();
243
     }
246
     }
244
 
247
 
245
-    /**
246
-     * Shows video muted indicator over small videos and disables/enables avatar
247
-     * if video muted.
248
-     *
249
-     * @param {boolean} isMuted indicates if we should set the view to muted view
250
-     * or not
251
-     */
252
-    setVideoMutedView(isMuted) {
253
-        this.isVideoMuted = isMuted;
254
-        this.updateView();
255
-        this.updateStatusBar();
256
-    }
257
-
258
     /**
248
     /**
259
      * Create or updates the ReactElement for displaying status indicators about
249
      * Create or updates the ReactElement for displaying status indicators about
260
      * audio mute, video mute, and moderator status.
250
      * audio mute, video mute, and moderator status.
274
                     <StatusIndicators
264
                     <StatusIndicators
275
                         showAudioMutedIndicator = { this.isAudioMuted }
265
                         showAudioMutedIndicator = { this.isAudioMuted }
276
                         showScreenShareIndicator = { this.isScreenSharing }
266
                         showScreenShareIndicator = { this.isScreenSharing }
277
-                        showVideoMutedIndicator = { this.isVideoMuted }
278
                         participantID = { this.id } />
267
                         participantID = { this.id } />
279
                 </I18nextProvider>
268
                 </I18nextProvider>
280
             </Provider>,
269
             </Provider>,
449
      * or <tt>false</tt> otherwise.
438
      * or <tt>false</tt> otherwise.
450
      */
439
      */
451
     isVideoPlayable() {
440
     isVideoPlayable() {
452
-        return this.videoStream && !this.isVideoMuted && !APP.conference.isAudioOnly();
441
+        const state = APP.store.getState();
442
+        const tracks = state['features/base/tracks'];
443
+        const participant = this.id ? getParticipantById(state, this.id) : getLocalParticipant(state);
444
+        let isVideoMuted = true;
445
+
446
+        if (participant?.local) {
447
+            isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
448
+        } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
449
+            isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, this.id);
450
+        }
451
+
452
+        return this.videoStream && !isVideoMuted && !APP.conference.isAudioOnly();
453
     }
453
     }
454
 
454
 
455
     /**
455
     /**
490
             mutedWhileDisconnected: this.mutedWhileDisconnected,
490
             mutedWhileDisconnected: this.mutedWhileDisconnected,
491
             canPlayEventReceived: this._canPlayEventReceived,
491
             canPlayEventReceived: this._canPlayEventReceived,
492
             videoStream: Boolean(this.videoStream),
492
             videoStream: Boolean(this.videoStream),
493
-            isVideoMuted: this.isVideoMuted,
494
             isScreenSharing: this.isScreenSharing,
493
             isScreenSharing: this.isScreenSharing,
495
             videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
494
             videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
496
         };
495
         };

+ 5
- 5
modules/UI/videolayout/VideoLayout.js Näytä tiedosto

176
         if (stream.getType() === 'audio') {
176
         if (stream.getType() === 'audio') {
177
             this.onAudioMute(id, stream.isMuted());
177
             this.onAudioMute(id, stream.isMuted());
178
         } else {
178
         } else {
179
-            this.onVideoMute(id, stream.isMuted());
179
+            this.onVideoMute(id);
180
             remoteVideo.setScreenSharing(stream.videoType === 'desktop');
180
             remoteVideo.setScreenSharing(stream.videoType === 'desktop');
181
         }
181
         }
182
     },
182
     },
210
             if (mediaType === 'audio') {
210
             if (mediaType === 'audio') {
211
                 APP.UI.setAudioMuted(participantId, true);
211
                 APP.UI.setAudioMuted(participantId, true);
212
             } else if (mediaType === 'video') {
212
             } else if (mediaType === 'video') {
213
-                APP.UI.setVideoMuted(participantId, true);
213
+                APP.UI.setVideoMuted(participantId);
214
             } else {
214
             } else {
215
                 logger.error(`Unsupported media type: ${mediaType}`);
215
                 logger.error(`Unsupported media type: ${mediaType}`);
216
             }
216
             }
350
     /**
350
     /**
351
      * On video muted event.
351
      * On video muted event.
352
      */
352
      */
353
-    onVideoMute(id, value) {
353
+    onVideoMute(id) {
354
         if (APP.conference.isLocalId(id)) {
354
         if (APP.conference.isLocalId(id)) {
355
-            localVideoThumbnail && localVideoThumbnail.setVideoMutedView(value);
355
+            localVideoThumbnail && localVideoThumbnail.updateView();
356
         } else {
356
         } else {
357
             const remoteVideo = remoteVideos[id];
357
             const remoteVideo = remoteVideos[id];
358
 
358
 
359
             if (remoteVideo) {
359
             if (remoteVideo) {
360
-                remoteVideo.setVideoMutedView(value);
360
+                remoteVideo.onVideoMute();
361
             }
361
             }
362
         }
362
         }
363
 
363
 

+ 1
- 1
react/features/base/tracks/middleware.js Näytä tiedosto

159
                 } else if (jitsiTrack.isLocal()) {
159
                 } else if (jitsiTrack.isLocal()) {
160
                     APP.conference.setVideoMuteStatus(muted);
160
                     APP.conference.setVideoMuteStatus(muted);
161
                 } else {
161
                 } else {
162
-                    APP.UI.setVideoMuted(participantID, muted);
162
+                    APP.UI.setVideoMuted(participantID);
163
                 }
163
                 }
164
                 APP.UI.onPeerVideoTypeChanged(participantID, jitsiTrack.videoType);
164
                 APP.UI.onPeerVideoTypeChanged(participantID, jitsiTrack.videoType);
165
             } else if (jitsiTrack.isLocal()) {
165
             } else if (jitsiTrack.isLocal()) {

+ 22
- 9
react/features/filmstrip/components/web/StatusIndicators.js Näytä tiedosto

2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
 
4
 
5
+import { MEDIA_TYPE } from '../../../base/media';
5
 import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../../../base/participants';
6
 import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../../../base/participants';
6
 import { connect } from '../../../base/redux';
7
 import { connect } from '../../../base/redux';
8
+import { isLocalTrackMuted, isRemoteTrackMuted } from '../../../base/tracks';
7
 import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
9
 import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
8
 
10
 
9
 import AudioMutedIndicator from './AudioMutedIndicator';
11
 import AudioMutedIndicator from './AudioMutedIndicator';
28
      */
30
      */
29
     _showModeratorIndicator: Boolean,
31
     _showModeratorIndicator: Boolean,
30
 
32
 
33
+    /**
34
+     * Indicates if the video muted indicator should be visible or not.
35
+     */
36
+    _showVideoMutedIndicator: Boolean,
37
+
31
     /**
38
     /**
32
      * Indicates if the audio muted indicator should be visible or not.
39
      * Indicates if the audio muted indicator should be visible or not.
33
      */
40
      */
38
      */
45
      */
39
     showScreenShareIndicator: Boolean,
46
     showScreenShareIndicator: Boolean,
40
 
47
 
41
-    /**
42
-     * Indicates if the video muted indicator should be visible or not.
43
-     */
44
-    showVideoMutedIndicator: Boolean,
45
-
46
     /**
48
     /**
47
      * The ID of the participant for which the status bar is rendered.
49
      * The ID of the participant for which the status bar is rendered.
48
      */
50
      */
67
             _showModeratorIndicator,
69
             _showModeratorIndicator,
68
             showAudioMutedIndicator,
70
             showAudioMutedIndicator,
69
             showScreenShareIndicator,
71
             showScreenShareIndicator,
70
-            showVideoMutedIndicator
72
+            _showVideoMutedIndicator
71
         } = this.props;
73
         } = this.props;
72
         let tooltipPosition;
74
         let tooltipPosition;
73
 
75
 
86
             <div>
88
             <div>
87
                 { showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
89
                 { showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
88
                 { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
90
                 { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
89
-                { showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
91
+                { _showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
90
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
92
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
91
             </div>
93
             </div>
92
         );
94
         );
101
  * @private
103
  * @private
102
  * @returns {{
104
  * @returns {{
103
  *     _currentLayout: string,
105
  *     _currentLayout: string,
104
- *     _showModeratorIndicator: boolean
106
+ *     _showModeratorIndicator: boolean,
107
+ *     _showVideoMutedIndicator: boolean
105
  * }}
108
  * }}
106
 */
109
 */
107
 function _mapStateToProps(state, ownProps) {
110
 function _mapStateToProps(state, ownProps) {
110
     // Only the local participant won't have id for the time when the conference is not yet joined.
113
     // Only the local participant won't have id for the time when the conference is not yet joined.
111
     const participant = participantID ? getParticipantById(state, participantID) : getLocalParticipant(state);
114
     const participant = participantID ? getParticipantById(state, participantID) : getLocalParticipant(state);
112
 
115
 
116
+    const tracks = state['features/base/tracks'];
117
+    let isVideoMuted = true;
118
+
119
+    if (participant?.local) {
120
+        isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
121
+    } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
122
+        isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
123
+    }
124
+
113
     return {
125
     return {
114
         _currentLayout: getCurrentLayout(state),
126
         _currentLayout: getCurrentLayout(state),
115
         _showModeratorIndicator:
127
         _showModeratorIndicator:
116
-            !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR
128
+            !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
129
+        _showVideoMutedIndicator: isVideoMuted
117
     };
130
     };
118
 }
131
 }
119
 
132
 

Loading…
Peruuta
Tallenna