Quellcode durchsuchen

ref(StatusIndicators): isScreenSharing -> redux.

j8
Hristo Terezov vor 4 Jahren
Ursprung
Commit
68a0bdce2c

+ 18
- 21
modules/UI/videolayout/SmallVideo.js Datei anzeigen

@@ -19,7 +19,11 @@ import {
19 19
     getPinnedParticipant,
20 20
     pinParticipant
21 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 27
 import { ConnectionIndicator } from '../../../react/features/connection-indicator';
24 28
 import { DisplayName } from '../../../react/features/display-name';
25 29
 import {
@@ -85,7 +89,6 @@ export default class SmallVideo {
85 89
      * Constructor.
86 90
      */
87 91
     constructor(VideoLayout) {
88
-        this.isScreenSharing = false;
89 92
         this.videoStream = null;
90 93
         this.audioStream = null;
91 94
         this.VideoLayout = VideoLayout;
@@ -217,22 +220,6 @@ export default class SmallVideo {
217 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 224
      * Create or updates the ReactElement for displaying status indicators about
238 225
      * audio mute, video mute, and moderator status.
@@ -250,7 +237,6 @@ export default class SmallVideo {
250 237
             <Provider store = { APP.store }>
251 238
                 <I18nextProvider i18n = { i18next }>
252 239
                     <StatusIndicators
253
-                        showScreenShareIndicator = { this.isScreenSharing }
254 240
                         participantID = { this.id } />
255 241
                 </I18nextProvider>
256 242
             </Provider>,
@@ -466,18 +452,29 @@ export default class SmallVideo {
466 452
      * @returns {Object}
467 453
      */
468 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 466
         return {
470 467
             isCurrentlyOnLargeVideo: this.isCurrentlyOnLargeVideo(),
471 468
             isHovered: this._isHovered(),
472 469
             isAudioOnly: APP.conference.isAudioOnly(),
473
-            tileViewActive: shouldDisplayTileView(APP.store.getState()),
470
+            tileViewActive: shouldDisplayTileView(state),
474 471
             isVideoPlayable: this.isVideoPlayable(),
475 472
             hasVideo: Boolean(this.selectVideoElement().length),
476 473
             connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
477 474
             mutedWhileDisconnected: this.mutedWhileDisconnected,
478 475
             canPlayEventReceived: this._canPlayEventReceived,
479 476
             videoStream: Boolean(this.videoStream),
480
-            isScreenSharing: this.isScreenSharing,
477
+            isScreenSharing,
481 478
             videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
482 479
         };
483 480
     }

+ 3
- 3
modules/UI/videolayout/VideoLayout.js Datei anzeigen

@@ -175,7 +175,7 @@ const VideoLayout = {
175 175
         // Make sure track's muted state is reflected
176 176
         if (stream.getType() !== 'audio') {
177 177
             this.onVideoMute(id);
178
-            remoteVideo.setScreenSharing(stream.videoType === 'desktop');
178
+            remoteVideo.updateView();
179 179
         }
180 180
     },
181 181
 
@@ -187,7 +187,7 @@ const VideoLayout = {
187 187
 
188 188
         if (remoteVideo) {
189 189
             remoteVideo.removeRemoteStreamElement(stream);
190
-            remoteVideo.setScreenSharing(false);
190
+            remoteVideo.updateView();
191 191
         }
192 192
 
193 193
         this.updateMutedForNoTracks(id, stream.getType());
@@ -474,7 +474,7 @@ const VideoLayout = {
474 474
         }
475 475
 
476 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 Datei anzeigen

@@ -5,7 +5,7 @@ import React, { Component } from 'react';
5 5
 import { MEDIA_TYPE } from '../../../base/media';
6 6
 import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../../../base/participants';
7 7
 import { connect } from '../../../base/redux';
8
-import { isLocalTrackMuted, isRemoteTrackMuted } from '../../../base/tracks';
8
+import { getTrackByMediaTypeAndParticipant, isLocalTrackMuted, isRemoteTrackMuted } from '../../../base/tracks';
9 9
 import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
10 10
 
11 11
 import AudioMutedIndicator from './AudioMutedIndicator';
@@ -36,14 +36,14 @@ type Props = {
36 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 49
      * The ID of the participant for which the status bar is rendered.
@@ -68,7 +68,7 @@ class StatusIndicators extends Component<Props> {
68 68
             _currentLayout,
69 69
             _showAudioMutedIndicator,
70 70
             _showModeratorIndicator,
71
-            showScreenShareIndicator,
71
+            _showScreenShareIndicator,
72 72
             _showVideoMutedIndicator
73 73
         } = this.props;
74 74
         let tooltipPosition;
@@ -87,7 +87,7 @@ class StatusIndicators extends Component<Props> {
87 87
         return (
88 88
             <div>
89 89
                 { _showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
90
-                { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
90
+                { _showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
91 91
                 { _showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
92 92
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
93 93
             </div>
@@ -116,11 +116,15 @@ function _mapStateToProps(state, ownProps) {
116 116
     const tracks = state['features/base/tracks'];
117 117
     let isVideoMuted = true;
118 118
     let isAudioMuted = true;
119
+    let isScreenSharing = false;
119 120
 
120 121
     if (participant?.local) {
121 122
         isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
122 123
         isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
123 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 128
         isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, participantID);
125 129
         isAudioMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.AUDIO, participantID);
126 130
     }
@@ -130,6 +134,7 @@ function _mapStateToProps(state, ownProps) {
130 134
         _showAudioMutedIndicator: isAudioMuted,
131 135
         _showModeratorIndicator:
132 136
             !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR,
137
+        _showScreenShareIndicator: isScreenSharing,
133 138
         _showVideoMutedIndicator: isVideoMuted
134 139
     };
135 140
 }

Laden…
Abbrechen
Speichern