Przeglądaj źródła

Fixes thumbnail resize and thumbnails going on a second row. Refactors code around the film strip and resize in general.

j8
yanas 9 lat temu
rodzic
commit
30f3da98e5

+ 2
- 1
interface_config.js Wyświetl plik

@@ -29,5 +29,6 @@ var interfaceConfig = {
29 29
      */
30 30
     filmStripOnly: false,
31 31
     RANDOM_AVATAR_URL_PREFIX: false,
32
-    RANDOM_AVATAR_URL_SUFFIX: false
32
+    RANDOM_AVATAR_URL_SUFFIX: false,
33
+    FILM_STRIP_MAX_HEIGHT: 160
33 34
 };

+ 7
- 5
modules/UI/UI.js Wyświetl plik

@@ -16,6 +16,7 @@ import PreziManager from './prezi/Prezi';
16 16
 import EtherpadManager from './etherpad/Etherpad';
17 17
 
18 18
 import VideoLayout from "./videolayout/VideoLayout";
19
+import FilmStrip from "./videolayout/FilmStrip";
19 20
 import SettingsMenu from "./side_pannels/settings/SettingsMenu";
20 21
 import Settings from "./../settings/Settings";
21 22
 import { reload } from '../util/helpers';
@@ -293,7 +294,7 @@ function registerListeners() {
293 294
 function bindEvents() {
294 295
     function onResize() {
295 296
         PanelToggler.resizeChat();
296
-        VideoLayout.resizeLargeVideoContainer(PanelToggler.isVisible());
297
+        VideoLayout.resizeVideoArea(PanelToggler.isVisible());
297 298
     }
298 299
 
299 300
     // Resize and reposition videos in full screen mode.
@@ -335,12 +336,13 @@ UI.start = function () {
335 336
     registerListeners();
336 337
 
337 338
     BottomToolbar.init();
339
+    FilmStrip.init();
338 340
 
339 341
     VideoLayout.init(eventEmitter);
340 342
     if (!interfaceConfig.filmStripOnly) {
341 343
         VideoLayout.initLargeVideo(PanelToggler.isVisible());
342 344
     }
343
-    VideoLayout.resizeLargeVideoContainer(PanelToggler.isVisible(), true);
345
+    VideoLayout.resizeVideoArea(PanelToggler.isVisible(), true, true);
344 346
 
345 347
     ContactList.init(eventEmitter);
346 348
 
@@ -368,9 +370,9 @@ UI.start = function () {
368 370
         });
369 371
     } else {
370 372
         $("#header").css("display", "none");
371
-        $("#bottomToolbar").css("display", "none");
372 373
         $("#downloadlog").css("display", "none");
373
-        BottomToolbar.setupFilmStripOnly();
374
+        BottomToolbar.hide();
375
+        FilmStrip.setupFilmStripOnly();
374 376
         messageHandler.disableNotifications();
375 377
         $('body').popover("disable");
376 378
         JitsiPopover.enabled = false;
@@ -599,7 +601,7 @@ UI.getSettings = function () {
599 601
  * Toggles film strip.
600 602
  */
601 603
 UI.toggleFilmStrip = function () {
602
-    BottomToolbar.toggleFilmStrip();
604
+    FilmStrip.toggleFilmStrip();
603 605
 };
604 606
 
605 607
 /**

+ 2
- 2
modules/UI/audio_levels/AudioLevels.js Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 /* jshint -W101 */
3 3
 
4 4
 import CanvasUtil from './CanvasUtils';
5
-import BottomToolbar from '../toolbars/BottomToolbar';
5
+import FilmStrip from '../videolayout/FilmStrip';
6 6
 
7 7
 const LOCAL_LEVEL = 'local';
8 8
 
@@ -228,7 +228,7 @@ const AudioLevels = {
228 228
         let canvasWidth = thumbWidth + interfaceConfig.CANVAS_EXTRA;
229 229
         let canvasHeight = thumbHeight + interfaceConfig.CANVAS_EXTRA;
230 230
 
231
-        BottomToolbar.getThumbs().children('canvas').each(function () {
231
+        FilmStrip.getThumbs().children('canvas').each(function () {
232 232
             $(this).attr('width', canvasWidth);
233 233
             $(this).attr('height', canvasHeight);
234 234
         });

+ 2
- 2
modules/UI/etherpad/Etherpad.js Wyświetl plik

@@ -4,7 +4,7 @@ import VideoLayout from "../videolayout/VideoLayout";
4 4
 import LargeContainer from '../videolayout/LargeContainer';
5 5
 import UIUtil from "../util/UIUtil";
6 6
 import SidePanelToggler from "../side_pannels/SidePanelToggler";
7
-import BottomToolbar from '../toolbars/BottomToolbar';
7
+import FilmStrip from '../videolayout/FilmStrip';
8 8
 
9 9
 /**
10 10
  * Etherpad options.
@@ -101,7 +101,7 @@ class Etherpad extends LargeContainer {
101 101
     }
102 102
 
103 103
     resize (containerWidth, containerHeight, animate) {
104
-        let height = containerHeight - BottomToolbar.getFilmStripHeight();
104
+        let height = containerHeight - FilmStrip.getFilmStripHeight();
105 105
         let width = containerWidth;
106 106
 
107 107
         $(this.iframe).width(width).height(height);

+ 2
- 2
modules/UI/prezi/Prezi.js Wyświetl plik

@@ -9,7 +9,7 @@ import UIEvents from '../../../service/UI/UIEvents';
9 9
 import messageHandler from '../util/MessageHandler';
10 10
 import ToolbarToggler from "../toolbars/ToolbarToggler";
11 11
 import SidePanelToggler from "../side_pannels/SidePanelToggler";
12
-import BottomToolbar from '../toolbars/BottomToolbar';
12
+import FilmStrip from '../videolayout/FilmStrip';
13 13
 
14 14
 /**
15 15
  * Example of Prezi link.
@@ -287,7 +287,7 @@ class PreziContainer extends LargeContainer {
287 287
     }
288 288
 
289 289
     resize (containerWidth, containerHeight) {
290
-        let height = containerHeight - BottomToolbar.getFilmStripHeight();
290
+        let height = containerHeight - FilmStrip.getFilmStripHeight();
291 291
 
292 292
         let width = containerWidth;
293 293
 

+ 17
- 10
modules/UI/side_pannels/SidePanelToggler.js Wyświetl plik

@@ -96,11 +96,14 @@ var PanelToggler = {
96 96
                 $('#chatspace').trigger('shown');
97 97
             };
98 98
 
99
-        VideoLayout.resizeVideoArea(!Chat.isVisible(), chatCompleteFunction);
100
-
101
-        toggle(Chat,
102
-            '#chatspace',
103
-            function () {
99
+        VideoLayout.resizeVideoArea(!Chat.isVisible(),
100
+                                    false,
101
+                                    true,
102
+                                    chatCompleteFunction);
103
+
104
+        toggle(Chat, //Object
105
+            '#chatspace', // Selector
106
+            function () { //onOpenComplete
104 107
                 // Request the focus in the nickname field or the chat input
105 108
                 // field.
106 109
                 if ($('#nickname').css('visibility') === 'visible') {
@@ -109,9 +112,8 @@ var PanelToggler = {
109 112
                     $('#usermsg').focus();
110 113
                 }
111 114
             },
112
-            null,
113
-            () => this.resizeChat(),
114
-            null);
115
+            () => this.resizeChat(), //OnOpen
116
+            null); //OnClose
115 117
     },
116 118
 
117 119
     resizeChat () {
@@ -128,7 +130,11 @@ var PanelToggler = {
128 130
             : function () {
129 131
                 $('#contactlist').trigger('shown');
130 132
             };
131
-        VideoLayout.resizeVideoArea(!ContactList.isVisible(), completeFunction);
133
+        VideoLayout.resizeVideoArea(
134
+            !ContactList.isVisible(),
135
+            false,
136
+            true,
137
+            completeFunction);
132 138
 
133 139
         toggle(ContactList,
134 140
             '#contactlist',
@@ -143,7 +149,8 @@ var PanelToggler = {
143 149
      * Opens / closes the settings menu
144 150
      */
145 151
     toggleSettingsMenu () {
146
-        VideoLayout.resizeVideoArea(!SettingsMenu.isVisible(), function (){});
152
+        VideoLayout.resizeVideoArea(
153
+            !SettingsMenu.isVisible(), false, true, function (){});
147 154
         toggle(SettingsMenu,
148 155
             '#settingsmenu',
149 156
             null,

+ 32
- 61
modules/UI/toolbars/BottomToolbar.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-/* global $ */
1
+/* global $, APP, interfaceConfig*/
2 2
 import UIUtil from '../util/UIUtil';
3 3
 import UIEvents from '../../../service/UI/UIEvents';
4 4
 import AnalyticsAdapter from '../../statistics/AnalyticsAdapter';
@@ -11,7 +11,6 @@ const defaultBottomToolbarButtons = {
11 11
 
12 12
 const BottomToolbar = {
13 13
     init () {
14
-        this.filmStrip = $('#remoteVideos');
15 14
         this.toolbar = $('#bottomToolbar');
16 15
     },
17 16
 
@@ -38,71 +37,43 @@ const BottomToolbar = {
38 37
         );
39 38
     },
40 39
 
41
-    toggleFilmStrip () {
42
-        this.filmStrip.toggleClass("hidden");
43
-    },
44
-
45
-    isFilmStripVisible () {
46
-        return !this.filmStrip.hasClass('hidden');
47
-    },
48
-
49
-    setupFilmStripOnly () {
50
-        this.filmStrip.css({
51
-            padding: "0px 0px 18px 0px",
52
-            right: 0
53
-        });
54
-    },
55
-
56
-    getFilmStripHeight () {
57
-        if (this.isFilmStripVisible()) {
58
-            return this.filmStrip.outerHeight();
59
-        } else {
60
-            return 0;
61
-        }
62
-    },
63
-
64
-    getFilmStripWidth () {
65
-        return this.filmStrip.width();
66
-    },
67
-
68
-    resizeThumbnails (thumbWidth, thumbHeight,
69
-                      animate = false, forceUpdate = false) {
70
-        return new Promise(resolve => {
71
-            this.filmStrip.animate({
72
-                // adds 2 px because of small video 1px border
73
-                height: thumbHeight + 2
74
-            }, {
75
-                queue: false,
76
-                duration: animate ? 500 : 0
77
-            });
78
-
79
-            this.getThumbs(!forceUpdate).animate({
80
-                height: thumbHeight,
81
-                width: thumbWidth
82
-            }, {
83
-                queue: false,
84
-                duration: animate ? 500 : 0,
85
-                complete:  resolve
86
-            });
87
-
88
-            if (!animate) {
89
-                resolve();
90
-            }
91
-        });
92
-    },
93
-
94 40
     resizeToolbar (thumbWidth, thumbHeight) {
95 41
         let bottom = (thumbHeight - this.toolbar.outerHeight())/2 + 18;
96 42
         this.toolbar.css({bottom});
97 43
     },
98 44
 
99
-    getThumbs (only_visible = false) {
100
-        let selector = 'span';
101
-        if (only_visible) {
102
-            selector += ':visible';
103
-        }
45
+    /**
46
+     * Returns true if this toolbar is currently visible, or false otherwise.
47
+     * @return <tt>true</tt> if currently visible, <tt>false</tt> - otherwise
48
+     */
49
+    isVisible() {
50
+        return this.toolbar.is(":visible");
51
+    },
52
+
53
+    /**
54
+     * Hides the bottom toolbar with animation or not depending on the animate
55
+     * parameter.
56
+     * @param animate <tt>true</tt> to hide the bottom toolbar with animation,
57
+     * <tt>false</tt> or nothing to hide it without animation.
58
+     */
59
+    hide(animate) {
60
+        if (animate)
61
+            this.toolbar.hide("slide", {direction: "right", duration: 300});
62
+        else
63
+            this.toolbar.css("display", "none");
64
+    },
104 65
 
105
-        return this.filmStrip.children(selector);
66
+    /**
67
+     * Shows the bottom toolbar with animation or not depending on the animate
68
+     * parameter.
69
+     * @param animate <tt>true</tt> to show the bottom toolbar with animation,
70
+     * <tt>false</tt> or nothing to show it without animation.
71
+     */
72
+    show(animate) {
73
+        if (animate)
74
+            this.toolbar.show("slide", {direction: "right", duration: 300});
75
+        else
76
+            this.toolbar.css("display", "block");
106 77
     }
107 78
 };
108 79
 

+ 6
- 11
modules/UI/toolbars/ToolbarToggler.js Wyświetl plik

@@ -2,6 +2,7 @@
2 2
 
3 3
 import UIUtil from '../util/UIUtil';
4 4
 import BottomToolbar from './BottomToolbar';
5
+import FilmStrip from '../videolayout/FilmStrip.js';
5 6
 
6 7
 let toolbarTimeoutObject;
7 8
 let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
@@ -28,7 +29,6 @@ function hideToolbar() {
28 29
     }
29 30
 
30 31
     let header = $("#header");
31
-    let bottomToolbar = $("#bottomToolbar");
32 32
     let isToolbarHover = false;
33 33
     header.find('*').each(function () {
34 34
         let id = $(this).attr('id');
@@ -48,10 +48,8 @@ function hideToolbar() {
48 48
     } else {
49 49
         header.hide("slide", { direction: "up", duration: 300});
50 50
         $('#subject').animate({top: "-=40"}, 300);
51
-        if (!BottomToolbar.isFilmStripVisible()) {
52
-            bottomToolbar.hide(
53
-                "slide", {direction: "right", duration: 300}
54
-            );
51
+        if (!FilmStrip.isFilmStripVisible()) {
52
+            BottomToolbar.hide(true);
55 53
         }
56 54
     }
57 55
 }
@@ -65,14 +63,11 @@ const ToolbarToggler = {
65 63
             return;
66 64
         }
67 65
         let header = $("#header");
68
-        let bottomToolbar = $("#bottomToolbar");
69
-        if (!header.is(':visible') || !bottomToolbar.is(":visible")) {
66
+        if (!header.is(':visible') || !BottomToolbar.isVisible()) {
70 67
             header.show("slide", { direction: "up", duration: 300});
71 68
             $('#subject').animate({top: "+=40"}, 300);
72
-            if (!bottomToolbar.is(":visible")) {
73
-                bottomToolbar.show(
74
-                    "slide", {direction: "right", duration: 300}
75
-                );
69
+            if (!BottomToolbar.isVisible()) {
70
+                BottomToolbar.show(true);
76 71
             }
77 72
 
78 73
             if (toolbarTimeoutObject) {

+ 1
- 0
modules/UI/util/UIUtil.js Wyświetl plik

@@ -32,6 +32,7 @@
32 32
 
33 33
         return window.innerWidth - rightPanelWidth;
34 34
     },
35
+
35 36
     /**
36 37
      * Changes the style class of the element given by id.
37 38
      */

+ 140
- 0
modules/UI/videolayout/FilmStrip.js Wyświetl plik

@@ -0,0 +1,140 @@
1
+/* global $, APP, interfaceConfig, config*/
2
+
3
+import UIUtil from "../util/UIUtil";
4
+
5
+const thumbAspectRatio = 16.0 / 9.0;
6
+
7
+const FilmStrip = {
8
+    init () {
9
+        this.filmStrip = $('#remoteVideos');
10
+    },
11
+
12
+    toggleFilmStrip () {
13
+        this.filmStrip.toggleClass("hidden");
14
+    },
15
+
16
+    isFilmStripVisible () {
17
+        return !this.filmStrip.hasClass('hidden');
18
+    },
19
+
20
+    setupFilmStripOnly () {
21
+        this.filmStrip.css({
22
+            padding: "0px 0px 18px 0px",
23
+            right: 0
24
+        });
25
+    },
26
+
27
+    getFilmStripHeight () {
28
+        if (this.isFilmStripVisible()) {
29
+            return this.filmStrip.outerHeight();
30
+        } else {
31
+            return 0;
32
+        }
33
+    },
34
+
35
+    getFilmStripWidth () {
36
+        return this.filmStrip.innerWidth()
37
+            - parseInt(this.filmStrip.css('paddingLeft'), 10)
38
+            - parseInt(this.filmStrip.css('paddingRight'), 10);
39
+    },
40
+
41
+    /**
42
+     * Calculates the thumbnail size.
43
+     * @param videoAreaAvailableWidth the currently available video area width
44
+     * that we want to take into account when calculating the film strip width.
45
+     */
46
+     calculateThumbnailSize (videoAreaAvailableWidth) {
47
+        // Calculate the available height, which is the inner window height
48
+        // minus 39px for the header minus 2px for the delimiter lines on the
49
+        // top and bottom of the large video, minus the 36px space inside the
50
+        // remoteVideos container used for highlighting shadow.
51
+        let availableHeight = 100;
52
+
53
+        let numvids = this.getThumbs(true).length;
54
+
55
+        let localVideoContainer = $("#localVideoContainer");
56
+
57
+        /**
58
+         * If the videoAreaAvailableWidth is set we use this one to calculate
59
+         * the filmStrip width, because we're probably in a state where the
60
+         * film strip size hasn't been updated yet, but it will be.
61
+         */
62
+        let filmStripWidth = videoAreaAvailableWidth
63
+            ? videoAreaAvailableWidth
64
+                - parseInt(this.filmStrip.css('right'), 10)
65
+                - parseInt(this.filmStrip.css('paddingLeft'), 10)
66
+                - parseInt(this.filmStrip.css('paddingRight'), 10)
67
+                - parseInt(this.filmStrip.css('borderLeftWidth'), 10)
68
+                - parseInt(this.filmStrip.css('borderRightWidth'), 10)
69
+            : this.getFilmStripWidth();
70
+
71
+
72
+        let availableWidth = Math.floor(
73
+                (filmStripWidth - numvids * (
74
+                parseInt(localVideoContainer.css('borderLeftWidth'), 10)
75
+                + parseInt(localVideoContainer.css('borderRightWidth'), 10)
76
+                + parseInt(localVideoContainer.css('paddingLeft'), 10)
77
+                + parseInt(localVideoContainer.css('paddingRight'), 10)
78
+                + parseInt(localVideoContainer.css('marginLeft'), 10)
79
+                + parseInt(localVideoContainer.css('marginRight'), 10)))
80
+                / numvids) - numvids*10;
81
+
82
+        let maxHeight
83
+            // If the MAX_HEIGHT property hasn't been specified
84
+            // we have the static value.
85
+            = Math.min( interfaceConfig.FILM_STRIP_MAX_HEIGHT || 160,
86
+            availableHeight);
87
+
88
+        availableHeight
89
+            = Math.min( maxHeight,
90
+            availableWidth / thumbAspectRatio,
91
+            window.innerHeight - 18);
92
+
93
+        if (availableHeight < availableWidth / thumbAspectRatio) {
94
+            availableWidth = Math.floor(availableHeight * thumbAspectRatio);
95
+        }
96
+
97
+        return {
98
+            thumbWidth: availableWidth,
99
+            thumbHeight: availableHeight
100
+        };
101
+    },
102
+
103
+    resizeThumbnails (thumbWidth, thumbHeight,
104
+                      animate = false, forceUpdate = false) {
105
+
106
+        return new Promise(resolve => {
107
+            this.getThumbs(!forceUpdate).animate({
108
+                height: thumbHeight,
109
+                width: thumbWidth
110
+            }, {
111
+                queue: false,
112
+                duration: animate ? 500 : 0,
113
+                complete:  resolve
114
+            });
115
+
116
+            this.filmStrip.animate({
117
+                // adds 2 px because of small video 1px border
118
+                height: thumbHeight + 2
119
+            }, {
120
+                queue: false,
121
+                duration: animate ? 500 : 0
122
+            });
123
+
124
+            if (!animate) {
125
+                resolve();
126
+            }
127
+        });
128
+    },
129
+
130
+    getThumbs (only_visible = false) {
131
+        let selector = 'span';
132
+        if (only_visible) {
133
+            selector += ':visible';
134
+        }
135
+
136
+        return this.filmStrip.children(selector);
137
+    }
138
+};
139
+
140
+export default FilmStrip;

+ 2
- 2
modules/UI/videolayout/LargeVideo.js Wyświetl plik

@@ -4,7 +4,7 @@
4 4
 import UIUtil from "../util/UIUtil";
5 5
 import UIEvents from "../../../service/UI/UIEvents";
6 6
 import LargeContainer from './LargeContainer';
7
-import BottomToolbar from '../toolbars/BottomToolbar';
7
+import FilmStrip from './FilmStrip';
8 8
 import Avatar from "../avatar/Avatar";
9 9
 import {createDeferred} from '../../util/helpers';
10 10
 
@@ -43,7 +43,7 @@ function getDesktopVideoSize(videoWidth,
43 43
     let availableWidth = Math.max(videoWidth, videoSpaceWidth);
44 44
     let availableHeight = Math.max(videoHeight, videoSpaceHeight);
45 45
 
46
-    videoSpaceHeight -= BottomToolbar.getFilmStripHeight();
46
+    videoSpaceHeight -= FilmStrip.getFilmStripHeight();
47 47
 
48 48
     if (availableWidth / aspectRatio >= videoSpaceHeight) {
49 49
         availableHeight = videoSpaceHeight;

+ 1
- 1
modules/UI/videolayout/RemoteVideo.js Wyświetl plik

@@ -33,7 +33,7 @@ RemoteVideo.prototype.addRemoteVideoContainer = function() {
33 33
     if (APP.conference.isModerator) {
34 34
         this.addRemoteVideoMenu();
35 35
     }
36
-    let {thumbWidth, thumbHeight} = this.VideoLayout.calculateThumbnailSize();
36
+    let {thumbWidth, thumbHeight} = this.VideoLayout.resizeThumbnails();
37 37
     AudioLevels.updateAudioLevelCanvas(this.id, thumbWidth, thumbHeight);
38 38
 
39 39
     return this.container;

+ 28
- 87
modules/UI/videolayout/VideoLayout.js Wyświetl plik

@@ -4,7 +4,7 @@
4 4
 import AudioLevels from "../audio_levels/AudioLevels";
5 5
 import Avatar from "../avatar/Avatar";
6 6
 import BottomToolbar from "../toolbars/BottomToolbar";
7
-
7
+import FilmStrip from "./FilmStrip";
8 8
 import UIEvents from "../../../service/UI/UIEvents";
9 9
 import UIUtil from "../util/UIUtil";
10 10
 
@@ -34,8 +34,6 @@ var eventEmitter = null;
34 34
  */
35 35
 var focusedVideoResourceJid = null;
36 36
 
37
-const thumbAspectRatio = 16.0 / 9.0;
38
-
39 37
 /**
40 38
  * On contact list item clicked.
41 39
  */
@@ -149,9 +147,8 @@ var VideoLayout = {
149 147
         let localId = APP.conference.localId;
150 148
         this.onVideoTypeChanged(localId, stream.videoType);
151 149
 
152
-        let {thumbWidth, thumbHeight} = this.calculateThumbnailSize();
153
-        AudioLevels.updateAudioLevelCanvas(
154
-            null, thumbWidth, thumbHeight);
150
+        let {thumbWidth, thumbHeight} = this.resizeThumbnails(false, true);
151
+        AudioLevels.updateAudioLevelCanvas(null, thumbWidth, thumbHeight);
155 152
 
156 153
         if (!stream.isMuted()) {
157 154
             localVideoThumbnail.changeVideo(stream);
@@ -221,7 +218,7 @@ var VideoLayout = {
221 218
     electLastVisibleVideo () {
222 219
         // pick the last visible video in the row
223 220
         // if nobody else is left, this picks the local video
224
-        let thumbs = BottomToolbar.getThumbs(true).filter('[id!="mixedstream"]');
221
+        let thumbs = FilmStrip.getThumbs(true).filter('[id!="mixedstream"]');
225 222
 
226 223
         let lastVisible = thumbs.filter(':visible:last');
227 224
         if (lastVisible.length) {
@@ -235,7 +232,7 @@ var VideoLayout = {
235 232
         }
236 233
 
237 234
         console.info("Last visible video no longer exists");
238
-        thumbs = BottomToolbar.getThumbs();
235
+        thumbs = FilmStrip.getThumbs();
239 236
         if (thumbs.length) {
240 237
             let id = getPeerContainerResourceId(thumbs[0]);
241 238
             if (remoteVideos[id]) {
@@ -345,7 +342,7 @@ var VideoLayout = {
345 342
 
346 343
         // In case this is not currently in the last n we don't show it.
347 344
         if (localLastNCount && localLastNCount > 0 &&
348
-            BottomToolbar.getThumbs().length >= localLastNCount + 2) {
345
+            FilmStrip.getThumbs().length >= localLastNCount + 2) {
349 346
             remoteVideo.showPeerContainer('hide');
350 347
         } else {
351 348
             VideoLayout.resizeThumbnails(false, true);
@@ -411,74 +408,26 @@ var VideoLayout = {
411 408
         localVideoThumbnail.showAudioIndicator(isMuted);
412 409
     },
413 410
 
414
-    /**
415
-     * Resizes the large video container.
416
-     */
417
-    resizeLargeVideoContainer (isSideBarVisible, forceUpdate) {
418
-        let animate = false;
419
-        if (largeVideo) {
420
-            largeVideo.updateContainerSize(isSideBarVisible);
421
-            largeVideo.resize(animate);
422
-        }
423
-        this.resizeVideoSpace(animate, isSideBarVisible);
424
-        this.resizeThumbnails(false, forceUpdate);
425
-    },
426
-
427 411
     /**
428 412
      * Resizes thumbnails.
429 413
      */
430
-    resizeThumbnails (animate = false, forceUpdate = false) {
431
-        let {thumbWidth, thumbHeight} = this.calculateThumbnailSize();
414
+    resizeThumbnails (  animate = false,
415
+                        forceUpdate = false,
416
+                        videoAreaAvailableWidth = null) {
417
+        let {thumbWidth, thumbHeight}
418
+            = FilmStrip.calculateThumbnailSize(videoAreaAvailableWidth);
432 419
 
433 420
         $('.userAvatar').css('left', (thumbWidth - thumbHeight) / 2);
434 421
 
435
-        BottomToolbar.resizeThumbnails(thumbWidth, thumbHeight,
422
+        FilmStrip.resizeThumbnails(thumbWidth, thumbHeight,
436 423
             animate, forceUpdate)
437 424
             .then(function () {
438 425
                 BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
439 426
                 AudioLevels.updateCanvasSize(thumbWidth, thumbHeight);
440 427
         });
428
+        return {thumbWidth, thumbHeight};
441 429
     },
442 430
 
443
-    /**
444
-     * Calculates the thumbnail size.
445
-     *
446
-     */
447
-    calculateThumbnailSize () {
448
-        let videoSpaceWidth = BottomToolbar.getFilmStripWidth();
449
-        // Calculate the available height, which is the inner window height
450
-        // minus 39px for the header minus 2px for the delimiter lines on the
451
-        // top and bottom of the large video, minus the 36px space inside the
452
-        // remoteVideos container used for highlighting shadow.
453
-        let availableHeight = 100;
454
-
455
-        let numvids = BottomToolbar.getThumbs().length;
456
-        if (localLastNCount && localLastNCount > 0) {
457
-            numvids = Math.min(localLastNCount + 1, numvids);
458
-        }
459
-
460
-        // Remove the 3px borders arround videos and border around the remote
461
-        // videos area and the 4 pixels between the local video and the others
462
-        //TODO: Find out where the 4 pixels come from and remove them
463
-        let availableWinWidth = videoSpaceWidth - 2 * 3 * numvids - 70 - 4;
464
-
465
-        let availableWidth = availableWinWidth / numvids;
466
-        let maxHeight = Math.min(160, availableHeight);
467
-        availableHeight
468
-            = Math.min(  maxHeight,
469
-                         availableWidth / thumbAspectRatio,
470
-                         window.innerHeight - 18);
471
-
472
-        if (availableHeight < availableWidth / thumbAspectRatio) {
473
-            availableWidth = Math.floor(availableHeight * thumbAspectRatio);
474
-        }
475
-
476
-        return {
477
-            thumbWidth: availableWidth,
478
-            thumbHeight: availableHeight
479
-        };
480
-   },
481
-
482 431
     /**
483 432
      * On audio muted event.
484 433
      */
@@ -613,7 +562,7 @@ var VideoLayout = {
613 562
         var updateLargeVideo = false;
614 563
 
615 564
         // Handle LastN/local LastN changes.
616
-        BottomToolbar.getThumbs().each(( index, element ) => {
565
+        FilmStrip.getThumbs().each(( index, element ) => {
617 566
             var resourceJid = getPeerContainerResourceId(element);
618 567
             var smallVideo = remoteVideos[resourceJid];
619 568
 
@@ -667,7 +616,8 @@ var VideoLayout = {
667 616
             endpointsEnteringLastN.forEach(function (resourceJid) {
668 617
 
669 618
                 var remoteVideo = remoteVideos[resourceJid];
670
-                remoteVideo.showPeerContainer('show');
619
+                if (remoteVideo)
620
+                    remoteVideo.showPeerContainer('show');
671 621
 
672 622
                 if (!remoteVideo.isVisible()) {
673 623
                     console.log("Add to last N", resourceJid);
@@ -840,40 +790,31 @@ var VideoLayout = {
840 790
      * Resizes the video area.
841 791
      *
842 792
      * @param isSideBarVisible indicates if the side bar is currently visible
843
-     * @param callback a function to be called when the video space is
793
+     * @param forceUpdate indicates that hidden thumbnails will be shown
794
+     * @param completeFunction a function to be called when the video area is
844 795
      * resized.
845
-     */
846
-    resizeVideoArea (isSideBarVisible, callback) {
847
-        let animate = true;
796
+     */resizeVideoArea (isSideBarVisible,
797
+                        forceUpdate = false,
798
+                        animate = false,
799
+                        completeFunction = null) {
848 800
 
849 801
         if (largeVideo) {
850 802
             largeVideo.updateContainerSize(isSideBarVisible);
851 803
             largeVideo.resize(animate);
852
-            this.resizeVideoSpace(animate, isSideBarVisible, callback);
853 804
         }
854 805
 
855
-        VideoLayout.resizeThumbnails(animate);
856
-    },
857
-
858
-    /**
859
-     * Resizes the #videospace html element
860
-     * @param animate boolean property that indicates whether the resize should
861
-     * be animated or not.
862
-     * @param isChatVisible boolean property that indicates whether the chat
863
-     * area is displayed or not.
864
-     * If that parameter is null the method will check the chat panel
865
-     * visibility.
866
-     * @param completeFunction a function to be called when the video space
867
-     * is resized.
868
-     */
869
-    resizeVideoSpace (animate, isChatVisible, completeFunction) {
806
+        // Calculate available width and height.
870 807
         let availableHeight = window.innerHeight;
871
-        let availableWidth = UIUtil.getAvailableVideoWidth(isChatVisible);
808
+        let availableWidth = UIUtil.getAvailableVideoWidth(isSideBarVisible);
872 809
 
873 810
         if (availableWidth < 0 || availableHeight < 0) {
874 811
             return;
875 812
         }
876 813
 
814
+        // Resize the thumbnails first.
815
+        this.resizeThumbnails(false, forceUpdate, availableWidth);
816
+
817
+        // Resize the video area element.
877 818
         $('#videospace').animate({
878 819
             right: window.innerWidth - availableWidth,
879 820
             width: availableWidth,

+ 0
- 1
modules/keyboardshortcut/keyboardshortcut.js Wyświetl plik

@@ -47,7 +47,6 @@ function initShortcutHandlers() {
47 47
     };
48 48
 }
49 49
 
50
-
51 50
 var KeyboardShortcut = {
52 51
     init: function () {
53 52
         initShortcutHandlers();

Ładowanie…
Anuluj
Zapisz