Ver código fonte

Set follow-me initial state after enable

j8
yanas 9 anos atrás
pai
commit
a3bfce4c40
2 arquivos alterados com 57 adições e 5 exclusões
  1. 49
    5
      modules/FollowMe.js
  2. 8
    0
      modules/UI/UI.js

+ 49
- 5
modules/FollowMe.js Ver arquivo

@@ -16,7 +16,6 @@
16 16
 
17 17
 import UIEvents from '../service/UI/UIEvents';
18 18
 import VideoLayout from './UI/videolayout/VideoLayout';
19
-import FilmStrip from './UI/videolayout/FilmStrip';
20 19
 
21 20
 /**
22 21
  * The (name of the) command which transports the state (represented by
@@ -137,6 +136,29 @@ class FollowMe {
137 136
                 this._onFollowMeCommand.bind(this));
138 137
     }
139 138
 
139
+    /**
140
+     * Sets the current state of all follow-me properties, which will fire a
141
+     * localPropertyChangeEvent and trigger a send of the follow-me command.
142
+     * @private
143
+     */
144
+    _setFollowMeInitialState() {
145
+        this._filmStripToggled.bind(this, this._UI.isFilmStripVisible());
146
+
147
+        var pinnedId = VideoLayout.getPinnedId();
148
+        var isPinned = false;
149
+        var smallVideo;
150
+        if (pinnedId) {
151
+            isPinned = true;
152
+            smallVideo = VideoLayout.getSmallVideo(pinnedId);
153
+        }
154
+
155
+        this._nextOnStage(smallVideo, isPinned);
156
+
157
+        this._sharedDocumentToggled
158
+            .bind(this, this._UI.getSharedDocumentManager().isVisible());
159
+
160
+    }
161
+
140 162
     /**
141 163
      * Adds listeners for the UI states of the local participant which are
142 164
      * to be followed (by the remote participants). A non-moderator (very
@@ -181,9 +203,10 @@ class FollowMe {
181 203
      * to disable it
182 204
      */
183 205
     enableFollowMe (enable) {
184
-        this.isEnabled = enable;
185
-        if (this.isEnabled)
206
+        if (enable) {
207
+            this._setFollowMeInitialState();
186 208
             this._addFollowMeListeners();
209
+        }
187 210
         else
188 211
             this._removeFollowMeListeners();
189 212
     }
@@ -211,7 +234,7 @@ class FollowMe {
211 234
     }
212 235
 
213 236
     /**
214
-     * Changes the nextOnPage property value.
237
+     * Changes the nextOnStage property value.
215 238
      *
216 239
      * @param smallVideo the {SmallVideo} that was pinned or unpinned
217 240
      * @param isPinned indicates if the given {SmallVideo} was pinned or
@@ -295,6 +318,13 @@ class FollowMe {
295 318
         this._onSharedDocumentVisible(attributes.sharedDocumentVisible);
296 319
     }
297 320
 
321
+    /**
322
+     * Process a film strip open / close event received from FOLLOW-ME
323
+     * command.
324
+     * @param filmStripVisible indicates if the film strip has been shown or
325
+     * hidden
326
+     * @private
327
+     */
298 328
     _onFilmStripVisible(filmStripVisible) {
299 329
         if (typeof filmStripVisible !== 'undefined') {
300 330
             // XXX The Command(s) API doesn't preserve the types (of
@@ -307,11 +337,18 @@ class FollowMe {
307 337
             // eventEmitter as a public field. I'm not sure at the time of this
308 338
             // writing whether calling UI.toggleFilmStrip() is acceptable (from
309 339
             // a design standpoint) either.
310
-            if (filmStripVisible !== FilmStrip.isFilmStripVisible())
340
+            if (filmStripVisible !== this._UI.isFilmStripVisible())
311 341
                 this._UI.eventEmitter.emit(UIEvents.TOGGLE_FILM_STRIP);
312 342
         }
313 343
     }
314 344
 
345
+    /**
346
+     * Process the id received from a FOLLOW-ME command.
347
+     * @param id the identifier of the next participant to show on stage or
348
+     * undefined if we're clearing the stage (we're unpining all pined and we
349
+     * rely on dominant speaker events)
350
+     * @private
351
+     */
315 352
     _onNextOnStage(id) {
316 353
         var clickId = null;
317 354
         var pin;
@@ -328,6 +365,13 @@ class FollowMe {
328 365
             this._pinVideoThumbnailById(clickId, pin);
329 366
     }
330 367
 
368
+    /**
369
+     * Process a shared document open / close event received from FOLLOW-ME
370
+     * command.
371
+     * @param sharedDocumentVisible indicates if the shared document has been
372
+     * opened or closed
373
+     * @private
374
+     */
331 375
     _onSharedDocumentVisible(sharedDocumentVisible) {
332 376
         if (typeof sharedDocumentVisible !== 'undefined') {
333 377
             // XXX The Command(s) API doesn't preserve the types (of

+ 8
- 0
modules/UI/UI.js Ver arquivo

@@ -627,6 +627,14 @@ UI.toggleFilmStrip = function () {
627 627
     self.toggleFilmStrip.apply(self, arguments);
628 628
 };
629 629
 
630
+/**
631
+ * Indicates if the film strip is currently visible or not.
632
+ * @returns {true} if the film strip is currently visible, otherwise
633
+ */
634
+UI.isFilmStripVisible = function () {
635
+    return FilmStrip.isFilmStripVisible();
636
+};
637
+
630 638
 /**
631 639
  * Toggles chat panel.
632 640
  */

Carregando…
Cancelar
Salvar