|
@@ -1,6 +1,5 @@
|
1
|
1
|
/* global $, APP, interfaceConfig */
|
2
|
2
|
|
3
|
|
-import { setFilmstripVisible } from '../../../react/features/filmstrip';
|
4
|
3
|
import {
|
5
|
4
|
LAYOUTS,
|
6
|
5
|
getCurrentLayout,
|
|
@@ -9,188 +8,16 @@ import {
|
9
|
8
|
shouldDisplayTileView
|
10
|
9
|
} from '../../../react/features/video-layout';
|
11
|
10
|
|
12
|
|
-import UIEvents from '../../../service/UI/UIEvents';
|
13
|
11
|
import UIUtil from '../util/UIUtil';
|
14
|
12
|
|
15
|
|
-import {
|
16
|
|
- createShortcutEvent,
|
17
|
|
- createToolbarEvent,
|
18
|
|
- sendAnalytics
|
19
|
|
-} from '../../../react/features/analytics';
|
20
|
|
-
|
21
|
13
|
const Filmstrip = {
|
22
|
14
|
/**
|
23
|
|
- *
|
24
|
|
- * @param eventEmitter the {EventEmitter} through which {Filmstrip} is to
|
25
|
|
- * emit/fire {UIEvents} (such as {UIEvents.TOGGLED_FILMSTRIP}).
|
|
15
|
+ * Caches jquery lookups of the filmstrip for future use.
|
26
|
16
|
*/
|
27
|
|
- init(eventEmitter) {
|
28
|
|
- this.iconMenuDownClassName = 'icon-menu-down';
|
29
|
|
- this.iconMenuUpClassName = 'icon-menu-up';
|
|
17
|
+ init() {
|
30
|
18
|
this.filmstripContainerClassName = 'filmstrip';
|
31
|
19
|
this.filmstrip = $('#remoteVideos');
|
32
|
20
|
this.filmstripRemoteVideos = $('#filmstripRemoteVideosContainer');
|
33
|
|
- this.eventEmitter = eventEmitter;
|
34
|
|
-
|
35
|
|
- // Show the toggle button and add event listeners only when out of
|
36
|
|
- // filmstrip only mode.
|
37
|
|
- if (!interfaceConfig.filmStripOnly) {
|
38
|
|
- this._initFilmstripToolbar();
|
39
|
|
- this.registerListeners();
|
40
|
|
- }
|
41
|
|
- },
|
42
|
|
-
|
43
|
|
- /**
|
44
|
|
- * Initializes the filmstrip toolbar.
|
45
|
|
- */
|
46
|
|
- _initFilmstripToolbar() {
|
47
|
|
- const toolbarContainerHTML = this._generateToolbarHTML();
|
48
|
|
- const className = this.filmstripContainerClassName;
|
49
|
|
- const container = document.querySelector(`.${className}`);
|
50
|
|
-
|
51
|
|
- UIUtil.prependChild(container, toolbarContainerHTML);
|
52
|
|
-
|
53
|
|
- const iconSelector = '#toggleFilmstripButton i';
|
54
|
|
-
|
55
|
|
- this.toggleFilmstripIcon = document.querySelector(iconSelector);
|
56
|
|
- },
|
57
|
|
-
|
58
|
|
- /**
|
59
|
|
- * Generates HTML layout for filmstrip toggle button and wrapping container.
|
60
|
|
- * @returns {HTMLElement}
|
61
|
|
- * @private
|
62
|
|
- */
|
63
|
|
- _generateToolbarHTML() {
|
64
|
|
- const container = document.createElement('div');
|
65
|
|
- const isVisible = this.isFilmstripVisible();
|
66
|
|
-
|
67
|
|
- container.className = 'filmstrip__toolbar';
|
68
|
|
- container.innerHTML = `
|
69
|
|
- <button id="toggleFilmstripButton">
|
70
|
|
- <i class="icon-menu-${isVisible ? 'down' : 'up'}">
|
71
|
|
- </i>
|
72
|
|
- </button>
|
73
|
|
- `;
|
74
|
|
-
|
75
|
|
- return container;
|
76
|
|
- },
|
77
|
|
-
|
78
|
|
- /**
|
79
|
|
- * Attach 'click' listener to "hide filmstrip" button
|
80
|
|
- */
|
81
|
|
- registerListeners() {
|
82
|
|
- // Important:
|
83
|
|
- // Firing the event instead of executing toggleFilmstrip method because
|
84
|
|
- // it's important to hide the filmstrip by UI.toggleFilmstrip in order
|
85
|
|
- // to correctly resize the video area.
|
86
|
|
- $('#toggleFilmstripButton').on(
|
87
|
|
- 'click',
|
88
|
|
- () => {
|
89
|
|
- // The 'enable' parameter is set to true if the action results
|
90
|
|
- // in the filmstrip being hidden.
|
91
|
|
- sendAnalytics(createToolbarEvent(
|
92
|
|
- 'toggle.filmstrip.button',
|
93
|
|
- {
|
94
|
|
- enable: this.isFilmstripVisible()
|
95
|
|
- }));
|
96
|
|
- this.eventEmitter.emit(UIEvents.TOGGLE_FILMSTRIP);
|
97
|
|
- });
|
98
|
|
-
|
99
|
|
- this._registerToggleFilmstripShortcut();
|
100
|
|
- },
|
101
|
|
-
|
102
|
|
- /**
|
103
|
|
- * Registering toggle filmstrip shortcut
|
104
|
|
- * @private
|
105
|
|
- */
|
106
|
|
- _registerToggleFilmstripShortcut() {
|
107
|
|
- const shortcut = 'F';
|
108
|
|
- const shortcutAttr = 'filmstripPopover';
|
109
|
|
- const description = 'keyboardShortcuts.toggleFilmstrip';
|
110
|
|
-
|
111
|
|
- // Important:
|
112
|
|
- // Firing the event instead of executing toggleFilmstrip method because
|
113
|
|
- // it's important to hide the filmstrip by UI.toggleFilmstrip in order
|
114
|
|
- // to correctly resize the video area.
|
115
|
|
- const handler = () => {
|
116
|
|
- sendAnalytics(createShortcutEvent(
|
117
|
|
- 'toggle.filmstrip',
|
118
|
|
- {
|
119
|
|
- enable: this.isFilmstripVisible()
|
120
|
|
- }));
|
121
|
|
- this.eventEmitter.emit(UIEvents.TOGGLE_FILMSTRIP);
|
122
|
|
- };
|
123
|
|
-
|
124
|
|
- APP.keyboardshortcut.registerShortcut(
|
125
|
|
- shortcut,
|
126
|
|
- shortcutAttr,
|
127
|
|
- handler,
|
128
|
|
- description
|
129
|
|
- );
|
130
|
|
- },
|
131
|
|
-
|
132
|
|
- /**
|
133
|
|
- * Changes classes of icon for showing down state
|
134
|
|
- */
|
135
|
|
- showMenuDownIcon() {
|
136
|
|
- const icon = this.toggleFilmstripIcon;
|
137
|
|
-
|
138
|
|
- if (icon) {
|
139
|
|
- icon.classList.add(this.iconMenuDownClassName);
|
140
|
|
- icon.classList.remove(this.iconMenuUpClassName);
|
141
|
|
- }
|
142
|
|
- },
|
143
|
|
-
|
144
|
|
- /**
|
145
|
|
- * Changes classes of icon for showing up state
|
146
|
|
- */
|
147
|
|
- showMenuUpIcon() {
|
148
|
|
- const icon = this.toggleFilmstripIcon;
|
149
|
|
-
|
150
|
|
- if (icon) {
|
151
|
|
- icon.classList.add(this.iconMenuUpClassName);
|
152
|
|
- icon.classList.remove(this.iconMenuDownClassName);
|
153
|
|
- }
|
154
|
|
- },
|
155
|
|
-
|
156
|
|
- /**
|
157
|
|
- * Toggles the visibility of the filmstrip, or sets it to a specific value
|
158
|
|
- * if the 'visible' parameter is specified.
|
159
|
|
- *
|
160
|
|
- * @param visible optional {Boolean} which specifies the desired visibility
|
161
|
|
- * of the filmstrip. If not specified, the visibility will be flipped
|
162
|
|
- * (i.e. toggled); otherwise, the visibility will be set to the specified
|
163
|
|
- * value.
|
164
|
|
- *
|
165
|
|
- * Note:
|
166
|
|
- * This method shouldn't be executed directly to hide the filmstrip.
|
167
|
|
- * It's important to hide the filmstrip with UI.toggleFilmstrip in order
|
168
|
|
- * to correctly resize the video area.
|
169
|
|
- */
|
170
|
|
- toggleFilmstrip(visible) {
|
171
|
|
- const wasFilmstripVisible = this.isFilmstripVisible();
|
172
|
|
-
|
173
|
|
- // If 'visible' is defined and matches the current state, we have
|
174
|
|
- // nothing to do. Otherwise (regardless of whether 'visible' is defined)
|
175
|
|
- // we need to toggle the state.
|
176
|
|
- if (visible === wasFilmstripVisible) {
|
177
|
|
- return;
|
178
|
|
- }
|
179
|
|
-
|
180
|
|
- this.filmstrip.toggleClass('hidden');
|
181
|
|
-
|
182
|
|
- if (wasFilmstripVisible) {
|
183
|
|
- this.showMenuUpIcon();
|
184
|
|
- } else {
|
185
|
|
- this.showMenuDownIcon();
|
186
|
|
- }
|
187
|
|
-
|
188
|
|
- if (this.eventEmitter) {
|
189
|
|
- this.eventEmitter.emit(
|
190
|
|
- UIEvents.TOGGLED_FILMSTRIP,
|
191
|
|
- !wasFilmstripVisible);
|
192
|
|
- }
|
193
|
|
- APP.store.dispatch(setFilmstripVisible(!wasFilmstripVisible));
|
194
|
21
|
},
|
195
|
22
|
|
196
|
23
|
/**
|
|
@@ -198,14 +25,7 @@ const Filmstrip = {
|
198
|
25
|
* @returns {boolean}
|
199
|
26
|
*/
|
200
|
27
|
isFilmstripVisible() {
|
201
|
|
- return !this.filmstrip.hasClass('hidden');
|
202
|
|
- },
|
203
|
|
-
|
204
|
|
- /**
|
205
|
|
- * Adjusts styles for filmstrip-only mode.
|
206
|
|
- */
|
207
|
|
- setFilmstripOnly() {
|
208
|
|
- this.filmstrip.addClass('filmstrip__videos-filmstripOnly');
|
|
28
|
+ return APP.store.getState()['features/filmstrip'].visible;
|
209
|
29
|
},
|
210
|
30
|
|
211
|
31
|
/**
|