Merge pull request #582 from jitsi/set-follow-me-initial

Init follow me attributes after enable
This commit is contained in:
damencho 2016-04-01 17:29:26 -05:00
commit e579a41284
2 changed files with 57 additions and 5 deletions

View File

@ -16,7 +16,6 @@
import UIEvents from '../service/UI/UIEvents'; import UIEvents from '../service/UI/UIEvents';
import VideoLayout from './UI/videolayout/VideoLayout'; import VideoLayout from './UI/videolayout/VideoLayout';
import FilmStrip from './UI/videolayout/FilmStrip';
/** /**
* The (name of the) command which transports the state (represented by * The (name of the) command which transports the state (represented by
@ -137,6 +136,29 @@ class FollowMe {
this._onFollowMeCommand.bind(this)); this._onFollowMeCommand.bind(this));
} }
/**
* Sets the current state of all follow-me properties, which will fire a
* localPropertyChangeEvent and trigger a send of the follow-me command.
* @private
*/
_setFollowMeInitialState() {
this._filmStripToggled.bind(this, this._UI.isFilmStripVisible());
var pinnedId = VideoLayout.getPinnedId();
var isPinned = false;
var smallVideo;
if (pinnedId) {
isPinned = true;
smallVideo = VideoLayout.getSmallVideo(pinnedId);
}
this._nextOnStage(smallVideo, isPinned);
this._sharedDocumentToggled
.bind(this, this._UI.getSharedDocumentManager().isVisible());
}
/** /**
* Adds listeners for the UI states of the local participant which are * Adds listeners for the UI states of the local participant which are
* to be followed (by the remote participants). A non-moderator (very * to be followed (by the remote participants). A non-moderator (very
@ -181,9 +203,10 @@ class FollowMe {
* to disable it * to disable it
*/ */
enableFollowMe (enable) { enableFollowMe (enable) {
this.isEnabled = enable; if (enable) {
if (this.isEnabled) this._setFollowMeInitialState();
this._addFollowMeListeners(); this._addFollowMeListeners();
}
else else
this._removeFollowMeListeners(); this._removeFollowMeListeners();
} }
@ -211,7 +234,7 @@ class FollowMe {
} }
/** /**
* Changes the nextOnPage property value. * Changes the nextOnStage property value.
* *
* @param smallVideo the {SmallVideo} that was pinned or unpinned * @param smallVideo the {SmallVideo} that was pinned or unpinned
* @param isPinned indicates if the given {SmallVideo} was pinned or * @param isPinned indicates if the given {SmallVideo} was pinned or
@ -295,6 +318,13 @@ class FollowMe {
this._onSharedDocumentVisible(attributes.sharedDocumentVisible); this._onSharedDocumentVisible(attributes.sharedDocumentVisible);
} }
/**
* Process a film strip open / close event received from FOLLOW-ME
* command.
* @param filmStripVisible indicates if the film strip has been shown or
* hidden
* @private
*/
_onFilmStripVisible(filmStripVisible) { _onFilmStripVisible(filmStripVisible) {
if (typeof filmStripVisible !== 'undefined') { if (typeof filmStripVisible !== 'undefined') {
// XXX The Command(s) API doesn't preserve the types (of // XXX The Command(s) API doesn't preserve the types (of
@ -307,11 +337,18 @@ class FollowMe {
// eventEmitter as a public field. I'm not sure at the time of this // eventEmitter as a public field. I'm not sure at the time of this
// writing whether calling UI.toggleFilmStrip() is acceptable (from // writing whether calling UI.toggleFilmStrip() is acceptable (from
// a design standpoint) either. // a design standpoint) either.
if (filmStripVisible !== FilmStrip.isFilmStripVisible()) if (filmStripVisible !== this._UI.isFilmStripVisible())
this._UI.eventEmitter.emit(UIEvents.TOGGLE_FILM_STRIP); this._UI.eventEmitter.emit(UIEvents.TOGGLE_FILM_STRIP);
} }
} }
/**
* Process the id received from a FOLLOW-ME command.
* @param id the identifier of the next participant to show on stage or
* undefined if we're clearing the stage (we're unpining all pined and we
* rely on dominant speaker events)
* @private
*/
_onNextOnStage(id) { _onNextOnStage(id) {
var clickId = null; var clickId = null;
var pin; var pin;
@ -328,6 +365,13 @@ class FollowMe {
this._pinVideoThumbnailById(clickId, pin); this._pinVideoThumbnailById(clickId, pin);
} }
/**
* Process a shared document open / close event received from FOLLOW-ME
* command.
* @param sharedDocumentVisible indicates if the shared document has been
* opened or closed
* @private
*/
_onSharedDocumentVisible(sharedDocumentVisible) { _onSharedDocumentVisible(sharedDocumentVisible) {
if (typeof sharedDocumentVisible !== 'undefined') { if (typeof sharedDocumentVisible !== 'undefined') {
// XXX The Command(s) API doesn't preserve the types (of // XXX The Command(s) API doesn't preserve the types (of

View File

@ -627,6 +627,14 @@ UI.toggleFilmStrip = function () {
self.toggleFilmStrip.apply(self, arguments); self.toggleFilmStrip.apply(self, arguments);
}; };
/**
* Indicates if the film strip is currently visible or not.
* @returns {true} if the film strip is currently visible, otherwise
*/
UI.isFilmStripVisible = function () {
return FilmStrip.isFilmStripVisible();
};
/** /**
* Toggles chat panel. * Toggles chat panel.
*/ */