瀏覽代碼

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

j8
yanas 9 年之前
父節點
當前提交
30f3da98e5

+ 2
- 1
interface_config.js 查看文件

29
      */
29
      */
30
     filmStripOnly: false,
30
     filmStripOnly: false,
31
     RANDOM_AVATAR_URL_PREFIX: false,
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 查看文件

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

+ 2
- 2
modules/UI/audio_levels/AudioLevels.js 查看文件

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

+ 2
- 2
modules/UI/etherpad/Etherpad.js 查看文件

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

+ 2
- 2
modules/UI/prezi/Prezi.js 查看文件

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

+ 17
- 10
modules/UI/side_pannels/SidePanelToggler.js 查看文件

96
                 $('#chatspace').trigger('shown');
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
                 // Request the focus in the nickname field or the chat input
107
                 // Request the focus in the nickname field or the chat input
105
                 // field.
108
                 // field.
106
                 if ($('#nickname').css('visibility') === 'visible') {
109
                 if ($('#nickname').css('visibility') === 'visible') {
109
                     $('#usermsg').focus();
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
     resizeChat () {
119
     resizeChat () {
128
             : function () {
130
             : function () {
129
                 $('#contactlist').trigger('shown');
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
         toggle(ContactList,
139
         toggle(ContactList,
134
             '#contactlist',
140
             '#contactlist',
143
      * Opens / closes the settings menu
149
      * Opens / closes the settings menu
144
      */
150
      */
145
     toggleSettingsMenu () {
151
     toggleSettingsMenu () {
146
-        VideoLayout.resizeVideoArea(!SettingsMenu.isVisible(), function (){});
152
+        VideoLayout.resizeVideoArea(
153
+            !SettingsMenu.isVisible(), false, true, function (){});
147
         toggle(SettingsMenu,
154
         toggle(SettingsMenu,
148
             '#settingsmenu',
155
             '#settingsmenu',
149
             null,
156
             null,

+ 32
- 61
modules/UI/toolbars/BottomToolbar.js 查看文件

1
-/* global $ */
1
+/* global $, APP, interfaceConfig*/
2
 import UIUtil from '../util/UIUtil';
2
 import UIUtil from '../util/UIUtil';
3
 import UIEvents from '../../../service/UI/UIEvents';
3
 import UIEvents from '../../../service/UI/UIEvents';
4
 import AnalyticsAdapter from '../../statistics/AnalyticsAdapter';
4
 import AnalyticsAdapter from '../../statistics/AnalyticsAdapter';
11
 
11
 
12
 const BottomToolbar = {
12
 const BottomToolbar = {
13
     init () {
13
     init () {
14
-        this.filmStrip = $('#remoteVideos');
15
         this.toolbar = $('#bottomToolbar');
14
         this.toolbar = $('#bottomToolbar');
16
     },
15
     },
17
 
16
 
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
     resizeToolbar (thumbWidth, thumbHeight) {
40
     resizeToolbar (thumbWidth, thumbHeight) {
95
         let bottom = (thumbHeight - this.toolbar.outerHeight())/2 + 18;
41
         let bottom = (thumbHeight - this.toolbar.outerHeight())/2 + 18;
96
         this.toolbar.css({bottom});
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 查看文件

2
 
2
 
3
 import UIUtil from '../util/UIUtil';
3
 import UIUtil from '../util/UIUtil';
4
 import BottomToolbar from './BottomToolbar';
4
 import BottomToolbar from './BottomToolbar';
5
+import FilmStrip from '../videolayout/FilmStrip.js';
5
 
6
 
6
 let toolbarTimeoutObject;
7
 let toolbarTimeoutObject;
7
 let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
8
 let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
28
     }
29
     }
29
 
30
 
30
     let header = $("#header");
31
     let header = $("#header");
31
-    let bottomToolbar = $("#bottomToolbar");
32
     let isToolbarHover = false;
32
     let isToolbarHover = false;
33
     header.find('*').each(function () {
33
     header.find('*').each(function () {
34
         let id = $(this).attr('id');
34
         let id = $(this).attr('id');
48
     } else {
48
     } else {
49
         header.hide("slide", { direction: "up", duration: 300});
49
         header.hide("slide", { direction: "up", duration: 300});
50
         $('#subject').animate({top: "-=40"}, 300);
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
             return;
63
             return;
66
         }
64
         }
67
         let header = $("#header");
65
         let header = $("#header");
68
-        let bottomToolbar = $("#bottomToolbar");
69
-        if (!header.is(':visible') || !bottomToolbar.is(":visible")) {
66
+        if (!header.is(':visible') || !BottomToolbar.isVisible()) {
70
             header.show("slide", { direction: "up", duration: 300});
67
             header.show("slide", { direction: "up", duration: 300});
71
             $('#subject').animate({top: "+=40"}, 300);
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
             if (toolbarTimeoutObject) {
73
             if (toolbarTimeoutObject) {

+ 1
- 0
modules/UI/util/UIUtil.js 查看文件

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

+ 140
- 0
modules/UI/videolayout/FilmStrip.js 查看文件

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 查看文件

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

+ 1
- 1
modules/UI/videolayout/RemoteVideo.js 查看文件

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

+ 28
- 87
modules/UI/videolayout/VideoLayout.js 查看文件

4
 import AudioLevels from "../audio_levels/AudioLevels";
4
 import AudioLevels from "../audio_levels/AudioLevels";
5
 import Avatar from "../avatar/Avatar";
5
 import Avatar from "../avatar/Avatar";
6
 import BottomToolbar from "../toolbars/BottomToolbar";
6
 import BottomToolbar from "../toolbars/BottomToolbar";
7
-
7
+import FilmStrip from "./FilmStrip";
8
 import UIEvents from "../../../service/UI/UIEvents";
8
 import UIEvents from "../../../service/UI/UIEvents";
9
 import UIUtil from "../util/UIUtil";
9
 import UIUtil from "../util/UIUtil";
10
 
10
 
34
  */
34
  */
35
 var focusedVideoResourceJid = null;
35
 var focusedVideoResourceJid = null;
36
 
36
 
37
-const thumbAspectRatio = 16.0 / 9.0;
38
-
39
 /**
37
 /**
40
  * On contact list item clicked.
38
  * On contact list item clicked.
41
  */
39
  */
149
         let localId = APP.conference.localId;
147
         let localId = APP.conference.localId;
150
         this.onVideoTypeChanged(localId, stream.videoType);
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
         if (!stream.isMuted()) {
153
         if (!stream.isMuted()) {
157
             localVideoThumbnail.changeVideo(stream);
154
             localVideoThumbnail.changeVideo(stream);
221
     electLastVisibleVideo () {
218
     electLastVisibleVideo () {
222
         // pick the last visible video in the row
219
         // pick the last visible video in the row
223
         // if nobody else is left, this picks the local video
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
         let lastVisible = thumbs.filter(':visible:last');
223
         let lastVisible = thumbs.filter(':visible:last');
227
         if (lastVisible.length) {
224
         if (lastVisible.length) {
235
         }
232
         }
236
 
233
 
237
         console.info("Last visible video no longer exists");
234
         console.info("Last visible video no longer exists");
238
-        thumbs = BottomToolbar.getThumbs();
235
+        thumbs = FilmStrip.getThumbs();
239
         if (thumbs.length) {
236
         if (thumbs.length) {
240
             let id = getPeerContainerResourceId(thumbs[0]);
237
             let id = getPeerContainerResourceId(thumbs[0]);
241
             if (remoteVideos[id]) {
238
             if (remoteVideos[id]) {
345
 
342
 
346
         // In case this is not currently in the last n we don't show it.
343
         // In case this is not currently in the last n we don't show it.
347
         if (localLastNCount && localLastNCount > 0 &&
344
         if (localLastNCount && localLastNCount > 0 &&
348
-            BottomToolbar.getThumbs().length >= localLastNCount + 2) {
345
+            FilmStrip.getThumbs().length >= localLastNCount + 2) {
349
             remoteVideo.showPeerContainer('hide');
346
             remoteVideo.showPeerContainer('hide');
350
         } else {
347
         } else {
351
             VideoLayout.resizeThumbnails(false, true);
348
             VideoLayout.resizeThumbnails(false, true);
411
         localVideoThumbnail.showAudioIndicator(isMuted);
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
      * Resizes thumbnails.
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
         $('.userAvatar').css('left', (thumbWidth - thumbHeight) / 2);
420
         $('.userAvatar').css('left', (thumbWidth - thumbHeight) / 2);
434
 
421
 
435
-        BottomToolbar.resizeThumbnails(thumbWidth, thumbHeight,
422
+        FilmStrip.resizeThumbnails(thumbWidth, thumbHeight,
436
             animate, forceUpdate)
423
             animate, forceUpdate)
437
             .then(function () {
424
             .then(function () {
438
                 BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
425
                 BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
439
                 AudioLevels.updateCanvasSize(thumbWidth, thumbHeight);
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
      * On audio muted event.
432
      * On audio muted event.
484
      */
433
      */
613
         var updateLargeVideo = false;
562
         var updateLargeVideo = false;
614
 
563
 
615
         // Handle LastN/local LastN changes.
564
         // Handle LastN/local LastN changes.
616
-        BottomToolbar.getThumbs().each(( index, element ) => {
565
+        FilmStrip.getThumbs().each(( index, element ) => {
617
             var resourceJid = getPeerContainerResourceId(element);
566
             var resourceJid = getPeerContainerResourceId(element);
618
             var smallVideo = remoteVideos[resourceJid];
567
             var smallVideo = remoteVideos[resourceJid];
619
 
568
 
667
             endpointsEnteringLastN.forEach(function (resourceJid) {
616
             endpointsEnteringLastN.forEach(function (resourceJid) {
668
 
617
 
669
                 var remoteVideo = remoteVideos[resourceJid];
618
                 var remoteVideo = remoteVideos[resourceJid];
670
-                remoteVideo.showPeerContainer('show');
619
+                if (remoteVideo)
620
+                    remoteVideo.showPeerContainer('show');
671
 
621
 
672
                 if (!remoteVideo.isVisible()) {
622
                 if (!remoteVideo.isVisible()) {
673
                     console.log("Add to last N", resourceJid);
623
                     console.log("Add to last N", resourceJid);
840
      * Resizes the video area.
790
      * Resizes the video area.
841
      *
791
      *
842
      * @param isSideBarVisible indicates if the side bar is currently visible
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
      * resized.
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
         if (largeVideo) {
801
         if (largeVideo) {
850
             largeVideo.updateContainerSize(isSideBarVisible);
802
             largeVideo.updateContainerSize(isSideBarVisible);
851
             largeVideo.resize(animate);
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
         let availableHeight = window.innerHeight;
807
         let availableHeight = window.innerHeight;
871
-        let availableWidth = UIUtil.getAvailableVideoWidth(isChatVisible);
808
+        let availableWidth = UIUtil.getAvailableVideoWidth(isSideBarVisible);
872
 
809
 
873
         if (availableWidth < 0 || availableHeight < 0) {
810
         if (availableWidth < 0 || availableHeight < 0) {
874
             return;
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
         $('#videospace').animate({
818
         $('#videospace').animate({
878
             right: window.innerWidth - availableWidth,
819
             right: window.innerWidth - availableWidth,
879
             width: availableWidth,
820
             width: availableWidth,

+ 0
- 1
modules/keyboardshortcut/keyboardshortcut.js 查看文件

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

Loading…
取消
儲存