Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Implements conference reload support

hristoterezov7bf9a82f0bb2
diff --git a/conference.js b/conference.js
index bc8e243e94..a1cc112545 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 {
@@ -1513,4 +1514,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 f993bd887b..ada993c384 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 68568710de..642ddc9254 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 ecdb583559..405a9eb053 100644
--- a/modules/UI/recording/Recording.js
+++ b/modules/UI/recording/Recording.js
@@ -245,7 +245,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 562e9d981d..52a3d8fcdf 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 d5c23bb686..bad800786c 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 69a6138679..7c2595bb08 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 d5b0d319ff..f0611ee489 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 37a5d1c2ab..3a317715f7 100644
--- a/modules/UI/videolayout/SmallVideo.js
+++ b/modules/UI/videolayout/SmallVideo.js
@@ -299,9 +299,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
@@ -329,6 +326,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();
+};
+
SmallVideo.prototype.selectVideoElement = function () {
return $(RTCUIHelper.findVideoElement($('#' + this.videoSpanId)[0]));
};
@@ -376,7 +380,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);
@@ -404,7 +408,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
@@ -413,7 +417,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 c47be8854d..41fa7f9681 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) {