Ver código fonte

Implements conference reload support

j8
hristoterezov 8 anos atrás
pai
commit
7bf9a82f0b

+ 9
- 8
conference.js Ver arquivo

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

+ 2
- 2
modules/UI/UI.js Ver arquivo

272
  * Sets the local "raised hand" status.
272
  * Sets the local "raised hand" status.
273
  */
273
  */
274
 UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
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
  * Initialize conference UI.
279
  * Initialize conference UI.
280
  */
280
  */
281
 UI.initConference = function () {
281
 UI.initConference = function () {
282
-    let id = APP.conference.localId;
282
+    let id = APP.conference.getMyUserId();
283
     Toolbar.updateRoomUrl(window.location.href);
283
     Toolbar.updateRoomUrl(window.location.href);
284
 
284
 
285
     // Add myself to the contact list.
285
     // Add myself to the contact list.

+ 1
- 1
modules/UI/audio_levels/AudioLevels.js Ver arquivo

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

+ 1
- 1
modules/UI/recording/Recording.js Ver arquivo

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

+ 0
- 2
modules/UI/shared_video/SharedVideo.js Ver arquivo

639
 
639
 
640
     // add the avatar
640
     // add the avatar
641
     var avatar = document.createElement('img');
641
     var avatar = document.createElement('img');
642
-    avatar.id = 'avatar_' + this.id;
643
     avatar.className = 'sharedVideoAvatar';
642
     avatar.className = 'sharedVideoAvatar';
644
     avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";
643
     avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";
645
     container.appendChild(avatar);
644
     container.appendChild(avatar);
822
 
821
 
823
     });
822
     });
824
 }
823
 }
825
-

+ 1
- 1
modules/UI/side_pannels/contactlist/ContactList.js Ver arquivo

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

+ 1
- 1
modules/UI/videolayout/LargeVideo.js Ver arquivo

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

+ 1
- 1
modules/UI/videolayout/LocalVideo.js Ver arquivo

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

+ 9
- 6
modules/UI/videolayout/SmallVideo.js Ver arquivo

299
 
299
 
300
 /**
300
 /**
301
  * Creates the element indicating the moderator(owner) of the conference.
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
 SmallVideo.prototype.createModeratorIndicatorElement = function () {
303
 SmallVideo.prototype.createModeratorIndicatorElement = function () {
307
     // Show moderator indicator
304
     // Show moderator indicator
329
     APP.translation.translateElement($('#' + this.videoSpanId + ' .focusindicator'));
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
 SmallVideo.prototype.selectVideoElement = function () {
336
 SmallVideo.prototype.selectVideoElement = function () {
333
     return $(RTCUIHelper.findVideoElement($('#' + this.videoSpanId)[0]));
337
     return $(RTCUIHelper.findVideoElement($('#' + this.videoSpanId)[0]));
334
 };
338
 };
376
 
380
 
377
     let video = this.selectVideoElement();
381
     let video = this.selectVideoElement();
378
 
382
 
379
-    let avatar = $(`#avatar_${this.id}`);
383
+    let avatar = $('#' + this.videoSpanId + ' .userAvatar');
380
 
384
 
381
     var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id);
385
     var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id);
382
 
386
 
404
 
408
 
405
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {
409
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {
406
     var thumbnail = $('#' + this.videoSpanId);
410
     var thumbnail = $('#' + this.videoSpanId);
407
-    var avatar = $('#avatar_' + this.id);
411
+    var avatar = $('#' + this.videoSpanId + ' .userAvatar');
408
     this.hasAvatar = true;
412
     this.hasAvatar = true;
409
 
413
 
410
     // set the avatar in the thumbnail
414
     // set the avatar in the thumbnail
413
     } else {
417
     } else {
414
         if (thumbnail && thumbnail.length > 0) {
418
         if (thumbnail && thumbnail.length > 0) {
415
             avatar = document.createElement('img');
419
             avatar = document.createElement('img');
416
-            avatar.id = 'avatar_' + this.id;
417
             avatar.className = 'userAvatar';
420
             avatar.className = 'userAvatar';
418
             avatar.src = avatarUrl;
421
             avatar.src = avatarUrl;
419
             thumbnail.append(avatar);
422
             thumbnail.append(avatar);

+ 6
- 4
modules/UI/videolayout/VideoLayout.js Ver arquivo

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

Carregando…
Cancelar
Salvar