Browse Source

ref(StatusIndicators): isScreenSharing -> redux.

master
Hristo Terezov 4 years ago
parent
commit
68a0bdce2c

+ 18
- 21
modules/UI/videolayout/SmallVideo.js View File

19
     getPinnedParticipant,
19
     getPinnedParticipant,
20
     pinParticipant
20
     pinParticipant
21
 } from '../../../react/features/base/participants';
21
 } from '../../../react/features/base/participants';
22
-import { isLocalTrackMuted, isRemoteTrackMuted } from '../../../react/features/base/tracks';
22
+import {
23
+    getTrackByMediaTypeAndParticipant,
24
+    isLocalTrackMuted,
25
+    isRemoteTrackMuted
26
+} from '../../../react/features/base/tracks';
23
 import { ConnectionIndicator } from '../../../react/features/connection-indicator';
27
 import { ConnectionIndicator } from '../../../react/features/connection-indicator';
24
 import { DisplayName } from '../../../react/features/display-name';
28
 import { DisplayName } from '../../../react/features/display-name';
25
 import {
29
 import {
85
      * Constructor.
89
      * Constructor.
86
      */
90
      */
87
     constructor(VideoLayout) {
91
     constructor(VideoLayout) {
88
-        this.isScreenSharing = false;
89
         this.videoStream = null;
92
         this.videoStream = null;
90
         this.audioStream = null;
93
         this.audioStream = null;
91
         this.VideoLayout = VideoLayout;
94
         this.VideoLayout = VideoLayout;
217
         this.updateIndicators();
220
         this.updateIndicators();
218
     }
221
     }
219
 
222
 
220
-    /**
221
-     * Shows / hides the screen-share indicator over small videos.
222
-     *
223
-     * @param {boolean} isScreenSharing indicates if the screen-share element should be shown
224
-     * or hidden
225
-     */
226
-    setScreenSharing(isScreenSharing) {
227
-        if (isScreenSharing === this.isScreenSharing) {
228
-            return;
229
-        }
230
-
231
-        this.isScreenSharing = isScreenSharing;
232
-        this.updateView();
233
-        this.updateStatusBar();
234
-    }
235
-
236
     /**
223
     /**
237
      * Create or updates the ReactElement for displaying status indicators about
224
      * Create or updates the ReactElement for displaying status indicators about
238
      * audio mute, video mute, and moderator status.
225
      * audio mute, video mute, and moderator status.
250
             <Provider store = { APP.store }>
237
             <Provider store = { APP.store }>
251
                 <I18nextProvider i18n = { i18next }>
238
                 <I18nextProvider i18n = { i18next }>
252
                     <StatusIndicators
239
                     <StatusIndicators
253
-                        showScreenShareIndicator = { this.isScreenSharing }
254
                         participantID = { this.id } />
240
                         participantID = { this.id } />
255
                 </I18nextProvider>
241
                 </I18nextProvider>
256
             </Provider>,
242
             </Provider>,
466
      * @returns {Object}
452
      * @returns {Object}
467
      */
453
      */
468
     computeDisplayModeInput() {
454
     computeDisplayModeInput() {
455
+        let isScreenSharing = false;
456
+        const state = APP.store.getState();
457
+        const participant = getParticipantById(state, this.id);
458
+
459
+        if (typeof participant !== 'undefined' && !participant.isFakeParticipant && !participant.local) {
460
+            const tracks = state['features/base/tracks'];
461
+            const track = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, this.id);
462
+
463
+            isScreenSharing = typeof track !== 'undefined' && track.videoType === 'desktop';
464
+        }
465
+
469
         return {
466
         return {
470
             isCurrentlyOnLargeVideo: this.isCurrentlyOnLargeVideo(),
467
             isCurrentlyOnLargeVideo: this.isCurrentlyOnLargeVideo(),
471
             isHovered: this._isHovered(),
468
             isHovered: this._isHovered(),
472
             isAudioOnly: APP.conference.isAudioOnly(),
469
             isAudioOnly: APP.conference.isAudioOnly(),
473
-            tileViewActive: shouldDisplayTileView(APP.store.getState()),
470
+            tileViewActive: shouldDisplayTileView(state),
474
             isVideoPlayable: this.isVideoPlayable(),
471
             isVideoPlayable: this.isVideoPlayable(),
475
             hasVideo: Boolean(this.selectVideoElement().length),
472
             hasVideo: Boolean(this.selectVideoElement().length),
476
             connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
473
             connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
477
             mutedWhileDisconnected: this.mutedWhileDisconnected,
474
             mutedWhileDisconnected: this.mutedWhileDisconnected,
478
             canPlayEventReceived: this._canPlayEventReceived,
475
             canPlayEventReceived: this._canPlayEventReceived,
479
             videoStream: Boolean(this.videoStream),
476
             videoStream: Boolean(this.videoStream),
480
-            isScreenSharing: this.isScreenSharing,
477
+            isScreenSharing,
481
             videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
478
             videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
482
         };
479
         };
483
     }
480
     }

+ 3
- 3
modules/UI/videolayout/VideoLayout.js View File

175
         // Make sure track's muted state is reflected
175
         // Make sure track's muted state is reflected
176
         if (stream.getType() !== 'audio') {
176
         if (stream.getType() !== 'audio') {
177
             this.onVideoMute(id);
177
             this.onVideoMute(id);
178
-            remoteVideo.setScreenSharing(stream.videoType === 'desktop');
178
+            remoteVideo.updateView();
179
         }
179
         }
180
     },
180
     },
181
 
181
 
187
 
187
 
188
         if (remoteVideo) {
188
         if (remoteVideo) {
189
             remoteVideo.removeRemoteStreamElement(stream);
189
             remoteVideo.removeRemoteStreamElement(stream);
190
-            remoteVideo.setScreenSharing(false);
190
+            remoteVideo.updateView();
191
         }
191
         }
192
 
192
 
193
         this.updateMutedForNoTracks(id, stream.getType());
193
         this.updateMutedForNoTracks(id, stream.getType());
474
         }
474
         }
475
 
475
 
476
         logger.info('Peer video type changed: ', id, newVideoType);
476
         logger.info('Peer video type changed: ', id, newVideoType);
477
-        remoteVideo.setScreenSharing(newVideoType === 'desktop');
477
+        remoteVideo.updateView();
478
     },
478
     },
479
 
479
 
480
     /**
480
     /**

+ 12
- 7
react/features/filmstrip/components/web/StatusIndicators.js View File

5
 import { MEDIA_TYPE } from '../../../base/media';
5
 import { MEDIA_TYPE } from '../../../base/media';
6
 import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../../../base/participants';
6
 import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../../../base/participants';
7
 import { connect } from '../../../base/redux';
7
 import { connect } from '../../../base/redux';
8
-import { isLocalTrackMuted, isRemoteTrackMuted } from '../../../base/tracks';
8
+import { getTrackByMediaTypeAndParticipant, isLocalTrackMuted, isRemoteTrackMuted } from '../../../base/tracks';
9
 import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
9
 import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
10
 
10
 
11
 import AudioMutedIndicator from './AudioMutedIndicator';
11
 import AudioMutedIndicator from './AudioMutedIndicator';
36
     _showModeratorIndicator: Boolean,
36
     _showModeratorIndicator: Boolean,
37
 
37
 
38
     /**
38
     /**
39
-     * Indicates if the video muted indicator should be visible or not.
39
+     * Indicates if the screen share indicator should be visible or not.
40
      */
40
      */
41
-    _showVideoMutedIndicator: Boolean,
41
+    _showScreenShareIndicator: Boolean,
42
 
42
 
43
     /**
43
     /**
44
-     * Indicates if the screen share indicator should be visible or not.
44
+     * Indicates if the video muted indicator should be visible or not.
45
      */
45
      */
46
-    showScreenShareIndicator: Boolean,
46
+    _showVideoMutedIndicator: Boolean,
47
 
47
 
48
     /**
48
     /**
49
      * 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.
68
             _currentLayout,
68
             _currentLayout,
69
             _showAudioMutedIndicator,
69
             _showAudioMutedIndicator,
70
             _showModeratorIndicator,
70
             _showModeratorIndicator,
71
-            showScreenShareIndicator,
71
+            _showScreenShareIndicator,
72
             _showVideoMutedIndicator
72
             _showVideoMutedIndicator
73
         } = this.props;
73
         } = this.props;
74
         let tooltipPosition;
74
         let tooltipPosition;
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 }
93
             </div>
93
             </div>
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
     let isAudioMuted = true;
119
+    let isScreenSharing = false;
119
 
120
 
120
     if (participant?.local) {
121
     if (participant?.local) {
121
         isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
122
         isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
122
         isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
123
         isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
123
     } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
124
     } else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
125
+        const track = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantID);
126
+
127
+        isScreenSharing = typeof track !== 'undefined' && track.videoType === 'desktop';
124
         isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
128
         isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
125
         isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);
129
         isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);
126
     }
130
     }
130
         _showAudioMutedIndicator: isAudioMuted,
134
         _showAudioMutedIndicator: isAudioMuted,
131
         _showModeratorIndicator:
135
         _showModeratorIndicator:
132
             !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
136
             !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
137
+        _showScreenShareIndicator: isScreenSharing,
133
         _showVideoMutedIndicator: isVideoMuted
138
         _showVideoMutedIndicator: isVideoMuted
134
     };
139
     };
135
 }
140
 }

Loading…
Cancel
Save