瀏覽代碼

ref(video-layout): add thumbnails on participant join action

master
Leonard Kim 7 年之前
父節點
當前提交
91323ebfec

+ 0
- 3
modules/UI/UI.js 查看文件

492
         APP.store.dispatch(showParticipantJoinedNotification(displayName));
492
         APP.store.dispatch(showParticipantJoinedNotification(displayName));
493
     }
493
     }
494
 
494
 
495
-    // Add Peer's container
496
-    VideoLayout.addParticipantContainer(user);
497
-
498
     // Configure avatar
495
     // Configure avatar
499
     UI.setUserEmail(id);
496
     UI.setUserEmail(id);
500
 
497
 

+ 3
- 11
modules/UI/shared_video/SharedVideo.js 查看文件

16
 } from '../../../react/features/analytics';
16
 } from '../../../react/features/analytics';
17
 import {
17
 import {
18
     participantJoined,
18
     participantJoined,
19
-    participantLeft
19
+    participantLeft,
20
+    pinParticipant
20
 } from '../../../react/features/base/participants';
21
 } from '../../../react/features/base/participants';
21
 import {
22
 import {
22
     dockToolbox,
23
     dockToolbox,
24
     showToolbox
25
     showToolbox
25
 } from '../../../react/features/toolbox';
26
 } from '../../../react/features/toolbox';
26
 
27
 
27
-import SharedVideoThumb from './SharedVideoThumb';
28
-
29
 export const SHARED_VIDEO_CONTAINER_TYPE = 'sharedvideo';
28
 export const SHARED_VIDEO_CONTAINER_TYPE = 'sharedvideo';
30
 
29
 
31
 /**
30
 /**
281
 
280
 
282
             player.playVideo();
281
             player.playVideo();
283
 
282
 
284
-            const thumb = new SharedVideoThumb(
285
-                self.url, SHARED_VIDEO_CONTAINER_TYPE, VideoLayout);
286
-
287
-            thumb.setDisplayName('YouTube');
288
-            VideoLayout.addRemoteVideoContainer(self.url, thumb);
289
-            VideoLayout.resizeThumbnails(true);
290
-
291
             const iframe = player.getIframe();
283
             const iframe = player.getIframe();
292
 
284
 
293
             // eslint-disable-next-line no-use-before-define
285
             // eslint-disable-next-line no-use-before-define
317
                 name: 'YouTube'
309
                 name: 'YouTube'
318
             }));
310
             }));
319
 
311
 
320
-            thumb.videoClick();
312
+            APP.store.dispatch(pinParticipant(self.url));
321
 
313
 
322
             // If we are sending the command and we are starting the player
314
             // If we are sending the command and we are starting the player
323
             // we need to continuously send the player current time position
315
             // we need to continuously send the player current time position

+ 4
- 3
modules/UI/shared_video/SharedVideoThumb.js 查看文件

6
 /**
6
 /**
7
  *
7
  *
8
  */
8
  */
9
-export default function SharedVideoThumb(url, videoType, VideoLayout) {
10
-    this.id = url;
9
+export default function SharedVideoThumb(participant, videoType, VideoLayout) {
10
+    this.id = participant.id;
11
 
11
 
12
-    this.url = url;
12
+    this.url = participant.id;
13
     this.setVideoType(videoType);
13
     this.setVideoType(videoType);
14
     this.videoSpanId = 'sharedVideoContainer';
14
     this.videoSpanId = 'sharedVideoContainer';
15
     this.container = this.createContainer(this.videoSpanId);
15
     this.container = this.createContainer(this.videoSpanId);
18
     this.bindHoverHandler();
18
     this.bindHoverHandler();
19
     SmallVideo.call(this, VideoLayout);
19
     SmallVideo.call(this, VideoLayout);
20
     this.isVideoMuted = true;
20
     this.isVideoMuted = true;
21
+    this.setDisplayName(participant.name);
21
 }
22
 }
22
 SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
23
 SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
23
 SharedVideoThumb.prototype.constructor = SharedVideoThumb;
24
 SharedVideoThumb.prototype.constructor = SharedVideoThumb;

+ 27
- 6
modules/UI/videolayout/VideoLayout.js 查看文件

9
     pinParticipant
9
     pinParticipant
10
 } from '../../../react/features/base/participants';
10
 } from '../../../react/features/base/participants';
11
 
11
 
12
+import { SHARED_VIDEO_CONTAINER_TYPE } from '../shared_video/SharedVideo';
13
+import SharedVideoThumb from '../shared_video/SharedVideoThumb';
14
+
12
 import Filmstrip from './Filmstrip';
15
 import Filmstrip from './Filmstrip';
13
 import UIEvents from '../../../service/UI/UIEvents';
16
 import UIEvents from '../../../service/UI/UIEvents';
14
 import UIUtil from '../util/UIUtil';
17
 import UIUtil from '../util/UIUtil';
16
 import RemoteVideo from './RemoteVideo';
19
 import RemoteVideo from './RemoteVideo';
17
 import LargeVideoManager from './LargeVideoManager';
20
 import LargeVideoManager from './LargeVideoManager';
18
 import { VIDEO_CONTAINER_TYPE } from './VideoContainer';
21
 import { VIDEO_CONTAINER_TYPE } from './VideoContainer';
22
+
19
 import LocalVideo from './LocalVideo';
23
 import LocalVideo from './LocalVideo';
20
 
24
 
21
 const remoteVideos = {};
25
 const remoteVideos = {};
434
     },
438
     },
435
 
439
 
436
     /**
440
     /**
437
-     * Creates or adds a participant container for the given id and smallVideo.
441
+     * Creates a participant container for the given id.
438
      *
442
      *
439
-     * @param {JitsiParticipant} user the participant to add
443
+     * @param {Object} participant - The redux representation of a remote
444
+     * participant.
445
+     * @returns {void}
440
      */
446
      */
441
-    addParticipantContainer(user) {
442
-        const id = user.getId();
443
-        const remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);
447
+    addRemoteParticipantContainer(participant) {
448
+        if (!participant || participant.local) {
449
+            return;
450
+        } else if (participant.isBot) {
451
+            const sharedVideoThumb = new SharedVideoThumb(
452
+                participant,
453
+                SHARED_VIDEO_CONTAINER_TYPE,
454
+                VideoLayout);
455
+
456
+            this.addRemoteVideoContainer(participant.id, sharedVideoThumb);
457
+
458
+            return;
459
+        }
460
+
461
+        const id = participant.id;
462
+        const jitsiParticipant = APP.conference.getParticipantById(id);
463
+        const remoteVideo
464
+            = new RemoteVideo(jitsiParticipant, VideoLayout, eventEmitter);
444
 
465
 
445
-        this._setRemoteControlProperties(user, remoteVideo);
466
+        this._setRemoteControlProperties(jitsiParticipant, remoteVideo);
446
         this.addRemoteVideoContainer(id, remoteVideo);
467
         this.addRemoteVideoContainer(id, remoteVideo);
447
 
468
 
448
         this.updateMutedForNoTracks(id, 'audio');
469
         this.updateMutedForNoTracks(id, 'audio');

+ 10
- 1
react/features/video-layout/middleware.web.js 查看文件

5
 
5
 
6
 import {
6
 import {
7
     DOMINANT_SPEAKER_CHANGED,
7
     DOMINANT_SPEAKER_CHANGED,
8
+    PARTICIPANT_JOINED,
8
     PARTICIPANT_LEFT,
9
     PARTICIPANT_LEFT,
9
     PARTICIPANT_UPDATED,
10
     PARTICIPANT_UPDATED,
10
-    PIN_PARTICIPANT
11
+    PIN_PARTICIPANT,
12
+    getParticipantById
11
 } from '../base/participants';
13
 } from '../base/participants';
12
 import { MiddlewareRegistry } from '../base/redux';
14
 import { MiddlewareRegistry } from '../base/redux';
13
 
15
 
28
     const result = next(action);
30
     const result = next(action);
29
 
31
 
30
     switch (action.type) {
32
     switch (action.type) {
33
+    case PARTICIPANT_JOINED:
34
+        if (!action.participant.local) {
35
+            VideoLayout.addRemoteParticipantContainer(
36
+                getParticipantById(store.getState(), action.participant.id));
37
+        }
38
+        break;
39
+
31
     case PARTICIPANT_LEFT:
40
     case PARTICIPANT_LEFT:
32
         VideoLayout.removeParticipantContainer(action.participant.id);
41
         VideoLayout.removeParticipantContainer(action.participant.id);
33
         break;
42
         break;

Loading…
取消
儲存