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

This commit is contained in:
George Politis 2014-11-27 19:28:28 +01:00
parent 5b9b45c91b
commit a8909028c8
2 changed files with 22 additions and 4 deletions

View File

@ -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;

View File

@ -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)