浏览代码

web,small-video: introduce screen-sharing indicator

master
Saúl Ibarra Corretgé 4 年前
父节点
当前提交
fdffb688c1

+ 13
- 0
modules/UI/videolayout/SmallVideo.js 查看文件

@@ -83,6 +83,7 @@ export default class SmallVideo {
83 83
     constructor(VideoLayout) {
84 84
         this.isAudioMuted = false;
85 85
         this.isVideoMuted = false;
86
+        this.isScreenSharing = false;
86 87
         this.videoStream = null;
87 88
         this.audioStream = null;
88 89
         this.VideoLayout = VideoLayout;
@@ -234,6 +235,17 @@ export default class SmallVideo {
234 235
         this.updateStatusBar();
235 236
     }
236 237
 
238
+    /**
239
+     * Shows / hides the screen-share indicator over small videos.
240
+     *
241
+     * @param {boolean} isScreenSharing indicates if the screen-share element should be shown
242
+     * or hidden
243
+     */
244
+    setScreenSharing(isScreenSharing) {
245
+        this.isScreenSharing = isScreenSharing;
246
+        this.updateStatusBar();
247
+    }
248
+
237 249
     /**
238 250
      * Shows video muted indicator over small videos and disables/enables avatar
239 251
      * if video muted.
@@ -265,6 +277,7 @@ export default class SmallVideo {
265 277
                 <I18nextProvider i18n = { i18next }>
266 278
                     <StatusIndicators
267 279
                         showAudioMutedIndicator = { this.isAudioMuted }
280
+                        showScreenShareIndicator = { this.isScreenSharing }
268 281
                         showVideoMutedIndicator = { this.isVideoMuted }
269 282
                         participantID = { this.id } />
270 283
                 </I18nextProvider>

+ 8
- 0
modules/UI/videolayout/VideoLayout.js 查看文件

@@ -177,6 +177,10 @@ const VideoLayout = {
177 177
             this.onAudioMute(id, stream.isMuted());
178 178
         } else {
179 179
             this.onVideoMute(id, stream.isMuted());
180
+
181
+            if (stream.videoType === 'desktop') {
182
+                remoteVideo.setScreenSharing(true);
183
+            }
180 184
         }
181 185
     },
182 186
 
@@ -188,6 +192,10 @@ const VideoLayout = {
188 192
 
189 193
         if (remoteVideo) {
190 194
             remoteVideo.removeRemoteStreamElement(stream);
195
+
196
+            if (stream.videoType === 'desktop') {
197
+                remoteVideo.setScreenSharing(false);
198
+            }
191 199
         }
192 200
 
193 201
         this.updateMutedForNoTracks(id, stream.getType());

+ 33
- 0
react/features/filmstrip/components/web/ScreenShareIndicator.js 查看文件

@@ -0,0 +1,33 @@
1
+// @flow
2
+
3
+import React from 'react';
4
+
5
+import { IconShareDesktop } from '../../../base/icons';
6
+import { BaseIndicator } from '../../../base/react';
7
+
8
+
9
+type Props = {
10
+
11
+    /**
12
+     * From which side of the indicator the tooltip should appear from.
13
+     */
14
+    tooltipPosition: string
15
+};
16
+
17
+/**
18
+ * React {@code Component} for showing a screen-sharing icon with a tooltip.
19
+ *
20
+ * @param {Props} props - React props passed to this component.
21
+ * @returns {React$Element<any>}
22
+ */
23
+export default function ScreenShareIndicator(props: Props) {
24
+    return (
25
+        <BaseIndicator
26
+            className = 'screenShare toolbar-icon'
27
+            icon = { IconShareDesktop }
28
+            iconId = 'share-desktop'
29
+            iconSize = { 13 }
30
+            tooltipKey = 'videothumbnail.videomute'
31
+            tooltipPosition = { props.tooltipPosition } />
32
+    );
33
+}

+ 8
- 0
react/features/filmstrip/components/web/StatusIndicators.js 查看文件

@@ -8,6 +8,7 @@ import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
8 8
 
9 9
 import AudioMutedIndicator from './AudioMutedIndicator';
10 10
 import ModeratorIndicator from './ModeratorIndicator';
11
+import ScreenShareIndicator from './ScreenShareIndicator';
11 12
 import VideoMutedIndicator from './VideoMutedIndicator';
12 13
 
13 14
 declare var interfaceConfig: Object;
@@ -32,6 +33,11 @@ type Props = {
32 33
      */
33 34
     showAudioMutedIndicator: Boolean,
34 35
 
36
+    /**
37
+     * Indicates if the screen share indicator should be visible or not.
38
+     */
39
+    showScreenShareIndicator: Boolean,
40
+
35 41
     /**
36 42
      * Indicates if the video muted indicator should be visible or not.
37 43
      */
@@ -60,6 +66,7 @@ class StatusIndicators extends Component<Props> {
60 66
             _currentLayout,
61 67
             _showModeratorIndicator,
62 68
             showAudioMutedIndicator,
69
+            showScreenShareIndicator,
63 70
             showVideoMutedIndicator
64 71
         } = this.props;
65 72
         let tooltipPosition;
@@ -78,6 +85,7 @@ class StatusIndicators extends Component<Props> {
78 85
         return (
79 86
             <div>
80 87
                 { showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
88
+                { showScreenShareIndicator ? <ScreenShareIndicator tooltipPosition = { tooltipPosition } /> : null }
81 89
                 { showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
82 90
                 { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
83 91
             </div>

正在加载...
取消
保存