瀏覽代碼

Part 2 of previous commit. Makes the toolbar more visible. Moves toolbar and videolayout related code in separate classes.

master
yanas 11 年之前
父節點
當前提交
7b6443969e
共有 9 個檔案被更改,包括 113 行新增1021 行删除
  1. 51
    984
      app.js
  2. 1
    1
      chat.js
  3. 20
    20
      css/videolayout_default.css
  4. 4
    1
      data_channels.js
  5. 4
    2
      desktopsharing.js
  6. 4
    4
      etherpad.js
  7. 4
    2
      index.html
  8. 6
    6
      prezi.js
  9. 19
    1
      util.js

+ 51
- 984
app.js
文件差異過大導致無法顯示
查看文件


+ 1
- 1
chat.js 查看文件

@@ -242,7 +242,7 @@ var Chat = (function (my) {
242 242
         if (unreadMessages) {
243 243
             unreadMsgElement.innerHTML = unreadMessages.toString();
244 244
 
245
-            showToolbar();
245
+            Toolbar.showToolbar();
246 246
 
247 247
             var chatButtonElement
248 248
                 = document.getElementById('chatButton').parentNode;

+ 20
- 20
css/videolayout_default.css 查看文件

@@ -34,7 +34,8 @@
34 34
     border: 2px solid #212425;
35 35
 }
36 36
 
37
-#remoteVideos .videocontainer:hover {
37
+#remoteVideos .videocontainer:hover,
38
+#remoteVideos .videocontainer.videoContainerFocused {
38 39
     width: 100%;
39 40
     height: 100%;
40 41
     content:"";
@@ -52,10 +53,6 @@
52 53
     z-index: 3;
53 54
 }
54 55
 
55
-#remoteVideos .videocontainer.videoContainerFocused {
56
-    border: 3px solid #388396;
57
-}
58
-
59 56
 #localVideoWrapper {
60 57
     display:inline-block;
61 58
     -webkit-mask-box-image: url(../images/videomask.svg);
@@ -63,7 +60,8 @@
63 60
     border: 0px !important;
64 61
 }
65 62
 
66
-#remoteVideos .videocontainer>video {
63
+#remoteVideos .videocontainer>video,
64
+#remoteVideos .videocontainer>canvas {
67 65
     border-radius:4px;
68 66
 }
69 67
 
@@ -88,7 +86,8 @@
88 86
 #etherpad,
89 87
 #localVideoWrapper>video,
90 88
 #localVideoWrapper,
91
-.videocontainer>video {
89
+.videocontainer>video,
90
+.videocontainer>canvas {
92 91
     position: absolute;
93 92
     left: 0;
94 93
     top: 0;
@@ -137,25 +136,22 @@
137 136
 
138 137
 .videocontainer>span.displayname,
139 138
 .videocontainer>input.displayname {
140
-    display: inline-block;
139
+    display: none;
141 140
     position: absolute;
142
-    background: -webkit-linear-gradient(left, rgba(0,0,0,.7), rgba(0,0,0,0));
143 141
     color: #FFFFFF;
144
-    bottom: 0;
145
-    left: 0;
146
-    padding: 3px 5px;
147
-    width: 100%;
148
-    height: auto;
149
-    max-height: 18px;
150
-    font-size: 9pt;
151
-    text-align: left;
142
+    background: rgba(0,0,0,.7);
143
+    text-align: center;
152 144
     text-overflow: ellipsis;
145
+    width: 70%;
146
+    height: 20%;
147
+    left: 15%;
148
+    top: 40%;
149
+    padding: 5px;
150
+    font-size: 11pt;
153 151
     overflow: hidden;
154 152
     white-space: nowrap;
155 153
     z-index: 2;
156
-    box-sizing: border-box;
157
-    border-bottom-left-radius:4px;
158
-    border-bottom-right-radius:4px;
154
+    border-radius:20px;
159 155
 }
160 156
 
161 157
 #localVideoContainer>span.displayname:hover {
@@ -166,6 +162,10 @@
166 162
     pointer-events: none;
167 163
 }
168 164
 
165
+.videocontainer>input.displayname {
166
+    height: auto;
167
+}
168
+
169 169
 #localDisplayName {
170 170
     pointer-events: auto !important;
171 171
 }

+ 4
- 1
data_channels.js 查看文件

@@ -38,14 +38,17 @@ function onDataChannel(event)
38 38
 
39 39
             var container  = document.getElementById(
40 40
                 'participant_' + endpointId);
41
+
41 42
             // Local video will not have container found, but that's ok
42 43
             // since we don't want to switch to local video
44
+
43 45
             if (container)
44 46
             {
45 47
                 var video = container.getElementsByTagName("video");
46 48
                 if (video.length)
47 49
                 {
48
-                    updateLargeVideo(video[0].src);
50
+                    VideoLayout.updateLargeVideo(video[0].src);
51
+                    VideoLayout.enableActiveSpeaker(endpointId, true);
49 52
                 }
50 53
             }
51 54
         }

+ 4
- 2
desktopsharing.js 查看文件

@@ -1,4 +1,4 @@
1
-/* global $, config, connection, chrome, alert, getUserMediaWithConstraints, change_local_video, getConferenceHandler */
1
+/* global $, config, connection, chrome, alert, getUserMediaWithConstraints, changeLocalVideo, getConferenceHandler */
2 2
 /**
3 3
  * Indicates that desktop stream is currently in use(for toggle purpose).
4 4
  * @type {boolean}
@@ -251,7 +251,9 @@ function newStreamCreated(stream) {
251 251
 
252 252
     var oldStream = connection.jingle.localVideo;
253 253
 
254
-    change_local_video(stream, !isUsingScreenStream);
254
+    connection.jingle.localVideo = stream;
255
+
256
+    VideoLayout.changeLocalVideo(stream, !isUsingScreenStream);
255 257
 
256 258
     var conferenceHandler = getConferenceHandler();
257 259
     if (conferenceHandler) {

+ 4
- 4
etherpad.js 查看文件

@@ -45,8 +45,8 @@ var Etherpad = (function (my) {
45 45
                 if (Prezi.isPresentationVisible()) {
46 46
                     largeVideo.css({opacity: '0'});
47 47
                 } else {
48
-                    setLargeVideoVisible(false);
49
-                    dockToolbar(true);
48
+                    VideoLayout.setLargeVideoVisible(false);
49
+                    Toolbar.dockToolbar(true);
50 50
                 }
51 51
 
52 52
                 $('#etherpad>iframe').fadeIn(300, function () {
@@ -63,8 +63,8 @@ var Etherpad = (function (my) {
63 63
                 document.body.style.background = 'black';
64 64
                 if (!isPresentation) {
65 65
                     $('#largeVideo').fadeIn(300, function () {
66
-                        setLargeVideoVisible(true);
67
-                        dockToolbar(false);
66
+                        VideoLayout.setLargeVideoVisible(true);
67
+                        Toolbar.dockToolbar(false);
68 68
                     });
69 69
                 }
70 70
             });

+ 4
- 2
index.html 查看文件

@@ -35,6 +35,8 @@
35 35
     <script src="moderatemuc.js?v=1"></script><!-- moderator plugin -->
36 36
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
37 37
     <script src="rtp_stats.js?v=1"></script><!-- RTP stats processing -->
38
+    <script src="videolayout.js?v=1"></script><!-- video ui -->
39
+    <script src="toolbar.js?v=1"></script><!-- toolbar ui -->
38 40
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
39 41
     <link rel="stylesheet" href="css/font.css"/>
40 42
     <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=20"/>
@@ -78,7 +80,7 @@
78 80
                 <a class="button" onclick="toggleScreenSharing();" title="Share screen"><i class="icon-share-desktop"></i></a>
79 81
                 <div class="header_button_separator"></div>
80 82
             </span>
81
-            <a class="button" onclick='buttonClick("#fullScreen", "icon-full-screen icon-exit-full-screen");toggleFullScreen();'><i id="fullScreen" title="Enter / Exit Full Screen" class="icon-full-screen"></i></a>
83
+            <a class="button" onclick='buttonClick("#fullScreen", "icon-full-screen icon-exit-full-screen");Toolbar.toggleFullScreen();'><i id="fullScreen" title="Enter / Exit Full Screen" class="icon-full-screen"></i></a>
82 84
         </span>
83 85
     </div>
84 86
     <div id="settings">
@@ -91,7 +93,7 @@
91 93
       </form>
92 94
     </div>
93 95
     <div id="reloadPresentation"><a onclick='Prezi.reloadPresentation();'><i title="Reload Prezi" class="fa fa-repeat fa-lg"></i></a></div>
94
-    <div id="videospace" onmousemove="showToolbar();">
96
+    <div id="videospace" onmousemove="Toolbar.showToolbar();">
95 97
         <div id="largeVideoContainer" class="videocontainer">
96 98
             <div id="presentation"></div>
97 99
             <div id="etherpad"></div>

+ 6
- 6
prezi.js 查看文件

@@ -19,10 +19,10 @@ var Prezi = (function (my) {
19 19
             $(document).trigger("video.selected", [true]);
20 20
 
21 21
             $('#largeVideo').fadeOut(300, function () {
22
-                setLargeVideoVisible(false);
22
+                VideoLayout.setLargeVideoVisible(false);
23 23
                 $('#presentation>iframe').fadeIn(300, function() {
24 24
                     $('#presentation>iframe').css({opacity:'1'});
25
-                    dockToolbar(true);
25
+                    Toolbar.dockToolbar(true);
26 26
                 });
27 27
             });
28 28
         }
@@ -32,8 +32,8 @@ var Prezi = (function (my) {
32 32
                     $('#presentation>iframe').css({opacity:'0'});
33 33
                     $('#reloadPresentation').css({display:'none'});
34 34
                     $('#largeVideo').fadeIn(300, function() {
35
-                        setLargeVideoVisible(true);
36
-                        dockToolbar(false);
35
+                        VideoLayout.setLargeVideoVisible(true);
36
+                        Toolbar.dockToolbar(false);
37 37
                     });
38 38
                 });
39 39
             }
@@ -177,8 +177,8 @@ var Prezi = (function (my) {
177 177
         // We explicitly don't specify the peer jid here, because we don't want
178 178
         // this video to be dealt with as a peer related one (for example we
179 179
         // don't want to show a mute/kick menu for this one, etc.).
180
-        addRemoteVideoContainer(null, elementId);
181
-        resizeThumbnails();
180
+        VideoLayout.addRemoteVideoContainer(null, elementId);
181
+        VideoLayout.resizeThumbnails();
182 182
 
183 183
         var controlsEnabled = false;
184 184
         if (jid === connection.emuc.myroomjid)

+ 19
- 1
util.js 查看文件

@@ -51,10 +51,28 @@ var Util = (function (my) {
51 51
      * Returns the available video width.
52 52
      */
53 53
     my.getAvailableVideoWidth = function () {
54
-        var chatspaceWidth = $('#chatspace').is(":visible") ? $('#chatspace').width() : 0;
54
+        var chatspaceWidth
55
+            = $('#chatspace').is(":visible") ? $('#chatspace').width() : 0;
55 56
 
56 57
         return window.innerWidth - chatspaceWidth;
57 58
     };
58 59
 
60
+    my.imageToGrayScale = function(canvas) {
61
+        var context = canvas.getContext('2d');
62
+        var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
63
+        var pixels  = imgData.data;
64
+
65
+        for (var i = 0, n = pixels.length; i < n; i += 4) {
66
+            var grayscale
67
+                = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
68
+            pixels[i  ] = grayscale;        // red
69
+            pixels[i+1] = grayscale;        // green
70
+            pixels[i+2] = grayscale;        // blue
71
+            // pixels[i+3]              is alpha
72
+        }
73
+        // redraw the image in black & white
74
+        context.putImageData(imgData, 0, 0);
75
+    };
76
+
59 77
     return my;
60 78
 }(Util || {}));

Loading…
取消
儲存