Browse Source

Implements conference reload support

j8
hristoterezov 8 years ago
parent
commit
7bf9a82f0b

+ 9
- 8
conference.js View File

@@ -317,7 +317,7 @@ function changeLocalDisplayName(nickname = '') {
317 317
 
318 318
     APP.settings.setDisplayName(nickname);
319 319
     room.setDisplayName(nickname);
320
-    APP.UI.changeDisplayName(APP.conference.localId, nickname);
320
+    APP.UI.changeDisplayName(APP.conference.getMyUserId(), nickname);
321 321
 }
322 322
 
323 323
 class ConferenceConnector {
@@ -410,6 +410,9 @@ class ConferenceConnector {
410 410
             connection.disconnect();
411 411
             APP.UI.notifyMaxUsersLimitReached();
412 412
             break;
413
+        case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS:
414
+            window.location.reload();
415
+            break;
413 416
         default:
414 417
             this._handleConferenceFailed(err, ...params);
415 418
         }
@@ -447,7 +450,6 @@ class ConferenceConnector {
447 450
 }
448 451
 
449 452
 export default {
450
-    localId: undefined,
451 453
     isModerator: false,
452 454
     audioMuted: false,
453 455
     videoMuted: false,
@@ -530,7 +532,7 @@ export default {
530 532
      * @returns {boolean}
531 533
      */
532 534
     isLocalId (id) {
533
-        return this.localId === id;
535
+        return this.getMyUserId() === id;
534 536
     },
535 537
     /**
536 538
      * Simulates toolbar button click for audio mute. Used by shortcuts and API.
@@ -728,7 +730,6 @@ export default {
728 730
     _createRoom (localTracks) {
729 731
         room = connection.initJitsiConference(APP.conference.roomName,
730 732
             this._getConferenceOptions());
731
-        this.localId = room.myUserId();
732 733
         this._setLocalAudioVideoStreams(localTracks);
733 734
         roomLocker = createRoomLocker(room);
734 735
         this._room = room; // FIXME do not use this
@@ -812,7 +813,7 @@ export default {
812 813
                 this.isSharingScreen = false;
813 814
             }
814 815
 
815
-            APP.UI.setVideoMuted(this.localId, this.videoMuted);
816
+            APP.UI.setVideoMuted(this.getMyUserId(), this.videoMuted);
816 817
 
817 818
             APP.UI.updateDesktopSharingButtons();
818 819
         });
@@ -847,7 +848,7 @@ export default {
847 848
             }
848 849
 
849 850
             APP.UI.enableMicrophoneButton();
850
-            APP.UI.setAudioMuted(this.localId, this.audioMuted);
851
+            APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
851 852
         });
852 853
     },
853 854
 
@@ -1009,7 +1010,7 @@ export default {
1009 1010
             let id;
1010 1011
             const mute = track.isMuted();
1011 1012
             if(track.isLocal()){
1012
-                id = this.localId;
1013
+                id = APP.conference.getMyUserId();
1013 1014
                 if(track.getType() === "audio") {
1014 1015
                     this.audioMuted = mute;
1015 1016
                 } else {
@@ -1513,4 +1514,4 @@ export default {
1513 1514
             APP.UI.setLocalRaisedHandStatus(raisedHand);
1514 1515
         }
1515 1516
     }
1516
-};
1517
+};

+ 2
- 2
modules/UI/UI.js View File

@@ -272,14 +272,14 @@ UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
272 272
  * Sets the local "raised hand" status.
273 273
  */
274 274
 UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
275
-    VideoLayout.setRaisedHandStatus(APP.conference.localId, raisedHandStatus);
275
+    VideoLayout.setRaisedHandStatus(APP.conference.getMyUserId(), raisedHandStatus);
276 276
 };
277 277
 
278 278
 /**
279 279
  * Initialize conference UI.
280 280
  */
281 281
 UI.initConference = function () {
282
-    let id = APP.conference.localId;
282
+    let id = APP.conference.getMyUserId();
283 283
     Toolbar.updateRoomUrl(window.location.href);
284 284
 
285 285
     // Add myself to the contact list.

+ 1
- 1
modules/UI/audio_levels/AudioLevels.js View File

@@ -209,7 +209,7 @@ const AudioLevels = {
209 209
         drawContext.drawImage(canvasCache, 0, 0);
210 210
 
211 211
         if (id === LOCAL_LEVEL) {
212
-            id = APP.conference.localId;
212
+            id = APP.conference.getMyUserId();
213 213
             if (!id) {
214 214
                 return;
215 215
             }

+ 1
- 1
modules/UI/recording/Recording.js View File

@@ -245,7 +245,7 @@ var Recording = {
245 245
         // everyone.
246 246
         if (config.iAmRecorder) {
247 247
             VideoLayout.enableDeviceAvailabilityIcons(
248
-                APP.conference.localId, false);
248
+                APP.conference.getMyUserId(), false);
249 249
             VideoLayout.setLocalVideoVisible(false);
250 250
             Feedback.enableFeedback(false);
251 251
             Toolbar.enable(false);

+ 0
- 2
modules/UI/shared_video/SharedVideo.js View File

@@ -639,7 +639,6 @@ SharedVideoThumb.prototype.createContainer = function (spanId) {
639 639
 
640 640
     // add the avatar
641 641
     var avatar = document.createElement('img');
642
-    avatar.id = 'avatar_' + this.id;
643 642
     avatar.className = 'sharedVideoAvatar';
644 643
     avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";
645 644
     container.appendChild(avatar);
@@ -822,4 +821,3 @@ function requestVideoLink() {
822 821
 
823 822
     });
824 823
 }
825
-

+ 1
- 1
modules/UI/side_pannels/contactlist/ContactList.js View File

@@ -156,7 +156,7 @@ var ContactList = {
156 156
         if(!displayName)
157 157
             return;
158 158
         if (id === 'localVideoContainer') {
159
-            id = APP.conference.localId;
159
+            id = APP.conference.getMyUserId();
160 160
         }
161 161
         let contactName = $(`#contacts #${id}>p`);
162 162
 

+ 1
- 1
modules/UI/videolayout/LargeVideo.js View File

@@ -21,7 +21,7 @@ function getStreamOwnerId(stream) {
21 21
         return;
22 22
     }
23 23
     if (stream.isLocal()) { // local stream doesn't have method "getParticipantId"
24
-        return APP.conference.localId;
24
+        return APP.conference.getMyUserId();
25 25
     } else {
26 26
         return stream.getParticipantId();
27 27
     }

+ 1
- 1
modules/UI/videolayout/LocalVideo.js View File

@@ -18,7 +18,7 @@ function LocalVideo(VideoLayout, emitter) {
18 18
     this.emitter = emitter;
19 19
     Object.defineProperty(this, 'id', {
20 20
         get: function () {
21
-            return APP.conference.localId;
21
+            return APP.conference.getMyUserId();
22 22
         }
23 23
     });
24 24
     SmallVideo.call(this, VideoLayout);

+ 9
- 6
modules/UI/videolayout/SmallVideo.js View File

@@ -299,9 +299,6 @@ SmallVideo.prototype.updateIconPositions = function () {
299 299
 
300 300
 /**
301 301
  * Creates the element indicating the moderator(owner) of the conference.
302
- *
303
- * @param parentElement the parent element where the owner indicator will
304
- * be added
305 302
  */
306 303
 SmallVideo.prototype.createModeratorIndicatorElement = function () {
307 304
     // Show moderator indicator
@@ -329,6 +326,13 @@ SmallVideo.prototype.createModeratorIndicatorElement = function () {
329 326
     APP.translation.translateElement($('#' + this.videoSpanId + ' .focusindicator'));
330 327
 };
331 328
 
329
+/**
330
+ * Removes the element indicating the moderator(owner) of the conference.
331
+ */
332
+SmallVideo.prototype.removeModeratorIndicatorElement = function () {
333
+    $('#' + this.videoSpanId + ' .focusindicator').remove();
334
+};
335
+
332 336
 SmallVideo.prototype.selectVideoElement = function () {
333 337
     return $(RTCUIHelper.findVideoElement($('#' + this.videoSpanId)[0]));
334 338
 };
@@ -376,7 +380,7 @@ SmallVideo.prototype.updateView = function () {
376 380
 
377 381
     let video = this.selectVideoElement();
378 382
 
379
-    let avatar = $(`#avatar_${this.id}`);
383
+    let avatar = $('#' + this.videoSpanId + ' .userAvatar');
380 384
 
381 385
     var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id);
382 386
 
@@ -404,7 +408,7 @@ SmallVideo.prototype.updateView = function () {
404 408
 
405 409
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {
406 410
     var thumbnail = $('#' + this.videoSpanId);
407
-    var avatar = $('#avatar_' + this.id);
411
+    var avatar = $('#' + this.videoSpanId + ' .userAvatar');
408 412
     this.hasAvatar = true;
409 413
 
410 414
     // set the avatar in the thumbnail
@@ -413,7 +417,6 @@ SmallVideo.prototype.avatarChanged = function (avatarUrl) {
413 417
     } else {
414 418
         if (thumbnail && thumbnail.length > 0) {
415 419
             avatar = document.createElement('img');
416
-            avatar.id = 'avatar_' + this.id;
417 420
             avatar.className = 'userAvatar';
418 421
             avatar.src = avatarUrl;
419 422
             thumbnail.append(avatar);

+ 6
- 4
modules/UI/videolayout/VideoLayout.js View File

@@ -162,7 +162,7 @@ var VideoLayout = {
162 162
         localVideoThumbnail.setDisplayName();
163 163
         localVideoThumbnail.createConnectionIndicator();
164 164
 
165
-        let localId = APP.conference.localId;
165
+        let localId = APP.conference.getMyUserId();
166 166
         this.onVideoTypeChanged(localId, stream.videoType);
167 167
 
168 168
         let {thumbWidth, thumbHeight} = this.resizeThumbnails(false, true);
@@ -186,7 +186,7 @@ var VideoLayout = {
186 186
      */
187 187
     mucJoined () {
188 188
         if (largeVideo && !largeVideo.id) {
189
-            this.updateLargeVideo(APP.conference.localId, true);
189
+            this.updateLargeVideo(APP.conference.getMyUserId(), true);
190 190
         }
191 191
     },
192 192
 
@@ -290,7 +290,7 @@ var VideoLayout = {
290 290
         // Go with local video
291 291
         console.info("Fallback to local video...");
292 292
 
293
-        let id = APP.conference.localId;
293
+        let id = APP.conference.getMyUserId();
294 294
         console.info("electLastVisibleVideo: " + id);
295 295
 
296 296
         return id;
@@ -457,6 +457,8 @@ var VideoLayout = {
457 457
         let isModerator = APP.conference.isModerator;
458 458
         if (isModerator) {
459 459
             localVideoThumbnail.createModeratorIndicatorElement();
460
+        } else {
461
+            localVideoThumbnail.removeModeratorIndicatorElement();
460 462
         }
461 463
 
462 464
         APP.conference.listMembers().forEach(function (member) {
@@ -775,7 +777,7 @@ var VideoLayout = {
775 777
     updateLocalConnectionStats (percent, object) {
776 778
         let resolutions = object.resolution;
777 779
 
778
-        object.resolution = resolutions[APP.conference.localId];
780
+        object.resolution = resolutions[APP.conference.getMyUserId()];
779 781
         localVideoThumbnail.updateStatsIndicator(percent, object);
780 782
 
781 783
         Object.keys(resolutions).forEach(function (id) {

Loading…
Cancel
Save