Browse Source

Fixes issue with video thumbnail not being removed for users without camera and mic.

master
paweldomas 10 years ago
parent
commit
f2bd76ac93
2 changed files with 17 additions and 19 deletions
  1. 15
    18
      modules/UI/videolayout/RemoteVideo.js
  2. 2
    1
      modules/UI/videolayout/VideoLayout.js

+ 15
- 18
modules/UI/videolayout/RemoteVideo.js View File

@@ -147,24 +147,21 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
147 147
     select.removed = true;
148 148
     select.remove();
149 149
 
150
-    var audioCount = $('#' + this.videoSpanId + '>audio').length;
151
-    var videoCount = $('#' + this.videoSpanId + '>' + APP.RTC.getVideoElementName()).length;
152
-
153
-    if (!audioCount && !videoCount) {
154
-        console.log("Remove whole user", this.videoSpanId);
155
-        if(this.connectionIndicator)
156
-            this.connectionIndicator.remove();
157
-        // Remove whole container
158
-        if (this.container.parentNode)
159
-            this.container.parentNode.removeChild(this.container);
160
-
161
-        this.VideoLayout.resizeThumbnails();
162
-    }
163
-
164 150
     if (isVideo)
165 151
         this.VideoLayout.updateRemovedVideo(this.getResourceJid());
166 152
 };
167 153
 
154
+/**
155
+ * Removes RemoteVideo from the page.
156
+ */
157
+RemoteVideo.prototype.remove = function () {
158
+    console.log("Remove thumbnail", this.peerJid);
159
+    this.removeConnectionIndicator();
160
+    // Remove whole container
161
+    if (this.container.parentNode)
162
+        this.container.parentNode.removeChild(this.container);
163
+};
164
+
168 165
 RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
169 166
 
170 167
     var isVideo = stream.getVideoTracks().length > 0;
@@ -300,14 +297,14 @@ RemoteVideo.prototype.showPeerContainer = function (state) {
300 297
 };
301 298
 
302 299
 RemoteVideo.prototype.removeConnectionIndicator = function () {
303
-    if(this.connectionIndicator)
300
+    if (this.connectionIndicator)
304 301
         this.connectionIndicator.remove();
305
-}
302
+};
306 303
 
307 304
 RemoteVideo.prototype.hideConnectionIndicator = function () {
308
-    if(this.connectionIndicator)
305
+    if (this.connectionIndicator)
309 306
         this.connectionIndicator.hide();
310
-}
307
+};
311 308
 
312 309
 /**
313 310
  * Updates the remote video menu.

+ 2
- 1
modules/UI/videolayout/VideoLayout.js View File

@@ -821,8 +821,9 @@ var VideoLayout = (function (my) {
821 821
 
822 822
         var remoteVideo = remoteVideos[resourceJid];
823 823
         if (remoteVideo) {
824
-            remoteVideo.removeConnectionIndicator();
825 824
             // Remove remote video
825
+            console.info("Removing remote video: " + resourceJid);
826
+            remoteVideo.remove();
826 827
             delete remoteVideos[resourceJid];
827 828
         } else {
828 829
             console.warn("No remote video for " + resourceJid);

Loading…
Cancel
Save