瀏覽代碼

Makes video screen fit configurable.

j8
Yana Stamcheva 9 年之前
父節點
當前提交
8a678286f7
共有 2 個檔案被更改,包括 23 行新增7 行删除
  1. 1
    0
      interface_config.js
  2. 22
    7
      modules/UI/videolayout/LargeVideo.js

+ 1
- 0
interface_config.js 查看文件

@@ -20,6 +20,7 @@ var interfaceConfig = {
20 20
         'recording', 'security', 'invite', 'chat', 'prezi', 'etherpad',
21 21
         'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip',
22 22
         'contacts'],
23
+    VIDEO_LAYOUT_FIT: 'both', // height, width, both
23 24
     /**
24 25
      * Whether to only show the filmstrip (and hide the toolbar).
25 26
      */

+ 22
- 7
modules/UI/videolayout/LargeVideo.js 查看文件

@@ -189,6 +189,7 @@ function getCameraVideoSize(videoWidth,
189 189
                             videoHeight,
190 190
                             videoSpaceWidth,
191 191
                             videoSpaceHeight) {
192
+
192 193
     if (!videoWidth)
193 194
         videoWidth = currentVideoWidth;
194 195
     if (!videoHeight)
@@ -196,18 +197,32 @@ function getCameraVideoSize(videoWidth,
196 197
 
197 198
     var aspectRatio = videoWidth / videoHeight;
198 199
 
199
-    var availableWidth = Math.max(videoWidth, videoSpaceWidth);
200
-    var availableHeight = Math.max(videoHeight, videoSpaceHeight);
200
+    var availableWidth = videoWidth;
201
+    var availableHeight = videoHeight;
201 202
 
202
-    if (availableWidth / aspectRatio < videoSpaceHeight) {
203
+    if (interfaceConfig.VIDEO_LAYOUT_FIT == 'height') {
203 204
         availableHeight = videoSpaceHeight;
204
-        availableWidth = availableHeight * aspectRatio;
205
+        availableWidth = availableHeight*aspectRatio;
205 206
     }
206
-
207
-    if (availableHeight * aspectRatio < videoSpaceWidth) {
207
+    else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'width') {
208 208
         availableWidth = videoSpaceWidth;
209
-        availableHeight = availableWidth / aspectRatio;
209
+        availableHeight = availableWidth/aspectRatio;
210 210
     }
211
+    else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'both') {
212
+        availableWidth = Math.max(videoWidth, videoSpaceWidth);
213
+        availableHeight = Math.max(videoHeight, videoSpaceHeight);
214
+
215
+        if (availableWidth / aspectRatio < videoSpaceHeight) {
216
+            availableHeight = videoSpaceHeight;
217
+            availableWidth = availableHeight * aspectRatio;
218
+        }
219
+
220
+        if (availableHeight * aspectRatio < videoSpaceWidth) {
221
+            availableWidth = videoSpaceWidth;
222
+            availableHeight = availableWidth / aspectRatio;
223
+        }
224
+    }
225
+
211 226
 
212 227
     return [availableWidth, availableHeight];
213 228
 }

Loading…
取消
儲存