Преглед изворни кода

Makes video screen fit configurable.

master
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
         'recording', 'security', 'invite', 'chat', 'prezi', 'etherpad',
20
         'recording', 'security', 'invite', 'chat', 'prezi', 'etherpad',
21
         'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip',
21
         'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip',
22
         'contacts'],
22
         'contacts'],
23
+    VIDEO_LAYOUT_FIT: 'both', // height, width, both
23
     /**
24
     /**
24
      * Whether to only show the filmstrip (and hide the toolbar).
25
      * Whether to only show the filmstrip (and hide the toolbar).
25
      */
26
      */

+ 22
- 7
modules/UI/videolayout/LargeVideo.js Прегледај датотеку

189
                             videoHeight,
189
                             videoHeight,
190
                             videoSpaceWidth,
190
                             videoSpaceWidth,
191
                             videoSpaceHeight) {
191
                             videoSpaceHeight) {
192
+
192
     if (!videoWidth)
193
     if (!videoWidth)
193
         videoWidth = currentVideoWidth;
194
         videoWidth = currentVideoWidth;
194
     if (!videoHeight)
195
     if (!videoHeight)
196
 
197
 
197
     var aspectRatio = videoWidth / videoHeight;
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
         availableHeight = videoSpaceHeight;
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
         availableWidth = videoSpaceWidth;
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
     return [availableWidth, availableHeight];
227
     return [availableWidth, availableHeight];
213
 }
228
 }

Loading…
Откажи
Сачувај