Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(RemoteVideo): store JitsiParticipant instead of id
paweldomas3ef5dd20ef47
diff --git a/conference.js b/conference.jsindex ed346eca24..a715ca552d 100644--- a/conference.js+++ b/conference.js@@ -1085,7 +1085,7 @@ export default {console.log('USER %s connnected', id, user);APP.API.notifyUserJoined(id);- APP.UI.addUser(id, user.getDisplayName());+ APP.UI.addUser(user);// check the roles for the new user and reflect themAPP.UI.updateUserRole(user);diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex 22802db3dd..558e4b2f65 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -602,10 +602,11 @@ UI.getSharedDocumentManager = function () {/*** Show user on UI.- * @param {string} id user id- * @param {string} displayName user nickname+ * @param {JitsiParticipant} user*/-UI.addUser = function (id, displayName) {+UI.addUser = function (user) {+ var id = user.getId();+ var displayName = user.getDisplayName();UI.hideRingOverLay();ContactList.addContact(id);@@ -618,7 +619,7 @@ UI.addUser = function (id, displayName) {UIUtil.playSoundNotification('userJoined');// Add Peer's container- VideoLayout.addParticipantContainer(id);+ VideoLayout.addParticipantContainer(user);// Configure avatarUI.setUserEmail(id);diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.jsindex 92e1531908..3d777c6ed4 100644--- a/modules/UI/shared_video/SharedVideo.js+++ b/modules/UI/shared_video/SharedVideo.js@@ -243,7 +243,7 @@ export default class SharedVideoManager {let thumb = new SharedVideoThumb(self.url);thumb.setDisplayName(player.getVideoData().title);- VideoLayout.addParticipantContainer(self.url, thumb);+ VideoLayout.addRemoteVideoContainer(self.url, thumb);let iframe = player.getIframe();self.sharedVideo = new SharedVideoContainer(diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.jsindex 6d577765a1..382ed5c6cd 100644--- a/modules/UI/videolayout/RemoteVideo.js+++ b/modules/UI/videolayout/RemoteVideo.js@@ -8,14 +8,24 @@ import UIUtils from "../util/UIUtil";import UIEvents from '../../../service/UI/UIEvents';import JitsiPopover from "../util/JitsiPopover";-function RemoteVideo(id, VideoLayout, emitter) {- this.id = id;+/**+ * Creates new instance of the <tt>RemoteVideo</tt>.+ * @param user {JitsiParticipant} the user for whom remote video instance will+ * be created.+ * @param {VideoLayout} VideoLayout the video layout instance.+ * @param {EventEmitter} emitter the event emitter which will be used by+ * the new instance to emit events.+ * @constructor+ */+function RemoteVideo(user, VideoLayout, emitter) {+ this.user = user;+ this.id = user.getId();this.emitter = emitter;- this.videoSpanId = `participant_${id}`;+ this.videoSpanId = `participant_${this.id}`;SmallVideo.call(this, VideoLayout);this.hasRemoteVideoMenu = false;this.addRemoteVideoContainer();- this.connectionIndicator = new ConnectionIndicator(this, id);+ this.connectionIndicator = new ConnectionIndicator(this, this.id);this.setDisplayName();this.flipX = false;this.isLocal = false;diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex 0b3b68375b..e20a122b2f 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -382,18 +382,30 @@ var VideoLayout = {},/**- * Creates a participant container for the given id and smallVideo.+ * Creates or adds a participant container for the given id and smallVideo.*- * @param id the id of the participant to add+ * @param {JitsiParticipant} user the participant to add* @param {SmallVideo} smallVideo optional small video instance to add as a- * remote video, if undefined RemoteVideo will be created+ * remote video, if undefined <tt>RemoteVideo</tt> will be created*/- addParticipantContainer (id, smallVideo) {+ addParticipantContainer (user, smallVideo) {+ let id = user.getId();let remoteVideo;if(smallVideo)remoteVideo = smallVideo;else- remoteVideo = new RemoteVideo(id, VideoLayout, eventEmitter);+ remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);+ this.addRemoteVideoContainer(id, remoteVideo);+ },++ /**+ * Adds remote video container for the given id and <tt>SmallVideo</tt>.+ *+ * @param {string} the id of the video to add+ * @param {SmallVideo} smallVideo the small video instance to add as a+ * remote video+ */+ addRemoteVideoContainer (id, remoteVideo) {remoteVideos[id] = remoteVideo;let videoType = VideoLayout.getRemoteVideoType(id);