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

This commit is contained in:
paweldomas 2015-07-29 18:41:22 +02:00
parent baee96734c
commit f2bd76ac93
2 changed files with 17 additions and 19 deletions

View File

@ -147,22 +147,19 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
select.removed = true; select.removed = true;
select.remove(); select.remove();
var audioCount = $('#' + this.videoSpanId + '>audio').length; if (isVideo)
var videoCount = $('#' + this.videoSpanId + '>' + APP.RTC.getVideoElementName()).length; this.VideoLayout.updateRemovedVideo(this.getResourceJid());
};
if (!audioCount && !videoCount) { /**
console.log("Remove whole user", this.videoSpanId); * Removes RemoteVideo from the page.
if(this.connectionIndicator) */
this.connectionIndicator.remove(); RemoteVideo.prototype.remove = function () {
console.log("Remove thumbnail", this.peerJid);
this.removeConnectionIndicator();
// Remove whole container // Remove whole container
if (this.container.parentNode) if (this.container.parentNode)
this.container.parentNode.removeChild(this.container); this.container.parentNode.removeChild(this.container);
this.VideoLayout.resizeThumbnails();
}
if (isVideo)
this.VideoLayout.updateRemovedVideo(this.getResourceJid());
}; };
RemoteVideo.prototype.waitForPlayback = function (sel, stream) { RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
@ -302,12 +299,12 @@ RemoteVideo.prototype.showPeerContainer = function (state) {
RemoteVideo.prototype.removeConnectionIndicator = function () { RemoteVideo.prototype.removeConnectionIndicator = function () {
if (this.connectionIndicator) if (this.connectionIndicator)
this.connectionIndicator.remove(); this.connectionIndicator.remove();
} };
RemoteVideo.prototype.hideConnectionIndicator = function () { RemoteVideo.prototype.hideConnectionIndicator = function () {
if (this.connectionIndicator) if (this.connectionIndicator)
this.connectionIndicator.hide(); this.connectionIndicator.hide();
} };
/** /**
* Updates the remote video menu. * Updates the remote video menu.

View File

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