|
|
@@ -25,6 +25,15 @@ import FilmStrip from './UI/videolayout/FilmStrip';
|
|
25
|
25
|
*/
|
|
26
|
26
|
const _COMMAND = "follow-me";
|
|
27
|
27
|
|
|
|
28
|
+/**
|
|
|
29
|
+ * The timeout after which a follow-me command that has been received will be
|
|
|
30
|
+ * ignored if not consumed.
|
|
|
31
|
+ *
|
|
|
32
|
+ * @type {number} in seconds
|
|
|
33
|
+ * @private
|
|
|
34
|
+ */
|
|
|
35
|
+const _FOLLOW_ME_RECEIVED_TIMEOUT = 30;
|
|
|
36
|
+
|
|
28
|
37
|
/**
|
|
29
|
38
|
* Represents the set of {FollowMe}-related states (properties and their
|
|
30
|
39
|
* respective values) which are to be followed by a participant. {FollowMe}
|
|
|
@@ -112,6 +121,7 @@ class FollowMe {
|
|
112
|
121
|
constructor (conference, UI) {
|
|
113
|
122
|
this._conference = conference;
|
|
114
|
123
|
this._UI = UI;
|
|
|
124
|
+ this.nextOnStageTimer = 0;
|
|
115
|
125
|
|
|
116
|
126
|
// The states of the local participant which are to be followed (by the
|
|
117
|
127
|
// remote participants when the local participant is in her right to
|
|
|
@@ -265,6 +275,7 @@ class FollowMe {
|
|
265
|
275
|
// issued by a defined commander.
|
|
266
|
276
|
if (typeof id === 'undefined')
|
|
267
|
277
|
return;
|
|
|
278
|
+
|
|
268
|
279
|
// The Command(s) API will send us our own commands and we don't want
|
|
269
|
280
|
// to act upon them.
|
|
270
|
281
|
if (this._conference.isLocalId(id))
|
|
|
@@ -297,22 +308,24 @@ class FollowMe {
|
|
297
|
308
|
// writing whether calling UI.toggleFilmStrip() is acceptable (from
|
|
298
|
309
|
// a design standpoint) either.
|
|
299
|
310
|
if (filmStripVisible !== FilmStrip.isFilmStripVisible())
|
|
300
|
|
- this._UI.eventEmitter.emit(
|
|
301
|
|
- UIEvents.TOGGLE_FILM_STRIP,
|
|
302
|
|
- filmStripVisible);
|
|
|
311
|
+ this._UI.eventEmitter.emit(UIEvents.TOGGLE_FILM_STRIP);
|
|
303
|
312
|
}
|
|
304
|
313
|
}
|
|
305
|
314
|
|
|
306
|
315
|
_onNextOnStage(id) {
|
|
307
|
|
-
|
|
308
|
316
|
var clickId = null;
|
|
309
|
|
- if(typeof id !== 'undefined' && !VideoLayout.isPinned(id))
|
|
|
317
|
+ var pin;
|
|
|
318
|
+ if(typeof id !== 'undefined' && !VideoLayout.isPinned(id)) {
|
|
310
|
319
|
clickId = id;
|
|
311
|
|
- else if (typeof id == 'undefined' && VideoLayout.getPinnedId())
|
|
|
320
|
+ pin = true;
|
|
|
321
|
+ }
|
|
|
322
|
+ else if (typeof id == 'undefined' && VideoLayout.getPinnedId()) {
|
|
312
|
323
|
clickId = VideoLayout.getPinnedId();
|
|
|
324
|
+ pin = false;
|
|
|
325
|
+ }
|
|
313
|
326
|
|
|
314
|
327
|
if (clickId)
|
|
315
|
|
- VideoLayout.handleVideoThumbClicked(clickId);
|
|
|
328
|
+ this._pinVideoThumbnailById(clickId, pin);
|
|
316
|
329
|
}
|
|
317
|
330
|
|
|
318
|
331
|
_onSharedDocumentVisible(sharedDocumentVisible) {
|
|
|
@@ -328,6 +341,41 @@ class FollowMe {
|
|
328
|
341
|
this._UI.getSharedDocumentManager().toggleEtherpad();
|
|
329
|
342
|
}
|
|
330
|
343
|
}
|
|
|
344
|
+
|
|
|
345
|
+ /**
|
|
|
346
|
+ * Pins / unpins the video thumbnail given by clickId.
|
|
|
347
|
+ *
|
|
|
348
|
+ * @param clickId the identifier of the video thumbnail to pin or unpin
|
|
|
349
|
+ * @param pin {true} to pin, {false} to unpin
|
|
|
350
|
+ * @private
|
|
|
351
|
+ */
|
|
|
352
|
+ _pinVideoThumbnailById(clickId, pin) {
|
|
|
353
|
+ var self = this;
|
|
|
354
|
+ var smallVideo = VideoLayout.getSmallVideo(clickId);
|
|
|
355
|
+
|
|
|
356
|
+ // If the SmallVideo for the given clickId exists we proceed with the
|
|
|
357
|
+ // pin/unpin.
|
|
|
358
|
+ if (smallVideo) {
|
|
|
359
|
+ this.nextOnStageTimer = 0;
|
|
|
360
|
+ clearTimeout(this.nextOnStageTimout);
|
|
|
361
|
+ if (pin && !VideoLayout.isPinned(clickId)
|
|
|
362
|
+ || !pin && VideoLayout.isPinned(clickId))
|
|
|
363
|
+ VideoLayout.handleVideoThumbClicked(clickId);
|
|
|
364
|
+ }
|
|
|
365
|
+ // If there's no SmallVideo object for the given id, lets wait and see
|
|
|
366
|
+ // if it's going to be created in the next 30sec.
|
|
|
367
|
+ else {
|
|
|
368
|
+ this.nextOnStageTimout = setTimeout(function () {
|
|
|
369
|
+ if (self.nextOnStageTimer > _FOLLOW_ME_RECEIVED_TIMEOUT) {
|
|
|
370
|
+ self.nextOnStageTimer = 0;
|
|
|
371
|
+ return;
|
|
|
372
|
+ }
|
|
|
373
|
+
|
|
|
374
|
+ this.nextOnStageTimer++;
|
|
|
375
|
+ self._pinVideoThumbnailById(clickId, pin);
|
|
|
376
|
+ }, 1000);
|
|
|
377
|
+ }
|
|
|
378
|
+ }
|
|
331
|
379
|
}
|
|
332
|
380
|
|
|
333
|
381
|
export default FollowMe;
|