浏览代码

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

master
paweldomas 10 年前
父节点
当前提交
f2bd76ac93
共有 2 个文件被更改,包括 17 次插入19 次删除
  1. 15
    18
      modules/UI/videolayout/RemoteVideo.js
  2. 2
    1
      modules/UI/videolayout/VideoLayout.js

+ 15
- 18
modules/UI/videolayout/RemoteVideo.js 查看文件

147
     select.removed = true;
147
     select.removed = true;
148
     select.remove();
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
     if (isVideo)
150
     if (isVideo)
165
         this.VideoLayout.updateRemovedVideo(this.getResourceJid());
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
 RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
165
 RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
169
 
166
 
170
     var isVideo = stream.getVideoTracks().length > 0;
167
     var isVideo = stream.getVideoTracks().length > 0;
300
 };
297
 };
301
 
298
 
302
 RemoteVideo.prototype.removeConnectionIndicator = function () {
299
 RemoteVideo.prototype.removeConnectionIndicator = function () {
303
-    if(this.connectionIndicator)
300
+    if (this.connectionIndicator)
304
         this.connectionIndicator.remove();
301
         this.connectionIndicator.remove();
305
-}
302
+};
306
 
303
 
307
 RemoteVideo.prototype.hideConnectionIndicator = function () {
304
 RemoteVideo.prototype.hideConnectionIndicator = function () {
308
-    if(this.connectionIndicator)
305
+    if (this.connectionIndicator)
309
         this.connectionIndicator.hide();
306
         this.connectionIndicator.hide();
310
-}
307
+};
311
 
308
 
312
 /**
309
 /**
313
  * Updates the remote video menu.
310
  * Updates the remote video menu.

+ 2
- 1
modules/UI/videolayout/VideoLayout.js 查看文件

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

正在加载...
取消
保存