diff --git a/conference.js b/conference.js index 6df6db2a9..3bfdf16ae 100644 --- a/conference.js +++ b/conference.js @@ -317,7 +317,7 @@ function changeLocalDisplayName(nickname = '') { APP.settings.setDisplayName(nickname); room.setDisplayName(nickname); - APP.UI.changeDisplayName(APP.conference.localId, nickname); + APP.UI.changeDisplayName(APP.conference.getMyUserId(), nickname); } class ConferenceConnector { @@ -410,6 +410,9 @@ class ConferenceConnector { connection.disconnect(); APP.UI.notifyMaxUsersLimitReached(); break; + case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS: + window.location.reload(); + break; default: this._handleConferenceFailed(err, ...params); } @@ -447,7 +450,6 @@ class ConferenceConnector { } export default { - localId: undefined, isModerator: false, audioMuted: false, videoMuted: false, @@ -530,7 +532,7 @@ export default { * @returns {boolean} */ isLocalId (id) { - return this.localId === id; + return this.getMyUserId() === id; }, /** * Simulates toolbar button click for audio mute. Used by shortcuts and API. @@ -728,7 +730,6 @@ export default { _createRoom (localTracks) { room = connection.initJitsiConference(APP.conference.roomName, this._getConferenceOptions()); - this.localId = room.myUserId(); this._setLocalAudioVideoStreams(localTracks); roomLocker = createRoomLocker(room); this._room = room; // FIXME do not use this @@ -812,7 +813,7 @@ export default { this.isSharingScreen = false; } - APP.UI.setVideoMuted(this.localId, this.videoMuted); + APP.UI.setVideoMuted(this.getMyUserId(), this.videoMuted); APP.UI.updateDesktopSharingButtons(); }); @@ -847,7 +848,7 @@ export default { } APP.UI.enableMicrophoneButton(); - APP.UI.setAudioMuted(this.localId, this.audioMuted); + APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted); }); }, @@ -1009,7 +1010,7 @@ export default { let id; const mute = track.isMuted(); if(track.isLocal()){ - id = this.localId; + id = APP.conference.getMyUserId(); if(track.getType() === "audio") { this.audioMuted = mute; } else { @@ -1519,4 +1520,4 @@ export default { APP.UI.setLocalRaisedHandStatus(raisedHand); } } -}; \ No newline at end of file +}; diff --git a/modules/UI/UI.js b/modules/UI/UI.js index f993bd887..ada993c38 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -272,14 +272,14 @@ UI.setRaisedHandStatus = (participant, raisedHandStatus) => { * Sets the local "raised hand" status. */ UI.setLocalRaisedHandStatus = (raisedHandStatus) => { - VideoLayout.setRaisedHandStatus(APP.conference.localId, raisedHandStatus); + VideoLayout.setRaisedHandStatus(APP.conference.getMyUserId(), raisedHandStatus); }; /** * Initialize conference UI. */ UI.initConference = function () { - let id = APP.conference.localId; + let id = APP.conference.getMyUserId(); Toolbar.updateRoomUrl(window.location.href); // Add myself to the contact list. diff --git a/modules/UI/audio_levels/AudioLevels.js b/modules/UI/audio_levels/AudioLevels.js index 68568710d..642ddc925 100644 --- a/modules/UI/audio_levels/AudioLevels.js +++ b/modules/UI/audio_levels/AudioLevels.js @@ -209,7 +209,7 @@ const AudioLevels = { drawContext.drawImage(canvasCache, 0, 0); if (id === LOCAL_LEVEL) { - id = APP.conference.localId; + id = APP.conference.getMyUserId(); if (!id) { return; } diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js index df59c7cf9..13a28e7b5 100644 --- a/modules/UI/recording/Recording.js +++ b/modules/UI/recording/Recording.js @@ -256,7 +256,7 @@ var Recording = { // everyone. if (config.iAmRecorder) { VideoLayout.enableDeviceAvailabilityIcons( - APP.conference.localId, false); + APP.conference.getMyUserId(), false); VideoLayout.setLocalVideoVisible(false); Feedback.enableFeedback(false); Toolbar.enable(false); diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index 562e9d981..52a3d8fcd 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -639,7 +639,6 @@ SharedVideoThumb.prototype.createContainer = function (spanId) { // add the avatar var avatar = document.createElement('img'); - avatar.id = 'avatar_' + this.id; avatar.className = 'sharedVideoAvatar'; avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg"; container.appendChild(avatar); @@ -822,4 +821,3 @@ function requestVideoLink() { }); } - diff --git a/modules/UI/side_pannels/contactlist/ContactList.js b/modules/UI/side_pannels/contactlist/ContactList.js index d5c23bb68..bad800786 100644 --- a/modules/UI/side_pannels/contactlist/ContactList.js +++ b/modules/UI/side_pannels/contactlist/ContactList.js @@ -156,7 +156,7 @@ var ContactList = { if(!displayName) return; if (id === 'localVideoContainer') { - id = APP.conference.localId; + id = APP.conference.getMyUserId(); } let contactName = $(`#contacts #${id}>p`); diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.js index 69a613867..7c2595bb0 100644 --- a/modules/UI/videolayout/LargeVideo.js +++ b/modules/UI/videolayout/LargeVideo.js @@ -21,7 +21,7 @@ function getStreamOwnerId(stream) { return; } if (stream.isLocal()) { // local stream doesn't have method "getParticipantId" - return APP.conference.localId; + return APP.conference.getMyUserId(); } else { return stream.getParticipantId(); } diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index d5b0d319f..f0611ee48 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -18,7 +18,7 @@ function LocalVideo(VideoLayout, emitter) { this.emitter = emitter; Object.defineProperty(this, 'id', { get: function () { - return APP.conference.localId; + return APP.conference.getMyUserId(); } }); SmallVideo.call(this, VideoLayout); diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index 852b62906..92eb8412e 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -300,9 +300,6 @@ SmallVideo.prototype.updateIconPositions = function () { /** * Creates the element indicating the moderator(owner) of the conference. - * - * @param parentElement the parent element where the owner indicator will - * be added */ SmallVideo.prototype.createModeratorIndicatorElement = function () { // Show moderator indicator @@ -330,6 +327,13 @@ SmallVideo.prototype.createModeratorIndicatorElement = function () { APP.translation.translateElement($('#' + this.videoSpanId + ' .focusindicator')); }; +/** + * Removes the element indicating the moderator(owner) of the conference. + */ +SmallVideo.prototype.removeModeratorIndicatorElement = function () { + $('#' + this.videoSpanId + ' .focusindicator').remove(); +}; + /** * This is an especially interesting function. A naive reader might think that * it returns this SmallVideo's "video" element. But it is much more exciting. @@ -387,7 +391,7 @@ SmallVideo.prototype.updateView = function () { let video = this.selectVideoElement(); - let avatar = $(`#avatar_${this.id}`); + let avatar = $('#' + this.videoSpanId + ' .userAvatar'); var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id); @@ -415,7 +419,7 @@ SmallVideo.prototype.updateView = function () { SmallVideo.prototype.avatarChanged = function (avatarUrl) { var thumbnail = $('#' + this.videoSpanId); - var avatar = $('#avatar_' + this.id); + var avatar = $('#' + this.videoSpanId + ' .userAvatar'); this.hasAvatar = true; // set the avatar in the thumbnail @@ -424,7 +428,6 @@ SmallVideo.prototype.avatarChanged = function (avatarUrl) { } else { if (thumbnail && thumbnail.length > 0) { avatar = document.createElement('img'); - avatar.id = 'avatar_' + this.id; avatar.className = 'userAvatar'; avatar.src = avatarUrl; thumbnail.append(avatar); diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index af4f04e90..895334c7f 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -162,7 +162,7 @@ var VideoLayout = { localVideoThumbnail.setDisplayName(); localVideoThumbnail.createConnectionIndicator(); - let localId = APP.conference.localId; + let localId = APP.conference.getMyUserId(); this.onVideoTypeChanged(localId, stream.videoType); let {thumbWidth, thumbHeight} = this.resizeThumbnails(false, true); @@ -186,7 +186,7 @@ var VideoLayout = { */ mucJoined () { if (largeVideo && !largeVideo.id) { - this.updateLargeVideo(APP.conference.localId, true); + this.updateLargeVideo(APP.conference.getMyUserId(), true); } }, @@ -290,7 +290,7 @@ var VideoLayout = { // Go with local video console.info("Fallback to local video..."); - let id = APP.conference.localId; + let id = APP.conference.getMyUserId(); console.info("electLastVisibleVideo: " + id); return id; @@ -457,6 +457,8 @@ var VideoLayout = { let isModerator = APP.conference.isModerator; if (isModerator) { localVideoThumbnail.createModeratorIndicatorElement(); + } else { + localVideoThumbnail.removeModeratorIndicatorElement(); } APP.conference.listMembers().forEach(function (member) { @@ -775,7 +777,7 @@ var VideoLayout = { updateLocalConnectionStats (percent, object) { let resolutions = object.resolution; - object.resolution = resolutions[APP.conference.localId]; + object.resolution = resolutions[APP.conference.getMyUserId()]; localVideoThumbnail.updateStatsIndicator(percent, object); Object.keys(resolutions).forEach(function (id) {