Browse Source

Set follow-me initial state after enable

j8
yanas 9 years ago
parent
commit
a3bfce4c40
2 changed files with 57 additions and 5 deletions
  1. 49
    5
      modules/FollowMe.js
  2. 8
    0
      modules/UI/UI.js

+ 49
- 5
modules/FollowMe.js View File

16
 
16
 
17
 import UIEvents from '../service/UI/UIEvents';
17
 import UIEvents from '../service/UI/UIEvents';
18
 import VideoLayout from './UI/videolayout/VideoLayout';
18
 import VideoLayout from './UI/videolayout/VideoLayout';
19
-import FilmStrip from './UI/videolayout/FilmStrip';
20
 
19
 
21
 /**
20
 /**
22
  * The (name of the) command which transports the state (represented by
21
  * The (name of the) command which transports the state (represented by
137
                 this._onFollowMeCommand.bind(this));
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
      * Adds listeners for the UI states of the local participant which are
163
      * Adds listeners for the UI states of the local participant which are
142
      * to be followed (by the remote participants). A non-moderator (very
164
      * to be followed (by the remote participants). A non-moderator (very
181
      * to disable it
203
      * to disable it
182
      */
204
      */
183
     enableFollowMe (enable) {
205
     enableFollowMe (enable) {
184
-        this.isEnabled = enable;
185
-        if (this.isEnabled)
206
+        if (enable) {
207
+            this._setFollowMeInitialState();
186
             this._addFollowMeListeners();
208
             this._addFollowMeListeners();
209
+        }
187
         else
210
         else
188
             this._removeFollowMeListeners();
211
             this._removeFollowMeListeners();
189
     }
212
     }
211
     }
234
     }
212
 
235
 
213
     /**
236
     /**
214
-     * Changes the nextOnPage property value.
237
+     * Changes the nextOnStage property value.
215
      *
238
      *
216
      * @param smallVideo the {SmallVideo} that was pinned or unpinned
239
      * @param smallVideo the {SmallVideo} that was pinned or unpinned
217
      * @param isPinned indicates if the given {SmallVideo} was pinned or
240
      * @param isPinned indicates if the given {SmallVideo} was pinned or
295
         this._onSharedDocumentVisible(attributes.sharedDocumentVisible);
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
     _onFilmStripVisible(filmStripVisible) {
328
     _onFilmStripVisible(filmStripVisible) {
299
         if (typeof filmStripVisible !== 'undefined') {
329
         if (typeof filmStripVisible !== 'undefined') {
300
             // XXX The Command(s) API doesn't preserve the types (of
330
             // XXX The Command(s) API doesn't preserve the types (of
307
             // eventEmitter as a public field. I'm not sure at the time of this
337
             // eventEmitter as a public field. I'm not sure at the time of this
308
             // writing whether calling UI.toggleFilmStrip() is acceptable (from
338
             // writing whether calling UI.toggleFilmStrip() is acceptable (from
309
             // a design standpoint) either.
339
             // a design standpoint) either.
310
-            if (filmStripVisible !== FilmStrip.isFilmStripVisible())
340
+            if (filmStripVisible !== this._UI.isFilmStripVisible())
311
                 this._UI.eventEmitter.emit(UIEvents.TOGGLE_FILM_STRIP);
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
     _onNextOnStage(id) {
352
     _onNextOnStage(id) {
316
         var clickId = null;
353
         var clickId = null;
317
         var pin;
354
         var pin;
328
             this._pinVideoThumbnailById(clickId, pin);
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
     _onSharedDocumentVisible(sharedDocumentVisible) {
375
     _onSharedDocumentVisible(sharedDocumentVisible) {
332
         if (typeof sharedDocumentVisible !== 'undefined') {
376
         if (typeof sharedDocumentVisible !== 'undefined') {
333
             // XXX The Command(s) API doesn't preserve the types (of
377
             // XXX The Command(s) API doesn't preserve the types (of

+ 8
- 0
modules/UI/UI.js View File

627
     self.toggleFilmStrip.apply(self, arguments);
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
  * Toggles chat panel.
639
  * Toggles chat panel.
632
  */
640
  */

Loading…
Cancel
Save