Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Modifies the avatars, lastN and adaptive lastN handling so that they play nicely together.

George Politisa8909028c854
diff --git a/avatar.js b/avatar.js
index 3a18edb9db..2888f44ae3 100644
--- a/avatar.js
+++ b/avatar.js
@@ -122,7 +122,16 @@ var Avatar = (function(my) {
}
function isUserMuted(jid) {
- if(!mediaStreams[jid] || !mediaStreams[jid][MediaStream.VIDEO_TYPE]) {
+ // XXX(gp) we may want to rename this method to something like
+ // isUserStreaming, for example.
+ if (jid && jid != connection.emuc.myroomjid) {
+ var resource = Strophe.getResourceFromJid(jid);
+ if (!VideoLayout.isInLastN(resource)) {
+ return true;
+ }
+ }
+
+ if (!mediaStreams[jid] || !mediaStreams[jid][MediaStream.VIDEO_TYPE]) {
return null;
}
return mediaStreams[jid][MediaStream.VIDEO_TYPE].muted;
diff --git a/videolayout.js b/videolayout.js
index c2ac6ff5f5..e6915be0d8 100644
--- a/videolayout.js
+++ b/videolayout.js
@@ -11,6 +11,12 @@ var VideoLayout = (function (my) {
};
my.connectionIndicators = {};
+ my.isInLastN = function(resource) {
+ return lastNCount < 0 // lastN is disabled, return true
+ || (lastNCount > 0 && lastNEndpointsCache.length == 0) // lastNEndpoints cache not built yet, return true
+ || (lastNEndpointsCache && lastNEndpointsCache.indexOf(resource) !== -1);
+ };
+
my.changeLocalAudio = function(stream) {
connection.jingle.localAudio = stream;
@@ -597,14 +603,17 @@ var VideoLayout = (function (my) {
peerContainer.show();
}
- // TODO(gp) add proper avatars handling.
if (state == 'show')
{
- peerContainer.css('-webkit-filter', '');
+ // peerContainer.css('-webkit-filter', '');
+ var jid = connection.emuc.findJidFromResource(resourceJid);
+ Avatar.showUserAvatar(jid, false);
}
else // if (state == 'avatar')
{
- peerContainer.css('-webkit-filter', 'grayscale(100%)');
+ // peerContainer.css('-webkit-filter', 'grayscale(100%)');
+ var jid = connection.emuc.findJidFromResource(resourceJid);
+ Avatar.showUserAvatar(jid, true);
}
}
else if (peerContainer.is(':visible') && isHide)