Browse Source

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

master
Leonard Kim 7 years ago
parent
commit
91323ebfec

+ 0
- 3
modules/UI/UI.js View File

@@ -492,9 +492,6 @@ UI.addUser = function(user) {
492 492
         APP.store.dispatch(showParticipantJoinedNotification(displayName));
493 493
     }
494 494
 
495
-    // Add Peer's container
496
-    VideoLayout.addParticipantContainer(user);
497
-
498 495
     // Configure avatar
499 496
     UI.setUserEmail(id);
500 497
 

+ 3
- 11
modules/UI/shared_video/SharedVideo.js View File

@@ -16,7 +16,8 @@ import {
16 16
 } from '../../../react/features/analytics';
17 17
 import {
18 18
     participantJoined,
19
-    participantLeft
19
+    participantLeft,
20
+    pinParticipant
20 21
 } from '../../../react/features/base/participants';
21 22
 import {
22 23
     dockToolbox,
@@ -24,8 +25,6 @@ import {
24 25
     showToolbox
25 26
 } from '../../../react/features/toolbox';
26 27
 
27
-import SharedVideoThumb from './SharedVideoThumb';
28
-
29 28
 export const SHARED_VIDEO_CONTAINER_TYPE = 'sharedvideo';
30 29
 
31 30
 /**
@@ -281,13 +280,6 @@ export default class SharedVideoManager {
281 280
 
282 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 283
             const iframe = player.getIframe();
292 284
 
293 285
             // eslint-disable-next-line no-use-before-define
@@ -317,7 +309,7 @@ export default class SharedVideoManager {
317 309
                 name: 'YouTube'
318 310
             }));
319 311
 
320
-            thumb.videoClick();
312
+            APP.store.dispatch(pinParticipant(self.url));
321 313
 
322 314
             // If we are sending the command and we are starting the player
323 315
             // we need to continuously send the player current time position

+ 4
- 3
modules/UI/shared_video/SharedVideoThumb.js View File

@@ -6,10 +6,10 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
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 13
     this.setVideoType(videoType);
14 14
     this.videoSpanId = 'sharedVideoContainer';
15 15
     this.container = this.createContainer(this.videoSpanId);
@@ -18,6 +18,7 @@ export default function SharedVideoThumb(url, videoType, VideoLayout) {
18 18
     this.bindHoverHandler();
19 19
     SmallVideo.call(this, VideoLayout);
20 20
     this.isVideoMuted = true;
21
+    this.setDisplayName(participant.name);
21 22
 }
22 23
 SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
23 24
 SharedVideoThumb.prototype.constructor = SharedVideoThumb;

+ 27
- 6
modules/UI/videolayout/VideoLayout.js View File

@@ -9,6 +9,9 @@ import {
9 9
     pinParticipant
10 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 15
 import Filmstrip from './Filmstrip';
13 16
 import UIEvents from '../../../service/UI/UIEvents';
14 17
 import UIUtil from '../util/UIUtil';
@@ -16,6 +19,7 @@ import UIUtil from '../util/UIUtil';
16 19
 import RemoteVideo from './RemoteVideo';
17 20
 import LargeVideoManager from './LargeVideoManager';
18 21
 import { VIDEO_CONTAINER_TYPE } from './VideoContainer';
22
+
19 23
 import LocalVideo from './LocalVideo';
20 24
 
21 25
 const remoteVideos = {};
@@ -434,15 +438,32 @@ const VideoLayout = {
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 467
         this.addRemoteVideoContainer(id, remoteVideo);
447 468
 
448 469
         this.updateMutedForNoTracks(id, 'audio');

+ 10
- 1
react/features/video-layout/middleware.web.js View File

@@ -5,9 +5,11 @@ import UIEvents from '../../../service/UI/UIEvents';
5 5
 
6 6
 import {
7 7
     DOMINANT_SPEAKER_CHANGED,
8
+    PARTICIPANT_JOINED,
8 9
     PARTICIPANT_LEFT,
9 10
     PARTICIPANT_UPDATED,
10
-    PIN_PARTICIPANT
11
+    PIN_PARTICIPANT,
12
+    getParticipantById
11 13
 } from '../base/participants';
12 14
 import { MiddlewareRegistry } from '../base/redux';
13 15
 
@@ -28,6 +30,13 @@ MiddlewareRegistry.register(store => next => action => {
28 30
     const result = next(action);
29 31
 
30 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 40
     case PARTICIPANT_LEFT:
32 41
         VideoLayout.removeParticipantContainer(action.participant.id);
33 42
         break;

Loading…
Cancel
Save