Browse Source

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

j8
George Politis 10 years ago
parent
commit
a8909028c8
2 changed files with 22 additions and 4 deletions
  1. 10
    1
      avatar.js
  2. 12
    3
      videolayout.js

+ 10
- 1
avatar.js View File

122
     }
122
     }
123
 
123
 
124
     function isUserMuted(jid) {
124
     function isUserMuted(jid) {
125
-        if(!mediaStreams[jid] || !mediaStreams[jid][MediaStream.VIDEO_TYPE]) {
125
+        // XXX(gp) we may want to rename this method to something like
126
+        // isUserStreaming, for example.
127
+        if (jid && jid != connection.emuc.myroomjid) {
128
+            var resource = Strophe.getResourceFromJid(jid);
129
+            if (!VideoLayout.isInLastN(resource)) {
130
+                return true;
131
+            }
132
+        }
133
+
134
+        if (!mediaStreams[jid] || !mediaStreams[jid][MediaStream.VIDEO_TYPE]) {
126
             return null;
135
             return null;
127
         }
136
         }
128
         return mediaStreams[jid][MediaStream.VIDEO_TYPE].muted;
137
         return mediaStreams[jid][MediaStream.VIDEO_TYPE].muted;

+ 12
- 3
videolayout.js View File

11
     };
11
     };
12
     my.connectionIndicators = {};
12
     my.connectionIndicators = {};
13
 
13
 
14
+    my.isInLastN = function(resource) {
15
+        return lastNCount < 0 // lastN is disabled, return true
16
+            || (lastNCount > 0 && lastNEndpointsCache.length == 0) // lastNEndpoints cache not built yet, return true
17
+            || (lastNEndpointsCache && lastNEndpointsCache.indexOf(resource) !== -1);
18
+    };
19
+
14
     my.changeLocalAudio = function(stream) {
20
     my.changeLocalAudio = function(stream) {
15
         connection.jingle.localAudio = stream;
21
         connection.jingle.localAudio = stream;
16
 
22
 
597
                 peerContainer.show();
603
                 peerContainer.show();
598
             }
604
             }
599
 
605
 
600
-            // TODO(gp) add proper avatars handling.
601
             if (state == 'show')
606
             if (state == 'show')
602
             {
607
             {
603
-                peerContainer.css('-webkit-filter', '');
608
+                // peerContainer.css('-webkit-filter', '');
609
+                var jid = connection.emuc.findJidFromResource(resourceJid);
610
+                Avatar.showUserAvatar(jid, false);
604
             }
611
             }
605
             else // if (state == 'avatar')
612
             else // if (state == 'avatar')
606
             {
613
             {
607
-                peerContainer.css('-webkit-filter', 'grayscale(100%)');
614
+                // peerContainer.css('-webkit-filter', 'grayscale(100%)');
615
+                var jid = connection.emuc.findJidFromResource(resourceJid);
616
+                Avatar.showUserAvatar(jid, true);
608
             }
617
             }
609
         }
618
         }
610
         else if (peerContainer.is(':visible') && isHide)
619
         else if (peerContainer.is(':visible') && isHide)

Loading…
Cancel
Save