ソースを参照

ref(RemoteVideo): store JitsiParticipant instead of id

j8
paweldomas 8年前
コミット
3ef5dd20ef

+ 1
- 1
conference.js ファイルの表示

@@ -1085,7 +1085,7 @@ export default {
1085 1085
 
1086 1086
             console.log('USER %s connnected', id, user);
1087 1087
             APP.API.notifyUserJoined(id);
1088
-            APP.UI.addUser(id, user.getDisplayName());
1088
+            APP.UI.addUser(user);
1089 1089
 
1090 1090
             // check the roles for the new user and reflect them
1091 1091
             APP.UI.updateUserRole(user);

+ 5
- 4
modules/UI/UI.js ファイルの表示

@@ -602,10 +602,11 @@ UI.getSharedDocumentManager = function () {
602 602
 
603 603
 /**
604 604
  * Show user on UI.
605
- * @param {string} id user id
606
- * @param {string} displayName user nickname
605
+ * @param {JitsiParticipant} user
607 606
  */
608
-UI.addUser = function (id, displayName) {
607
+UI.addUser = function (user) {
608
+    var id = user.getId();
609
+    var displayName = user.getDisplayName();
609 610
     UI.hideRingOverLay();
610 611
     ContactList.addContact(id);
611 612
 
@@ -618,7 +619,7 @@ UI.addUser = function (id, displayName) {
618 619
         UIUtil.playSoundNotification('userJoined');
619 620
 
620 621
     // Add Peer's container
621
-    VideoLayout.addParticipantContainer(id);
622
+    VideoLayout.addParticipantContainer(user);
622 623
 
623 624
     // Configure avatar
624 625
     UI.setUserEmail(id);

+ 1
- 1
modules/UI/shared_video/SharedVideo.js ファイルの表示

@@ -243,7 +243,7 @@ export default class SharedVideoManager {
243 243
 
244 244
             let thumb = new SharedVideoThumb(self.url);
245 245
             thumb.setDisplayName(player.getVideoData().title);
246
-            VideoLayout.addParticipantContainer(self.url, thumb);
246
+            VideoLayout.addRemoteVideoContainer(self.url, thumb);
247 247
 
248 248
             let iframe = player.getIframe();
249 249
             self.sharedVideo = new SharedVideoContainer(

+ 14
- 4
modules/UI/videolayout/RemoteVideo.js ファイルの表示

@@ -8,14 +8,24 @@ import UIUtils from "../util/UIUtil";
8 8
 import UIEvents from '../../../service/UI/UIEvents';
9 9
 import JitsiPopover from "../util/JitsiPopover";
10 10
 
11
-function RemoteVideo(id, VideoLayout, emitter) {
12
-    this.id = id;
11
+/**
12
+ * Creates new instance of the <tt>RemoteVideo</tt>.
13
+ * @param user {JitsiParticipant} the user for whom remote video instance will
14
+ * be created.
15
+ * @param {VideoLayout} VideoLayout the video layout instance.
16
+ * @param {EventEmitter} emitter the event emitter which will be used by
17
+ * the new instance to emit events.
18
+ * @constructor
19
+ */
20
+function RemoteVideo(user, VideoLayout, emitter) {
21
+    this.user = user;
22
+    this.id = user.getId();
13 23
     this.emitter = emitter;
14
-    this.videoSpanId = `participant_${id}`;
24
+    this.videoSpanId = `participant_${this.id}`;
15 25
     SmallVideo.call(this, VideoLayout);
16 26
     this.hasRemoteVideoMenu = false;
17 27
     this.addRemoteVideoContainer();
18
-    this.connectionIndicator = new ConnectionIndicator(this, id);
28
+    this.connectionIndicator = new ConnectionIndicator(this, this.id);
19 29
     this.setDisplayName();
20 30
     this.flipX = false;
21 31
     this.isLocal = false;

+ 17
- 5
modules/UI/videolayout/VideoLayout.js ファイルの表示

@@ -382,18 +382,30 @@ var VideoLayout = {
382 382
     },
383 383
 
384 384
     /**
385
-     * Creates a participant container for the given id and smallVideo.
385
+     * Creates or adds a participant container for the given id and smallVideo.
386 386
      *
387
-     * @param id the id of the participant to add
387
+     * @param {JitsiParticipant} user the participant to add
388 388
      * @param {SmallVideo} smallVideo optional small video instance to add as a
389
-     * remote video, if undefined RemoteVideo will be created
389
+     * remote video, if undefined <tt>RemoteVideo</tt> will be created
390 390
      */
391
-    addParticipantContainer (id, smallVideo) {
391
+    addParticipantContainer (user, smallVideo) {
392
+        let id = user.getId();
392 393
         let remoteVideo;
393 394
         if(smallVideo)
394 395
             remoteVideo = smallVideo;
395 396
         else
396
-            remoteVideo = new RemoteVideo(id, VideoLayout, eventEmitter);
397
+            remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);
398
+        this.addRemoteVideoContainer(id, remoteVideo);
399
+    },
400
+
401
+    /**
402
+     * Adds remote video container for the given id and <tt>SmallVideo</tt>.
403
+     *
404
+     * @param {string} the id of the video to add
405
+     * @param {SmallVideo} smallVideo the small video instance to add as a
406
+     * remote video
407
+     */
408
+    addRemoteVideoContainer (id, remoteVideo) {
397 409
         remoteVideos[id] = remoteVideo;
398 410
 
399 411
         let videoType = VideoLayout.getRemoteVideoType(id);

読み込み中…
キャンセル
保存