Merge pull request #724 from jitsi/reloads
Implements support for conference reloads
This commit is contained in:
commit
dfa9bab9e1
|
@ -317,7 +317,7 @@ function changeLocalDisplayName(nickname = '') {
|
||||||
|
|
||||||
APP.settings.setDisplayName(nickname);
|
APP.settings.setDisplayName(nickname);
|
||||||
room.setDisplayName(nickname);
|
room.setDisplayName(nickname);
|
||||||
APP.UI.changeDisplayName(APP.conference.localId, nickname);
|
APP.UI.changeDisplayName(APP.conference.getMyUserId(), nickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConferenceConnector {
|
class ConferenceConnector {
|
||||||
|
@ -410,6 +410,9 @@ class ConferenceConnector {
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
APP.UI.notifyMaxUsersLimitReached();
|
APP.UI.notifyMaxUsersLimitReached();
|
||||||
break;
|
break;
|
||||||
|
case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS:
|
||||||
|
window.location.reload();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this._handleConferenceFailed(err, ...params);
|
this._handleConferenceFailed(err, ...params);
|
||||||
}
|
}
|
||||||
|
@ -447,7 +450,6 @@ class ConferenceConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
localId: undefined,
|
|
||||||
isModerator: false,
|
isModerator: false,
|
||||||
audioMuted: false,
|
audioMuted: false,
|
||||||
videoMuted: false,
|
videoMuted: false,
|
||||||
|
@ -530,7 +532,7 @@ export default {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isLocalId (id) {
|
isLocalId (id) {
|
||||||
return this.localId === id;
|
return this.getMyUserId() === id;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Simulates toolbar button click for audio mute. Used by shortcuts and API.
|
* Simulates toolbar button click for audio mute. Used by shortcuts and API.
|
||||||
|
@ -728,7 +730,6 @@ export default {
|
||||||
_createRoom (localTracks) {
|
_createRoom (localTracks) {
|
||||||
room = connection.initJitsiConference(APP.conference.roomName,
|
room = connection.initJitsiConference(APP.conference.roomName,
|
||||||
this._getConferenceOptions());
|
this._getConferenceOptions());
|
||||||
this.localId = room.myUserId();
|
|
||||||
this._setLocalAudioVideoStreams(localTracks);
|
this._setLocalAudioVideoStreams(localTracks);
|
||||||
roomLocker = createRoomLocker(room);
|
roomLocker = createRoomLocker(room);
|
||||||
this._room = room; // FIXME do not use this
|
this._room = room; // FIXME do not use this
|
||||||
|
@ -812,7 +813,7 @@ export default {
|
||||||
this.isSharingScreen = false;
|
this.isSharingScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
APP.UI.setVideoMuted(this.localId, this.videoMuted);
|
APP.UI.setVideoMuted(this.getMyUserId(), this.videoMuted);
|
||||||
|
|
||||||
APP.UI.updateDesktopSharingButtons();
|
APP.UI.updateDesktopSharingButtons();
|
||||||
});
|
});
|
||||||
|
@ -847,7 +848,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
APP.UI.enableMicrophoneButton();
|
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;
|
let id;
|
||||||
const mute = track.isMuted();
|
const mute = track.isMuted();
|
||||||
if(track.isLocal()){
|
if(track.isLocal()){
|
||||||
id = this.localId;
|
id = APP.conference.getMyUserId();
|
||||||
if(track.getType() === "audio") {
|
if(track.getType() === "audio") {
|
||||||
this.audioMuted = mute;
|
this.audioMuted = mute;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -272,14 +272,14 @@ UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
|
||||||
* Sets the local "raised hand" status.
|
* Sets the local "raised hand" status.
|
||||||
*/
|
*/
|
||||||
UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
|
UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
|
||||||
VideoLayout.setRaisedHandStatus(APP.conference.localId, raisedHandStatus);
|
VideoLayout.setRaisedHandStatus(APP.conference.getMyUserId(), raisedHandStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize conference UI.
|
* Initialize conference UI.
|
||||||
*/
|
*/
|
||||||
UI.initConference = function () {
|
UI.initConference = function () {
|
||||||
let id = APP.conference.localId;
|
let id = APP.conference.getMyUserId();
|
||||||
Toolbar.updateRoomUrl(window.location.href);
|
Toolbar.updateRoomUrl(window.location.href);
|
||||||
|
|
||||||
// Add myself to the contact list.
|
// Add myself to the contact list.
|
||||||
|
|
|
@ -209,7 +209,7 @@ const AudioLevels = {
|
||||||
drawContext.drawImage(canvasCache, 0, 0);
|
drawContext.drawImage(canvasCache, 0, 0);
|
||||||
|
|
||||||
if (id === LOCAL_LEVEL) {
|
if (id === LOCAL_LEVEL) {
|
||||||
id = APP.conference.localId;
|
id = APP.conference.getMyUserId();
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ var Recording = {
|
||||||
// everyone.
|
// everyone.
|
||||||
if (config.iAmRecorder) {
|
if (config.iAmRecorder) {
|
||||||
VideoLayout.enableDeviceAvailabilityIcons(
|
VideoLayout.enableDeviceAvailabilityIcons(
|
||||||
APP.conference.localId, false);
|
APP.conference.getMyUserId(), false);
|
||||||
VideoLayout.setLocalVideoVisible(false);
|
VideoLayout.setLocalVideoVisible(false);
|
||||||
Feedback.enableFeedback(false);
|
Feedback.enableFeedback(false);
|
||||||
Toolbar.enable(false);
|
Toolbar.enable(false);
|
||||||
|
|
|
@ -639,7 +639,6 @@ SharedVideoThumb.prototype.createContainer = function (spanId) {
|
||||||
|
|
||||||
// add the avatar
|
// add the avatar
|
||||||
var avatar = document.createElement('img');
|
var avatar = document.createElement('img');
|
||||||
avatar.id = 'avatar_' + this.id;
|
|
||||||
avatar.className = 'sharedVideoAvatar';
|
avatar.className = 'sharedVideoAvatar';
|
||||||
avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";
|
avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";
|
||||||
container.appendChild(avatar);
|
container.appendChild(avatar);
|
||||||
|
@ -822,4 +821,3 @@ function requestVideoLink() {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ var ContactList = {
|
||||||
if(!displayName)
|
if(!displayName)
|
||||||
return;
|
return;
|
||||||
if (id === 'localVideoContainer') {
|
if (id === 'localVideoContainer') {
|
||||||
id = APP.conference.localId;
|
id = APP.conference.getMyUserId();
|
||||||
}
|
}
|
||||||
let contactName = $(`#contacts #${id}>p`);
|
let contactName = $(`#contacts #${id}>p`);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ function getStreamOwnerId(stream) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (stream.isLocal()) { // local stream doesn't have method "getParticipantId"
|
if (stream.isLocal()) { // local stream doesn't have method "getParticipantId"
|
||||||
return APP.conference.localId;
|
return APP.conference.getMyUserId();
|
||||||
} else {
|
} else {
|
||||||
return stream.getParticipantId();
|
return stream.getParticipantId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ function LocalVideo(VideoLayout, emitter) {
|
||||||
this.emitter = emitter;
|
this.emitter = emitter;
|
||||||
Object.defineProperty(this, 'id', {
|
Object.defineProperty(this, 'id', {
|
||||||
get: function () {
|
get: function () {
|
||||||
return APP.conference.localId;
|
return APP.conference.getMyUserId();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SmallVideo.call(this, VideoLayout);
|
SmallVideo.call(this, VideoLayout);
|
||||||
|
|
|
@ -300,9 +300,6 @@ SmallVideo.prototype.updateIconPositions = function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the element indicating the moderator(owner) of the conference.
|
* 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 () {
|
SmallVideo.prototype.createModeratorIndicatorElement = function () {
|
||||||
// Show moderator indicator
|
// Show moderator indicator
|
||||||
|
@ -330,6 +327,13 @@ SmallVideo.prototype.createModeratorIndicatorElement = function () {
|
||||||
APP.translation.translateElement($('#' + this.videoSpanId + ' .focusindicator'));
|
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
|
* 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.
|
* 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 video = this.selectVideoElement();
|
||||||
|
|
||||||
let avatar = $(`#avatar_${this.id}`);
|
let avatar = $('#' + this.videoSpanId + ' .userAvatar');
|
||||||
|
|
||||||
var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id);
|
var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id);
|
||||||
|
|
||||||
|
@ -415,7 +419,7 @@ SmallVideo.prototype.updateView = function () {
|
||||||
|
|
||||||
SmallVideo.prototype.avatarChanged = function (avatarUrl) {
|
SmallVideo.prototype.avatarChanged = function (avatarUrl) {
|
||||||
var thumbnail = $('#' + this.videoSpanId);
|
var thumbnail = $('#' + this.videoSpanId);
|
||||||
var avatar = $('#avatar_' + this.id);
|
var avatar = $('#' + this.videoSpanId + ' .userAvatar');
|
||||||
this.hasAvatar = true;
|
this.hasAvatar = true;
|
||||||
|
|
||||||
// set the avatar in the thumbnail
|
// set the avatar in the thumbnail
|
||||||
|
@ -424,7 +428,6 @@ SmallVideo.prototype.avatarChanged = function (avatarUrl) {
|
||||||
} else {
|
} else {
|
||||||
if (thumbnail && thumbnail.length > 0) {
|
if (thumbnail && thumbnail.length > 0) {
|
||||||
avatar = document.createElement('img');
|
avatar = document.createElement('img');
|
||||||
avatar.id = 'avatar_' + this.id;
|
|
||||||
avatar.className = 'userAvatar';
|
avatar.className = 'userAvatar';
|
||||||
avatar.src = avatarUrl;
|
avatar.src = avatarUrl;
|
||||||
thumbnail.append(avatar);
|
thumbnail.append(avatar);
|
||||||
|
|
|
@ -162,7 +162,7 @@ var VideoLayout = {
|
||||||
localVideoThumbnail.setDisplayName();
|
localVideoThumbnail.setDisplayName();
|
||||||
localVideoThumbnail.createConnectionIndicator();
|
localVideoThumbnail.createConnectionIndicator();
|
||||||
|
|
||||||
let localId = APP.conference.localId;
|
let localId = APP.conference.getMyUserId();
|
||||||
this.onVideoTypeChanged(localId, stream.videoType);
|
this.onVideoTypeChanged(localId, stream.videoType);
|
||||||
|
|
||||||
let {thumbWidth, thumbHeight} = this.resizeThumbnails(false, true);
|
let {thumbWidth, thumbHeight} = this.resizeThumbnails(false, true);
|
||||||
|
@ -186,7 +186,7 @@ var VideoLayout = {
|
||||||
*/
|
*/
|
||||||
mucJoined () {
|
mucJoined () {
|
||||||
if (largeVideo && !largeVideo.id) {
|
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
|
// Go with local video
|
||||||
console.info("Fallback to local video...");
|
console.info("Fallback to local video...");
|
||||||
|
|
||||||
let id = APP.conference.localId;
|
let id = APP.conference.getMyUserId();
|
||||||
console.info("electLastVisibleVideo: " + id);
|
console.info("electLastVisibleVideo: " + id);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
@ -457,6 +457,8 @@ var VideoLayout = {
|
||||||
let isModerator = APP.conference.isModerator;
|
let isModerator = APP.conference.isModerator;
|
||||||
if (isModerator) {
|
if (isModerator) {
|
||||||
localVideoThumbnail.createModeratorIndicatorElement();
|
localVideoThumbnail.createModeratorIndicatorElement();
|
||||||
|
} else {
|
||||||
|
localVideoThumbnail.removeModeratorIndicatorElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
APP.conference.listMembers().forEach(function (member) {
|
APP.conference.listMembers().forEach(function (member) {
|
||||||
|
@ -775,7 +777,7 @@ var VideoLayout = {
|
||||||
updateLocalConnectionStats (percent, object) {
|
updateLocalConnectionStats (percent, object) {
|
||||||
let resolutions = object.resolution;
|
let resolutions = object.resolution;
|
||||||
|
|
||||||
object.resolution = resolutions[APP.conference.localId];
|
object.resolution = resolutions[APP.conference.getMyUserId()];
|
||||||
localVideoThumbnail.updateStatsIndicator(percent, object);
|
localVideoThumbnail.updateStatsIndicator(percent, object);
|
||||||
|
|
||||||
Object.keys(resolutions).forEach(function (id) {
|
Object.keys(resolutions).forEach(function (id) {
|
||||||
|
|
Loading…
Reference in New Issue