Browse Source

Changes active speaker indication by only adding greyscale filter. Makes sure the display name is visible on rollover event before the video is available.

master
yanas 11 years ago
parent
commit
f53bb6d8c6
3 changed files with 35 additions and 55 deletions
  1. 18
    8
      app.js
  2. 7
    4
      css/videolayout_default.css
  3. 10
    43
      videolayout.js

+ 18
- 8
app.js View File

@@ -244,7 +244,9 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
244 244
                 'participant_' + Strophe.getResourceFromJid(data.peerjid));
245 245
     } else {
246 246
         if (data.stream.id !== 'mixedmslabel') {
247
-            console.error('can not associate stream', data.stream.id, 'with a participant');
247
+            console.error(  'can not associate stream',
248
+                            data.stream.id,
249
+                            'with a participant');
248 250
             // We don't want to add it here since it will cause troubles
249 251
             return;
250 252
         }
@@ -304,14 +306,22 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
304 306
         VideoLayout.handleVideoThumbClicked(vid.src);
305 307
     });
306 308
     // Add hover handler
307
-    sel.hover(
308
-            function() {
309
-                VideoLayout.showDisplayName(container.id, true);
310
-            },
311
-            function() {
312
-                if (focusedVideoSrc !== vid.src)
313
-                    VideoLayout.showDisplayName(container.id, false);
309
+    $(container).hover(
310
+        function() {
311
+            VideoLayout.showDisplayName(container.id, true);
312
+        },
313
+        function() {
314
+            var videoSrc = null;
315
+            if ($('#' + container.id + '>video')
316
+                    && $('#' + container.id + '>video').length > 0) {
317
+                videoSrc = $('#' + container.id + '>video').get(0).src;
314 318
             }
319
+
320
+            // If the video has been "pinned" by the user we want to keep the
321
+            // display name on place.
322
+            if (focusedVideoSrc !== videoSrc)
323
+                VideoLayout.showDisplayName(container.id, false);
324
+        }
315 325
     );
316 326
 
317 327
     // an attempt to work around https://github.com/jitsi/jitmeet/issues/32

+ 7
- 4
css/videolayout_default.css View File

@@ -60,8 +60,7 @@
60 60
     border: 0px !important;
61 61
 }
62 62
 
63
-#remoteVideos .videocontainer>video,
64
-#remoteVideos .videocontainer>canvas {
63
+#remoteVideos .videocontainer>video {
65 64
     border-radius:4px;
66 65
 }
67 66
 
@@ -86,8 +85,7 @@
86 85
 #etherpad,
87 86
 #localVideoWrapper>video,
88 87
 #localVideoWrapper,
89
-.videocontainer>video,
90
-.videocontainer>canvas {
88
+.videocontainer>video {
91 89
     position: absolute;
92 90
     left: 0;
93 91
     top: 0;
@@ -96,6 +94,11 @@
96 94
     height: 100%;
97 95
 }
98 96
 
97
+.activespeaker {
98
+    -webkit-filter: grayscale(1) brightness(2);
99
+    filter: grayscale(1) brightness(2);
100
+}
101
+
99 102
 #etherpad,
100 103
 #presentation {
101 104
     text-align: center;

+ 10
- 43
videolayout.js View File

@@ -552,54 +552,21 @@ var VideoLayout = (function (my) {
552 552
         else if (resourceJid === currentActiveSpeaker)
553 553
             currentActiveSpeaker = null;
554 554
 
555
-        var activeSpeakerCanvas = $('#' + videoSpanId + '>canvas');
556
-        var videoElement = $('#' + videoSpanId + '>video');
557
-        var canvasSize = calculateThumbnailSize();
558
-
559
-        if (isEnable && (!activeSpeakerCanvas
560
-                    || activeSpeakerCanvas.length === 0)) {
561
-
562
-              activeSpeakerCanvas = document.createElement('canvas');
563
-              activeSpeakerCanvas.width = canvasSize[0];
564
-              activeSpeakerCanvas.height = canvasSize[1];
565
-
566
-              // We flip the canvas image if this is the local video.
567
-              if (videoSpanId === 'localVideoWrapper')
568
-                  activeSpeakerCanvas.className += " flipVideoX";
569
-
570
-              videoSpan.appendChild(activeSpeakerCanvas);
571
-              activeSpeakerCanvas.addEventListener(
572
-                      'click',
573
-                      function() {
574
-                          VideoLayout.handleVideoThumbClicked(
575
-                                  videoElement.get(0).src);
576
-                      }, false);
577
-        }
578
-        else {
579
-            activeSpeakerCanvas = activeSpeakerCanvas.get(0);
580
-        }
555
+        var video = $('#' + videoSpanId + '>video');
581 556
 
582
-        if (videoElement && videoElement.length > 0) {
583
-            var video = document.getElementById(videoElement.get(0).id);
557
+        if (video && video.length > 0) {
558
+            var videoElement = video.get(0);
584 559
             if (isEnable) {
585
-                var context = activeSpeakerCanvas.getContext('2d');
560
+                if (!videoElement.classList.contains("activespeaker"))
561
+                    videoElement.classList.add("activespeaker");
586 562
 
587
-                context.fillRect(0, 0, canvasSize[0], canvasSize[1]);
588
-                context.drawImage(video, 0, 0, canvasSize[0], canvasSize[1]);
589
-                Util.imageToGrayScale(activeSpeakerCanvas);
590
-
591
-                VideoLayout
592
-                    .showDisplayName(videoSpanId, true);
593
-                activeSpeakerCanvas
594
-                    .setAttribute('style', 'display:block !important;');
595
-                video.setAttribute('style', 'display:none !important;');
563
+                VideoLayout.showDisplayName(videoSpanId, true);
596 564
             }
597 565
             else {
598
-                VideoLayout
599
-                    .showDisplayName(videoSpanId, false);
600
-                video.setAttribute('style', 'display:block !important;');
601
-                activeSpeakerCanvas
602
-                    .setAttribute('style', 'display:none !important;');
566
+                VideoLayout.showDisplayName(videoSpanId, false);
567
+
568
+                if (videoElement.classList.contains("activespeaker"))
569
+                    videoElement.classList.remove("activespeaker");
603 570
             }
604 571
         }
605 572
     };

Loading…
Cancel
Save