瀏覽代碼

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
         if (unreadMessages) {
242
         if (unreadMessages) {
243
             unreadMsgElement.innerHTML = unreadMessages.toString();
243
             unreadMsgElement.innerHTML = unreadMessages.toString();
244
 
244
 
245
-            showToolbar();
245
+            Toolbar.showToolbar();
246
 
246
 
247
             var chatButtonElement
247
             var chatButtonElement
248
                 = document.getElementById('chatButton').parentNode;
248
                 = document.getElementById('chatButton').parentNode;

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

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

+ 4
- 1
data_channels.js 查看文件

38
 
38
 
39
             var container  = document.getElementById(
39
             var container  = document.getElementById(
40
                 'participant_' + endpointId);
40
                 'participant_' + endpointId);
41
+
41
             // Local video will not have container found, but that's ok
42
             // Local video will not have container found, but that's ok
42
             // since we don't want to switch to local video
43
             // since we don't want to switch to local video
44
+
43
             if (container)
45
             if (container)
44
             {
46
             {
45
                 var video = container.getElementsByTagName("video");
47
                 var video = container.getElementsByTagName("video");
46
                 if (video.length)
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
-/* global $, config, connection, chrome, alert, getUserMediaWithConstraints, change_local_video, getConferenceHandler */
1
+/* global $, config, connection, chrome, alert, getUserMediaWithConstraints, changeLocalVideo, getConferenceHandler */
2
 /**
2
 /**
3
  * Indicates that desktop stream is currently in use(for toggle purpose).
3
  * Indicates that desktop stream is currently in use(for toggle purpose).
4
  * @type {boolean}
4
  * @type {boolean}
251
 
251
 
252
     var oldStream = connection.jingle.localVideo;
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
     var conferenceHandler = getConferenceHandler();
258
     var conferenceHandler = getConferenceHandler();
257
     if (conferenceHandler) {
259
     if (conferenceHandler) {

+ 4
- 4
etherpad.js 查看文件

45
                 if (Prezi.isPresentationVisible()) {
45
                 if (Prezi.isPresentationVisible()) {
46
                     largeVideo.css({opacity: '0'});
46
                     largeVideo.css({opacity: '0'});
47
                 } else {
47
                 } else {
48
-                    setLargeVideoVisible(false);
49
-                    dockToolbar(true);
48
+                    VideoLayout.setLargeVideoVisible(false);
49
+                    Toolbar.dockToolbar(true);
50
                 }
50
                 }
51
 
51
 
52
                 $('#etherpad>iframe').fadeIn(300, function () {
52
                 $('#etherpad>iframe').fadeIn(300, function () {
63
                 document.body.style.background = 'black';
63
                 document.body.style.background = 'black';
64
                 if (!isPresentation) {
64
                 if (!isPresentation) {
65
                     $('#largeVideo').fadeIn(300, function () {
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
     <script src="moderatemuc.js?v=1"></script><!-- moderator plugin -->
35
     <script src="moderatemuc.js?v=1"></script><!-- moderator plugin -->
36
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
36
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
37
     <script src="rtp_stats.js?v=1"></script><!-- RTP stats processing -->
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
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
40
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
39
     <link rel="stylesheet" href="css/font.css"/>
41
     <link rel="stylesheet" href="css/font.css"/>
40
     <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=20"/>
42
     <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=20"/>
78
                 <a class="button" onclick="toggleScreenSharing();" title="Share screen"><i class="icon-share-desktop"></i></a>
80
                 <a class="button" onclick="toggleScreenSharing();" title="Share screen"><i class="icon-share-desktop"></i></a>
79
                 <div class="header_button_separator"></div>
81
                 <div class="header_button_separator"></div>
80
             </span>
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
         </span>
84
         </span>
83
     </div>
85
     </div>
84
     <div id="settings">
86
     <div id="settings">
91
       </form>
93
       </form>
92
     </div>
94
     </div>
93
     <div id="reloadPresentation"><a onclick='Prezi.reloadPresentation();'><i title="Reload Prezi" class="fa fa-repeat fa-lg"></i></a></div>
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
         <div id="largeVideoContainer" class="videocontainer">
97
         <div id="largeVideoContainer" class="videocontainer">
96
             <div id="presentation"></div>
98
             <div id="presentation"></div>
97
             <div id="etherpad"></div>
99
             <div id="etherpad"></div>

+ 6
- 6
prezi.js 查看文件

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

+ 19
- 1
util.js 查看文件

51
      * Returns the available video width.
51
      * Returns the available video width.
52
      */
52
      */
53
     my.getAvailableVideoWidth = function () {
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
         return window.innerWidth - chatspaceWidth;
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
     return my;
77
     return my;
60
 }(Util || {}));
78
 }(Util || {}));

Loading…
取消
儲存