ref: Tweak logging logic for thumbnail display mode and tile view.

This commit is contained in:
George Politis 2019-09-17 15:01:46 +02:00
parent 00c8409e31
commit fb1ed22c6c
1 changed files with 20 additions and 27 deletions

View File

@ -520,40 +520,33 @@ SmallVideo.prototype.isVideoPlayable = function() {
* @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt> * @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
* or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>. * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
*/ */
SmallVideo.prototype.selectDisplayMode = function() { SmallVideo.prototype.selectDisplayMode = function(input) {
const isAudioOnly = APP.conference.isAudioOnly();
const tileViewEnabled = shouldDisplayTileView(APP.store.getState());
const isVideoPlayable = this.isVideoPlayable();
const hasVideo = Boolean(this.selectVideoElement().length);
// Display name is always and only displayed when user is on the stage // Display name is always and only displayed when user is on the stage
if (this.isCurrentlyOnLargeVideo() && !tileViewEnabled) { if (input.isCurrentlyOnLargeVideo && !input.tileViewEnabled) {
return isVideoPlayable && !isAudioOnly ? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME; return input.isVideoPlayable && !input.isAudioOnly ? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME;
} else if (isVideoPlayable && hasVideo && !isAudioOnly) { } else if (input.isVideoPlayable && input.hasVideo && !input.isAudioOnly) {
// check hovering and change state to video with name // check hovering and change state to video with name
return this._isHovered() ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO; return input.isHovered ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
} }
// check hovering and change state to avatar with name // check hovering and change state to avatar with name
return this._isHovered() ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR; return input.isHovered ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
}; };
/** /**
* Prints information about the current display mode. * Computes information that determine the display mode.
* *
* @param {string} mode - The current mode. * @returns {Object}
* @returns {void}
*/ */
SmallVideo.prototype._printDisplayModeInfo = function(mode) { SmallVideo.prototype.computeDisplayModeInput = function() {
const isAudioOnly = APP.conference.isAudioOnly(); return {
const tileViewEnabled = shouldDisplayTileView(APP.store.getState()); isCurrentlyOnLargeVideo: this.isCurrentlyOnLargeVideo(),
const isVideoPlayable = this.isVideoPlayable(); isHovered: this._isHovered(),
const hasVideo = Boolean(this.selectVideoElement().length); isAudioOnly: APP.conference.isAudioOnly(),
const displayModeInfo = { tileViewEnabled: shouldDisplayTileView(APP.store.getState()),
isAudioOnly, isVideoPlayable: this.isVideoPlayable(),
tileViewEnabled, hasVideo: Boolean(this.selectVideoElement().length),
isVideoPlayable,
hasVideo,
connectionStatus: APP.conference.getParticipantConnectionStatus(this.id), connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
mutedWhileDisconnected: this.mutedWhileDisconnected, mutedWhileDisconnected: this.mutedWhileDisconnected,
wasVideoPlayed: this.wasVideoPlayed, wasVideoPlayed: this.wasVideoPlayed,
@ -561,8 +554,6 @@ SmallVideo.prototype._printDisplayModeInfo = function(mode) {
isVideoMuted: this.isVideoMuted, isVideoMuted: this.isVideoMuted,
videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream' videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
}; };
logger.debug(`Displaying ${mode} for ${this.id}, reason: [${JSON.stringify(displayModeInfo)}]`);
}; };
/** /**
@ -596,8 +587,10 @@ SmallVideo.prototype.updateView = function() {
const oldDisplayMode = this.displayMode; const oldDisplayMode = this.displayMode;
let displayModeString = ''; let displayModeString = '';
const displayModeInput = this.computeDisplayModeInput();
// Determine whether video, avatar or blackness should be displayed // Determine whether video, avatar or blackness should be displayed
this.displayMode = this.selectDisplayMode(); this.displayMode = this.selectDisplayMode(displayModeInput);
switch (this.displayMode) { switch (this.displayMode) {
case DISPLAY_AVATAR_WITH_NAME: case DISPLAY_AVATAR_WITH_NAME:
@ -624,7 +617,7 @@ SmallVideo.prototype.updateView = function() {
} }
if (this.displayMode !== oldDisplayMode) { if (this.displayMode !== oldDisplayMode) {
this._printDisplayModeInfo(displayModeString); logger.debug(`Displaying ${displayModeString} for ${this.id}, reason: [${JSON.stringify(displayModeInput)}]`);
} }
}; };