2018-06-27 09:43:13 +00:00
|
|
|
/* global $, APP, interfaceConfig */
|
2017-06-19 19:06:23 +00:00
|
|
|
|
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2017-06-29 03:35:43 +00:00
|
|
|
import { I18nextProvider } from 'react-i18next';
|
2017-10-06 16:14:45 +00:00
|
|
|
import { AtlasKitThemeProvider } from '@atlaskit/theme';
|
2017-06-29 03:35:43 +00:00
|
|
|
import { Provider } from 'react-redux';
|
2017-06-19 19:06:23 +00:00
|
|
|
|
2017-06-29 03:35:43 +00:00
|
|
|
import { i18next } from '../../../react/features/base/i18n';
|
2017-06-19 19:06:23 +00:00
|
|
|
import { AudioLevelIndicator }
|
|
|
|
from '../../../react/features/audio-level-indicator';
|
2017-06-29 18:21:03 +00:00
|
|
|
import {
|
2017-12-19 23:11:54 +00:00
|
|
|
Avatar as AvatarDisplay,
|
2018-05-18 19:59:07 +00:00
|
|
|
getAvatarURLByParticipantId,
|
|
|
|
getPinnedParticipant,
|
|
|
|
pinParticipant
|
2017-06-29 18:21:03 +00:00
|
|
|
} from '../../../react/features/base/participants';
|
2017-06-19 20:20:13 +00:00
|
|
|
import {
|
|
|
|
ConnectionIndicator
|
|
|
|
} from '../../../react/features/connection-indicator';
|
2017-06-29 03:35:43 +00:00
|
|
|
import { DisplayName } from '../../../react/features/display-name';
|
2017-06-19 16:01:44 +00:00
|
|
|
import {
|
|
|
|
AudioMutedIndicator,
|
2017-07-10 22:29:44 +00:00
|
|
|
DominantSpeakerIndicator,
|
2017-06-19 16:01:44 +00:00
|
|
|
ModeratorIndicator,
|
2017-07-10 22:29:44 +00:00
|
|
|
RaisedHandIndicator,
|
2017-06-19 16:01:44 +00:00
|
|
|
VideoMutedIndicator
|
|
|
|
} from '../../../react/features/filmstrip';
|
2018-08-08 18:48:23 +00:00
|
|
|
import {
|
|
|
|
LAYOUTS,
|
|
|
|
getCurrentLayout,
|
2018-09-11 18:09:07 +00:00
|
|
|
setTileView,
|
2018-08-08 18:48:23 +00:00
|
|
|
shouldDisplayTileView
|
|
|
|
} from '../../../react/features/video-layout';
|
2017-06-19 16:01:44 +00:00
|
|
|
/* eslint-enable no-unused-vars */
|
2017-06-19 19:06:23 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
2016-11-11 15:00:54 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
import UIUtil from '../util/UIUtil';
|
|
|
|
import UIEvents from '../../../service/UI/UIEvents';
|
2015-12-14 12:26:50 +00:00
|
|
|
|
2016-09-19 20:59:56 +00:00
|
|
|
/**
|
|
|
|
* Display mode constant used when video is being displayed on the small video.
|
|
|
|
* @type {number}
|
|
|
|
* @constant
|
|
|
|
*/
|
|
|
|
const DISPLAY_VIDEO = 0;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-09-19 20:59:56 +00:00
|
|
|
/**
|
|
|
|
* Display mode constant used when the user's avatar is being displayed on
|
|
|
|
* the small video.
|
|
|
|
* @type {number}
|
|
|
|
* @constant
|
|
|
|
*/
|
|
|
|
const DISPLAY_AVATAR = 1;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-09-19 20:59:56 +00:00
|
|
|
/**
|
|
|
|
* Display mode constant used when neither video nor avatar is being displayed
|
2016-10-27 18:17:17 +00:00
|
|
|
* on the small video. And we just show the display name.
|
2016-09-19 20:59:56 +00:00
|
|
|
* @type {number}
|
|
|
|
* @constant
|
|
|
|
*/
|
2016-10-27 18:17:17 +00:00
|
|
|
const DISPLAY_BLACKNESS_WITH_NAME = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display mode constant used when video is displayed and display name
|
|
|
|
* at the same time.
|
|
|
|
* @type {number}
|
|
|
|
* @constant
|
|
|
|
*/
|
|
|
|
const DISPLAY_VIDEO_WITH_NAME = 3;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display mode constant used when neither video nor avatar is being displayed
|
|
|
|
* on the small video. And we just show the display name.
|
|
|
|
* @type {number}
|
|
|
|
* @constant
|
|
|
|
*/
|
|
|
|
const DISPLAY_AVATAR_WITH_NAME = 4;
|
2016-09-19 20:59:56 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*/
|
2016-03-15 20:42:53 +00:00
|
|
|
function SmallVideo(VideoLayout) {
|
2017-06-19 16:01:44 +00:00
|
|
|
this._isModerator = false;
|
2016-09-21 18:10:11 +00:00
|
|
|
this.isAudioMuted = false;
|
2015-06-29 14:24:21 +00:00
|
|
|
this.hasAvatar = false;
|
2016-01-14 16:28:24 +00:00
|
|
|
this.isVideoMuted = false;
|
2016-01-29 00:33:27 +00:00
|
|
|
this.videoStream = null;
|
|
|
|
this.audioStream = null;
|
2016-03-15 20:42:53 +00:00
|
|
|
this.VideoLayout = VideoLayout;
|
2016-10-27 18:17:17 +00:00
|
|
|
this.videoIsHovered = false;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-11-04 22:02:30 +00:00
|
|
|
// we can stop updating the thumbnail
|
|
|
|
this.disableUpdateView = false;
|
2017-06-19 20:20:13 +00:00
|
|
|
|
|
|
|
/**
|
2017-07-05 18:17:30 +00:00
|
|
|
* The current state of the user's bridge connection. The value should be
|
|
|
|
* a string as enumerated in the library's participantConnectionStatus
|
|
|
|
* constants.
|
2017-06-19 20:20:13 +00:00
|
|
|
*
|
|
|
|
* @private
|
2017-07-05 18:17:30 +00:00
|
|
|
* @type {string|null}
|
2017-06-19 20:20:13 +00:00
|
|
|
*/
|
2017-07-05 18:17:30 +00:00
|
|
|
this._connectionStatus = null;
|
2017-06-19 20:20:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the ConnectionIndicator's popover is hovered. Modifies
|
|
|
|
* how the video overlays display based on hover state.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
this._popoverIsHovered = false;
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the connection indicator should be displayed.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2018-07-06 15:24:38 +00:00
|
|
|
this._showConnectionIndicator
|
|
|
|
= !interfaceConfig.CONNECTION_INDICATOR_DISABLED;
|
2017-07-10 22:29:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the dominant speaker indicator should be displayed.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
this._showDominantSpeaker = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the raised hand indicator should be displayed.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
this._showRaisedHand = false;
|
|
|
|
|
2017-06-19 20:20:13 +00:00
|
|
|
// Bind event handlers so they are only bound once for every instance.
|
|
|
|
this._onPopoverHover = this._onPopoverHover.bind(this);
|
|
|
|
this.updateView = this.updateView.bind(this);
|
2018-11-30 22:13:39 +00:00
|
|
|
|
|
|
|
this._onContainerClick = this._onContainerClick.bind(this);
|
|
|
|
this._onContainerDoubleClick = this._onContainerDoubleClick.bind(this);
|
2015-06-29 14:24:21 +00:00
|
|
|
}
|
|
|
|
|
2016-03-24 01:43:29 +00:00
|
|
|
/**
|
|
|
|
* Returns the identifier of this small video.
|
|
|
|
*
|
|
|
|
* @returns the identifier of this small video
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.getId = function() {
|
2016-03-24 01:43:29 +00:00
|
|
|
return this.id;
|
|
|
|
};
|
2016-01-29 00:33:27 +00:00
|
|
|
|
|
|
|
/* Indicates if this small video is currently visible.
|
2016-01-26 21:26:28 +00:00
|
|
|
*
|
|
|
|
* @return <tt>true</tt> if this small video isn't currently visible and
|
|
|
|
* <tt>false</tt> - otherwise.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.isVisible = function() {
|
2017-06-30 23:07:37 +00:00
|
|
|
return this.$container.is(':visible');
|
2016-01-26 21:26:28 +00:00
|
|
|
};
|
|
|
|
|
2015-08-05 12:09:12 +00:00
|
|
|
/**
|
|
|
|
* Sets the type of the video displayed by this instance.
|
2016-11-08 02:38:14 +00:00
|
|
|
* Note that this is a string without clearly defined or checked values, and
|
|
|
|
* it is NOT one of the strings defined in service/RTC/VideoType in
|
|
|
|
* lib-jitsi-meet.
|
|
|
|
* @param videoType 'camera' or 'desktop', or 'sharedvideo'.
|
2015-08-05 12:09:12 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.setVideoType = function(videoType) {
|
2015-08-05 12:09:12 +00:00
|
|
|
this.videoType = videoType;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the type of the video displayed by this instance.
|
2016-11-08 02:38:14 +00:00
|
|
|
* Note that this is a string without clearly defined or checked values, and
|
|
|
|
* it is NOT one of the strings defined in service/RTC/VideoType in
|
|
|
|
* lib-jitsi-meet.
|
|
|
|
* @returns {String} 'camera', 'screen', 'sharedvideo', or undefined.
|
2015-08-05 12:09:12 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.getVideoType = function() {
|
2015-08-05 12:09:12 +00:00
|
|
|
return this.videoType;
|
|
|
|
};
|
|
|
|
|
2015-06-23 08:00:46 +00:00
|
|
|
/**
|
2015-10-01 20:10:55 +00:00
|
|
|
* Creates an audio or video element for a particular MediaStream.
|
2015-06-23 08:00:46 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.createStreamElement = function(stream) {
|
|
|
|
const isVideo = stream.isVideoTrack();
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const element = isVideo
|
2015-12-14 12:26:50 +00:00
|
|
|
? document.createElement('video')
|
2015-06-23 08:00:46 +00:00
|
|
|
: document.createElement('audio');
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-10-28 17:04:34 +00:00
|
|
|
if (isVideo) {
|
2017-10-12 23:02:29 +00:00
|
|
|
element.setAttribute('muted', 'true');
|
2015-10-28 17:04:34 +00:00
|
|
|
}
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2018-06-27 09:43:13 +00:00
|
|
|
element.autoplay = true;
|
2016-02-23 22:47:55 +00:00
|
|
|
element.id = SmallVideo.getStreamElementID(stream);
|
2015-10-01 20:10:55 +00:00
|
|
|
|
2015-06-23 08:00:46 +00:00
|
|
|
return element;
|
|
|
|
};
|
|
|
|
|
2016-02-23 22:47:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the element id for a particular MediaStream.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.getStreamElementID = function(stream) {
|
|
|
|
const isVideo = stream.isVideoTrack();
|
2016-02-23 22:47:55 +00:00
|
|
|
|
|
|
|
return (isVideo ? 'remoteVideo_' : 'remoteAudio_') + stream.getId();
|
|
|
|
};
|
|
|
|
|
2016-10-26 20:45:51 +00:00
|
|
|
/**
|
2016-10-27 18:17:17 +00:00
|
|
|
* Configures hoverIn/hoverOut handlers. Depends on connection indicator.
|
2016-10-26 20:45:51 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.bindHoverHandler = function() {
|
2016-10-26 20:45:51 +00:00
|
|
|
// Add hover handler
|
2017-06-30 23:07:37 +00:00
|
|
|
this.$container.hover(
|
2016-10-26 22:18:36 +00:00
|
|
|
() => {
|
2016-10-27 18:17:17 +00:00
|
|
|
this.videoIsHovered = true;
|
|
|
|
this.updateView();
|
2017-09-26 16:55:09 +00:00
|
|
|
this.updateIndicators();
|
2016-10-26 20:45:51 +00:00
|
|
|
},
|
2016-10-26 22:18:36 +00:00
|
|
|
() => {
|
2016-10-27 18:17:17 +00:00
|
|
|
this.videoIsHovered = false;
|
|
|
|
this.updateView();
|
2017-09-26 16:55:09 +00:00
|
|
|
this.updateIndicators();
|
2016-10-26 20:45:51 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2017-06-19 20:20:13 +00:00
|
|
|
/**
|
|
|
|
* Unmounts the ConnectionIndicator component.
|
|
|
|
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.removeConnectionIndicator = function() {
|
2017-07-10 22:29:44 +00:00
|
|
|
this._showConnectionIndicator = false;
|
2017-06-19 20:20:13 +00:00
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
this.updateIndicators();
|
2015-07-28 21:52:32 +00:00
|
|
|
};
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2017-06-19 20:20:13 +00:00
|
|
|
/**
|
|
|
|
* Updates the connectionStatus stat which displays in the ConnectionIndicator.
|
|
|
|
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.updateConnectionStatus = function(connectionStatus) {
|
2017-07-05 18:17:30 +00:00
|
|
|
this._connectionStatus = connectionStatus;
|
|
|
|
this.updateIndicators();
|
2017-06-19 20:20:13 +00:00
|
|
|
};
|
2015-06-23 08:00:46 +00:00
|
|
|
|
|
|
|
/**
|
2016-09-18 21:35:35 +00:00
|
|
|
* Shows / hides the audio muted indicator over small videos.
|
|
|
|
*
|
2016-09-19 23:04:55 +00:00
|
|
|
* @param {boolean} isMuted indicates if the muted element should be shown
|
2016-09-18 21:35:35 +00:00
|
|
|
* or hidden
|
2015-06-23 08:00:46 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.showAudioIndicator = function(isMuted) {
|
2016-11-10 12:45:42 +00:00
|
|
|
this.isAudioMuted = isMuted;
|
2017-06-19 16:01:44 +00:00
|
|
|
this.updateStatusBar();
|
2016-09-18 21:35:35 +00:00
|
|
|
};
|
|
|
|
|
2015-06-23 08:00:46 +00:00
|
|
|
/**
|
2016-01-14 16:28:24 +00:00
|
|
|
* Shows video muted indicator over small videos and disables/enables avatar
|
|
|
|
* if video muted.
|
2016-09-19 23:04:55 +00:00
|
|
|
*
|
|
|
|
* @param {boolean} isMuted indicates if we should set the view to muted view
|
|
|
|
* or not
|
2015-06-23 08:00:46 +00:00
|
|
|
*/
|
2016-09-28 21:31:40 +00:00
|
|
|
SmallVideo.prototype.setVideoMutedView = function(isMuted) {
|
2016-01-14 16:28:24 +00:00
|
|
|
this.isVideoMuted = isMuted;
|
|
|
|
this.updateView();
|
2016-11-04 14:48:52 +00:00
|
|
|
|
2017-06-19 16:01:44 +00:00
|
|
|
this.updateStatusBar();
|
2015-06-23 08:00:46 +00:00
|
|
|
};
|
|
|
|
|
2016-09-18 21:35:35 +00:00
|
|
|
/**
|
2017-06-19 16:01:44 +00:00
|
|
|
* Create or updates the ReactElement for displaying status indicators about
|
|
|
|
* audio mute, video mute, and moderator status.
|
2016-09-18 21:35:35 +00:00
|
|
|
*
|
2017-06-19 16:01:44 +00:00
|
|
|
* @returns {void}
|
2016-09-18 21:35:35 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.updateStatusBar = function() {
|
2017-06-19 16:01:44 +00:00
|
|
|
const statusBarContainer
|
|
|
|
= this.container.querySelector('.videocontainer__toolbar');
|
2018-08-08 18:48:23 +00:00
|
|
|
|
|
|
|
if (!statusBarContainer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const currentLayout = getCurrentLayout(APP.store.getState());
|
|
|
|
let tooltipPosition;
|
|
|
|
|
|
|
|
if (currentLayout === LAYOUTS.TILE_VIEW) {
|
|
|
|
tooltipPosition = 'right';
|
|
|
|
} else if (currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
|
|
|
|
tooltipPosition = 'left';
|
|
|
|
} else {
|
|
|
|
tooltipPosition = 'top';
|
|
|
|
}
|
2017-06-19 16:01:44 +00:00
|
|
|
|
|
|
|
ReactDOM.render(
|
2017-08-15 22:14:49 +00:00
|
|
|
<I18nextProvider i18n = { i18next }>
|
|
|
|
<div>
|
|
|
|
{ this.isAudioMuted
|
|
|
|
? <AudioMutedIndicator
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
: null }
|
|
|
|
{ this.isVideoMuted
|
|
|
|
? <VideoMutedIndicator
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
: null }
|
2017-10-02 23:08:07 +00:00
|
|
|
{ this._isModerator && !interfaceConfig.DISABLE_FOCUS_INDICATOR
|
|
|
|
? <ModeratorIndicator
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
: null }
|
2017-08-15 22:14:49 +00:00
|
|
|
</div>
|
|
|
|
</I18nextProvider>,
|
2017-06-19 16:01:44 +00:00
|
|
|
statusBarContainer);
|
2015-07-28 21:52:32 +00:00
|
|
|
};
|
2015-06-23 08:00:46 +00:00
|
|
|
|
|
|
|
/**
|
2016-09-28 21:31:40 +00:00
|
|
|
* Adds the element indicating the moderator(owner) of the conference.
|
2015-06-23 08:00:46 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.addModeratorIndicator = function() {
|
2017-06-19 16:01:44 +00:00
|
|
|
this._isModerator = true;
|
|
|
|
this.updateStatusBar();
|
2015-07-28 21:52:32 +00:00
|
|
|
};
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2016-09-28 21:31:40 +00:00
|
|
|
/**
|
|
|
|
* Adds the element indicating the audio level of the participant.
|
2017-06-19 19:06:23 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
2016-09-28 21:31:40 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.addAudioLevelIndicator = function() {
|
2017-06-19 19:06:23 +00:00
|
|
|
let audioLevelContainer = this._getAudioLevelContainer();
|
2016-09-28 21:31:40 +00:00
|
|
|
|
2017-06-19 19:06:23 +00:00
|
|
|
if (audioLevelContainer) {
|
2016-09-28 21:31:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-06-19 19:06:23 +00:00
|
|
|
audioLevelContainer = document.createElement('span');
|
|
|
|
audioLevelContainer.className = 'audioindicator-container';
|
|
|
|
this.container.appendChild(audioLevelContainer);
|
|
|
|
|
|
|
|
this.updateAudioLevelIndicator();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the element indicating the audio level of the participant.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.removeAudioLevelIndicator = function() {
|
2017-06-19 19:06:23 +00:00
|
|
|
const audioLevelContainer = this._getAudioLevelContainer();
|
|
|
|
|
|
|
|
if (audioLevelContainer) {
|
|
|
|
ReactDOM.unmountComponentAtNode(audioLevelContainer);
|
|
|
|
}
|
2016-09-28 21:31:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the audio level for this small video.
|
|
|
|
*
|
|
|
|
* @param lvl the new audio level to set
|
2017-06-19 19:06:23 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.updateAudioLevelIndicator = function(lvl = 0) {
|
2017-06-19 19:06:23 +00:00
|
|
|
const audioLevelContainer = this._getAudioLevelContainer();
|
|
|
|
|
|
|
|
if (audioLevelContainer) {
|
|
|
|
ReactDOM.render(
|
|
|
|
<AudioLevelIndicator
|
|
|
|
audioLevel = { lvl }/>,
|
|
|
|
audioLevelContainer);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries the component's DOM for the element that should be the parent to the
|
|
|
|
* AudioLevelIndicator.
|
|
|
|
*
|
|
|
|
* @returns {HTMLElement} The DOM element that holds the AudioLevelIndicator.
|
2016-09-28 21:31:40 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype._getAudioLevelContainer = function() {
|
2017-06-19 19:06:23 +00:00
|
|
|
return this.container.querySelector('.audioindicator-container');
|
2016-09-28 21:31:40 +00:00
|
|
|
};
|
|
|
|
|
2016-07-08 01:44:04 +00:00
|
|
|
/**
|
|
|
|
* Removes the element indicating the moderator(owner) of the conference.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.removeModeratorIndicator = function() {
|
2017-06-19 16:01:44 +00:00
|
|
|
this._isModerator = false;
|
|
|
|
this.updateStatusBar();
|
2016-07-08 01:44:04 +00:00
|
|
|
};
|
|
|
|
|
2016-07-08 20:17:05 +00:00
|
|
|
/**
|
|
|
|
* This is an especially interesting function. A naive reader might think that
|
|
|
|
* it returns this SmallVideo's "video" element. But it is much more exciting.
|
|
|
|
* It first finds this video's parent element using jquery, then uses a utility
|
|
|
|
* from lib-jitsi-meet to extract the video element from it (with two more
|
|
|
|
* jquery calls), and finally uses jquery again to encapsulate the video element
|
|
|
|
* in an array. This last step allows (some might prefer "forces") users of
|
|
|
|
* this function to access the video element via the 0th element of the returned
|
|
|
|
* array (after checking its length of course!).
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.selectVideoElement = function() {
|
2018-06-27 09:43:13 +00:00
|
|
|
return $($(this.container).find('video')[0]);
|
2015-08-21 14:26:39 +00:00
|
|
|
};
|
|
|
|
|
2016-09-19 18:57:14 +00:00
|
|
|
/**
|
|
|
|
* Selects the HTML image element which displays user's avatar.
|
|
|
|
*
|
|
|
|
* @return {jQuery|HTMLElement} a jQuery selector pointing to the HTML image
|
|
|
|
* element which displays the user's avatar.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.$avatar = function() {
|
2017-06-30 23:07:37 +00:00
|
|
|
return this.$container.find('.avatar-container');
|
2016-09-19 18:57:14 +00:00
|
|
|
};
|
|
|
|
|
2016-10-20 19:28:10 +00:00
|
|
|
/**
|
|
|
|
* Returns the display name element, which appears on the video thumbnail.
|
|
|
|
*
|
|
|
|
* @return {jQuery} a jQuery selector pointing to the display name element of
|
|
|
|
* the video thumbnail
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.$displayName = function() {
|
2017-06-30 23:07:37 +00:00
|
|
|
return this.$container.find('.displayNameContainer');
|
2017-06-29 03:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates or updates the participant's display name that is shown over the
|
|
|
|
* video preview.
|
|
|
|
*
|
2019-03-26 16:34:02 +00:00
|
|
|
* @param {Object} props - The React {@code Component} props to pass into the
|
|
|
|
* {@code DisplayName} component.
|
2017-06-29 03:35:43 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2019-03-26 16:34:02 +00:00
|
|
|
SmallVideo.prototype._renderDisplayName = function(props) {
|
2017-06-29 03:35:43 +00:00
|
|
|
const displayNameContainer
|
|
|
|
= this.container.querySelector('.displayNameContainer');
|
|
|
|
|
|
|
|
if (displayNameContainer) {
|
|
|
|
ReactDOM.render(
|
|
|
|
<Provider store = { APP.store }>
|
|
|
|
<I18nextProvider i18n = { i18next }>
|
|
|
|
<DisplayName { ...props } />
|
|
|
|
</I18nextProvider>
|
|
|
|
</Provider>,
|
|
|
|
displayNameContainer);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the component responsible for showing the participant's display name,
|
|
|
|
* if its container is present.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.removeDisplayName = function() {
|
2017-06-29 03:35:43 +00:00
|
|
|
const displayNameContainer
|
|
|
|
= this.container.querySelector('.displayNameContainer');
|
|
|
|
|
|
|
|
if (displayNameContainer) {
|
|
|
|
ReactDOM.unmountComponentAtNode(displayNameContainer);
|
|
|
|
}
|
2016-10-20 19:28:10 +00:00
|
|
|
};
|
|
|
|
|
2016-03-31 20:12:33 +00:00
|
|
|
/**
|
|
|
|
* Enables / disables the css responsible for focusing/pinning a video
|
|
|
|
* thumbnail.
|
|
|
|
*
|
|
|
|
* @param isFocused indicates if the thumbnail should be focused/pinned or not
|
|
|
|
*/
|
2015-07-28 21:52:32 +00:00
|
|
|
SmallVideo.prototype.focus = function(isFocused) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const focusedCssClass = 'videoContainerFocused';
|
|
|
|
const isFocusClassEnabled = this.$container.hasClass(focusedCssClass);
|
2016-03-31 20:12:33 +00:00
|
|
|
|
|
|
|
if (!isFocused && isFocusClassEnabled) {
|
2017-06-30 23:07:37 +00:00
|
|
|
this.$container.removeClass(focusedCssClass);
|
2017-10-12 23:02:29 +00:00
|
|
|
} else if (isFocused && !isFocusClassEnabled) {
|
2017-06-30 23:07:37 +00:00
|
|
|
this.$container.addClass(focusedCssClass);
|
2015-06-23 08:00:46 +00:00
|
|
|
}
|
2015-07-28 21:52:32 +00:00
|
|
|
};
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.hasVideo = function() {
|
2015-08-21 14:26:39 +00:00
|
|
|
return this.selectVideoElement().length !== 0;
|
2015-07-28 21:52:32 +00:00
|
|
|
};
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2016-09-19 19:04:55 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the user associated with this <tt>SmallVideo</tt> is currently
|
|
|
|
* being displayed on the "large video".
|
|
|
|
*
|
|
|
|
* @return {boolean} <tt>true</tt> if the user is displayed on the large video
|
|
|
|
* or <tt>false</tt> otherwise.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.isCurrentlyOnLargeVideo = function() {
|
2016-09-19 19:04:55 +00:00
|
|
|
return this.VideoLayout.isCurrentlyOnLarge(this.id);
|
|
|
|
};
|
|
|
|
|
2016-09-19 20:59:56 +00:00
|
|
|
/**
|
|
|
|
* Checks whether there is a playable video stream available for the user
|
|
|
|
* associated with this <tt>SmallVideo</tt>.
|
|
|
|
*
|
|
|
|
* @return {boolean} <tt>true</tt> if there is a playable video stream available
|
|
|
|
* or <tt>false</tt> otherwise.
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype.isVideoPlayable = function() {
|
|
|
|
return this.videoStream // Is there anything to display ?
|
2017-05-30 20:05:07 +00:00
|
|
|
&& !this.isVideoMuted && !this.videoStream.isMuted(); // Muted ?
|
2016-09-19 20:59:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines what should be display on the thumbnail.
|
|
|
|
*
|
|
|
|
* @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
|
2016-10-27 18:17:17 +00:00
|
|
|
* or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
|
2016-09-19 20:59:56 +00:00
|
|
|
*/
|
|
|
|
SmallVideo.prototype.selectDisplayMode = function() {
|
|
|
|
// Display name is always and only displayed when user is on the stage
|
2018-08-08 18:48:23 +00:00
|
|
|
if (this.isCurrentlyOnLargeVideo()
|
|
|
|
&& !shouldDisplayTileView(APP.store.getState())) {
|
2018-06-22 20:25:54 +00:00
|
|
|
return this.isVideoPlayable() && !APP.conference.isAudioOnly()
|
2018-05-25 20:22:39 +00:00
|
|
|
? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME;
|
2017-04-05 15:14:26 +00:00
|
|
|
} else if (this.isVideoPlayable()
|
|
|
|
&& this.selectVideoElement().length
|
|
|
|
&& !APP.conference.isAudioOnly()) {
|
2016-10-27 18:17:17 +00:00
|
|
|
// check hovering and change state to video with name
|
2017-10-12 23:02:29 +00:00
|
|
|
return this._isHovered()
|
|
|
|
? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
|
2016-09-19 20:59:56 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
|
|
|
// check hovering and change state to avatar with name
|
|
|
|
return this._isHovered()
|
|
|
|
? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
|
|
|
|
|
2016-09-19 20:59:56 +00:00
|
|
|
};
|
|
|
|
|
2016-10-27 18:17:17 +00:00
|
|
|
/**
|
|
|
|
* Checks whether current video is considered hovered. Currently it is hovered
|
|
|
|
* if the mouse is over the video, or if the connection
|
|
|
|
* indicator is shown(hovered).
|
|
|
|
* @private
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype._isHovered = function() {
|
2017-06-19 20:20:13 +00:00
|
|
|
return this.videoIsHovered || this._popoverIsHovered;
|
2016-10-27 18:17:17 +00:00
|
|
|
};
|
|
|
|
|
2015-06-29 14:24:21 +00:00
|
|
|
/**
|
2016-01-14 16:28:24 +00:00
|
|
|
* Hides or shows the user's avatar.
|
2016-01-14 19:30:56 +00:00
|
|
|
* This update assumes that large video had been updated and we will
|
|
|
|
* reflect it on this small video.
|
2016-01-14 16:28:24 +00:00
|
|
|
*
|
2015-06-29 14:24:21 +00:00
|
|
|
* @param show whether we should show the avatar or not
|
|
|
|
* video because there is no dominant speaker and no focused speaker
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.updateView = function() {
|
|
|
|
if (this.disableUpdateView) {
|
2016-11-04 22:02:30 +00:00
|
|
|
return;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-11-04 22:02:30 +00:00
|
|
|
|
2015-07-20 17:32:04 +00:00
|
|
|
if (!this.hasAvatar) {
|
2015-12-14 12:26:50 +00:00
|
|
|
if (this.id) {
|
2015-07-20 17:32:04 +00:00
|
|
|
// Init avatar
|
2017-12-19 23:11:54 +00:00
|
|
|
this.avatarChanged(
|
|
|
|
getAvatarURLByParticipantId(APP.store.getState(), this.id));
|
2015-07-20 17:32:04 +00:00
|
|
|
} else {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.error('Unable to init avatar - no id', this);
|
|
|
|
|
2015-07-20 17:32:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-06-29 14:24:21 +00:00
|
|
|
|
2018-05-25 20:19:51 +00:00
|
|
|
this.$container.removeClass((index, classNames) =>
|
|
|
|
classNames.split(' ').filter(name => name.startsWith('display-')));
|
|
|
|
|
2016-09-19 20:59:56 +00:00
|
|
|
// Determine whether video, avatar or blackness should be displayed
|
2017-10-12 23:02:29 +00:00
|
|
|
const displayMode = this.selectDisplayMode();
|
|
|
|
|
2018-05-25 20:19:51 +00:00
|
|
|
switch (displayMode) {
|
|
|
|
case DISPLAY_AVATAR_WITH_NAME:
|
|
|
|
this.$container.addClass('display-avatar-with-name');
|
|
|
|
break;
|
|
|
|
case DISPLAY_BLACKNESS_WITH_NAME:
|
|
|
|
this.$container.addClass('display-name-on-black');
|
|
|
|
break;
|
|
|
|
case DISPLAY_VIDEO:
|
|
|
|
this.$container.addClass('display-video');
|
|
|
|
break;
|
|
|
|
case DISPLAY_VIDEO_WITH_NAME:
|
|
|
|
this.$container.addClass('display-name-on-video');
|
|
|
|
break;
|
|
|
|
case DISPLAY_AVATAR:
|
|
|
|
default:
|
|
|
|
this.$container.addClass('display-avatar-only');
|
|
|
|
break;
|
|
|
|
}
|
2015-07-15 10:14:34 +00:00
|
|
|
};
|
2015-06-29 14:24:21 +00:00
|
|
|
|
2017-06-29 18:21:03 +00:00
|
|
|
/**
|
|
|
|
* Updates the react component displaying the avatar with the passed in avatar
|
|
|
|
* url.
|
|
|
|
*
|
|
|
|
* @param {string} avatarUrl - The uri to the avatar image.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.avatarChanged = function(avatarUrl) {
|
2017-06-29 18:21:03 +00:00
|
|
|
const thumbnail = this.$avatar().get(0);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-06-29 14:24:21 +00:00
|
|
|
this.hasAvatar = true;
|
|
|
|
|
2017-06-29 18:21:03 +00:00
|
|
|
if (thumbnail) {
|
|
|
|
ReactDOM.render(
|
|
|
|
<AvatarDisplay
|
|
|
|
className = 'userAvatar'
|
|
|
|
uri = { avatarUrl } />,
|
|
|
|
thumbnail
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unmounts any attached react components (particular the avatar image) from
|
|
|
|
* the avatar container.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.removeAvatar = function() {
|
2017-06-29 18:21:03 +00:00
|
|
|
const thumbnail = this.$avatar().get(0);
|
|
|
|
|
|
|
|
if (thumbnail) {
|
|
|
|
ReactDOM.unmountComponentAtNode(thumbnail);
|
2015-06-29 14:24:21 +00:00
|
|
|
}
|
2015-07-28 21:52:32 +00:00
|
|
|
};
|
2015-06-29 14:24:21 +00:00
|
|
|
|
2016-02-08 21:41:04 +00:00
|
|
|
/**
|
2016-06-20 21:13:17 +00:00
|
|
|
* Shows or hides the dominant speaker indicator.
|
|
|
|
* @param show whether to show or hide.
|
2016-02-08 21:41:04 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.showDominantSpeakerIndicator = function(show) {
|
2016-10-10 22:03:28 +00:00
|
|
|
// Don't create and show dominant speaker indicator if
|
|
|
|
// DISABLE_DOMINANT_SPEAKER_INDICATOR is true
|
2017-10-12 23:02:29 +00:00
|
|
|
if (interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR) {
|
2016-10-10 22:03:28 +00:00
|
|
|
return;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-10-10 22:03:28 +00:00
|
|
|
|
2016-02-08 21:41:04 +00:00
|
|
|
if (!this.container) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.warn(`Unable to set dominant speaker indicator - ${
|
|
|
|
this.videoSpanId} does not exist`);
|
|
|
|
|
2016-02-08 21:41:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-18 00:41:28 +00:00
|
|
|
if (this._showDominantSpeaker === show) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
this._showDominantSpeaker = show;
|
2016-02-08 21:41:04 +00:00
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
this.$container.toggleClass('active-speaker', this._showDominantSpeaker);
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
this.updateIndicators();
|
2018-08-08 18:48:23 +00:00
|
|
|
this.updateView();
|
2016-06-20 21:13:17 +00:00
|
|
|
};
|
2016-02-08 21:41:04 +00:00
|
|
|
|
2016-06-20 21:13:17 +00:00
|
|
|
/**
|
|
|
|
* Shows or hides the raised hand indicator.
|
|
|
|
* @param show whether to show or hide.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.showRaisedHandIndicator = function(show) {
|
2016-06-20 21:13:17 +00:00
|
|
|
if (!this.container) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.warn(`Unable to raised hand indication - ${
|
|
|
|
this.videoSpanId} does not exist`);
|
|
|
|
|
2016-06-20 21:13:17 +00:00
|
|
|
return;
|
2016-02-08 21:41:04 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
this._showRaisedHand = show;
|
2016-06-20 21:13:17 +00:00
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
this.updateIndicators();
|
2016-02-08 21:41:04 +00:00
|
|
|
};
|
|
|
|
|
2016-07-08 20:14:49 +00:00
|
|
|
/**
|
|
|
|
* Adds a listener for onresize events for this video, which will monitor for
|
|
|
|
* resolution changes, will calculate the delay since the moment the listened
|
|
|
|
* is added, and will fire a RESOLUTION_CHANGED event.
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype.waitForResolutionChange = function() {
|
2017-10-12 23:02:29 +00:00
|
|
|
const beforeChange = window.performance.now();
|
|
|
|
const videos = this.selectVideoElement();
|
|
|
|
|
|
|
|
if (!videos || !videos.length || videos.length <= 0) {
|
2016-07-08 20:14:49 +00:00
|
|
|
return;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
|
|
|
const video = videos[0];
|
|
|
|
const oldWidth = video.videoWidth;
|
|
|
|
const oldHeight = video.videoHeight;
|
|
|
|
|
2016-10-03 16:12:04 +00:00
|
|
|
video.onresize = () => {
|
2017-10-12 23:02:29 +00:00
|
|
|
// eslint-disable-next-line eqeqeq
|
2016-07-08 20:14:49 +00:00
|
|
|
if (video.videoWidth != oldWidth || video.videoHeight != oldHeight) {
|
|
|
|
// Only run once.
|
|
|
|
video.onresize = null;
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const delay = window.performance.now() - beforeChange;
|
|
|
|
const emitter = this.VideoLayout.getEventEmitter();
|
|
|
|
|
2016-07-08 20:14:49 +00:00
|
|
|
if (emitter) {
|
|
|
|
emitter.emit(
|
|
|
|
UIEvents.RESOLUTION_CHANGED,
|
2016-10-03 16:12:04 +00:00
|
|
|
this.getId(),
|
2017-10-12 23:02:29 +00:00
|
|
|
`${oldWidth}x${oldHeight}`,
|
|
|
|
`${video.videoWidth}x${video.videoHeight}`,
|
2016-07-08 20:14:49 +00:00
|
|
|
delay);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-08-08 22:03:00 +00:00
|
|
|
/**
|
|
|
|
* Initalizes any browser specific properties. Currently sets the overflow
|
|
|
|
* property for Qt browsers on Windows to hidden, thus fixing the following
|
|
|
|
* problem:
|
|
|
|
* Some browsers don't have full support of the object-fit property for the
|
|
|
|
* video element and when we set video object-fit to "cover" the video
|
|
|
|
* actually overflows the boundaries of its container, so it's important
|
|
|
|
* to indicate that the "overflow" should be hidden.
|
|
|
|
*
|
|
|
|
* Setting this property for all browsers will result in broken audio levels,
|
|
|
|
* which makes this a temporary solution, before reworking audio levels.
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype.initBrowserSpecificProperties = function() {
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const userAgent = window.navigator.userAgent;
|
|
|
|
|
|
|
|
if (userAgent.indexOf('QtWebEngine') > -1
|
|
|
|
&& (userAgent.indexOf('Windows') > -1
|
|
|
|
|| userAgent.indexOf('Linux') > -1)) {
|
|
|
|
this.$container.css('overflow', 'hidden');
|
2016-08-08 22:03:00 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-01-01 21:19:34 +00:00
|
|
|
/**
|
|
|
|
* Cleans up components on {@code SmallVideo} and removes itself from the DOM.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype.remove = function() {
|
|
|
|
logger.log('Remove thumbnail', this.id);
|
|
|
|
|
|
|
|
this.removeAudioLevelIndicator();
|
|
|
|
|
|
|
|
const toolbarContainer
|
|
|
|
= this.container.querySelector('.videocontainer__toolbar');
|
|
|
|
|
|
|
|
if (toolbarContainer) {
|
|
|
|
ReactDOM.unmountComponentAtNode(toolbarContainer);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.removeConnectionIndicator();
|
|
|
|
|
|
|
|
this.removeDisplayName();
|
|
|
|
|
|
|
|
this.removeAvatar();
|
|
|
|
|
|
|
|
this._unmountIndicators();
|
|
|
|
|
|
|
|
// Remove whole container
|
|
|
|
if (this.container.parentNode) {
|
|
|
|
this.container.parentNode.removeChild(this.container);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
/**
|
|
|
|
* Helper function for re-rendering multiple react components of the small
|
|
|
|
* video.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype.rerender = function() {
|
|
|
|
this.updateIndicators();
|
|
|
|
this.updateStatusBar();
|
|
|
|
this.updateView();
|
|
|
|
};
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
/**
|
|
|
|
* Updates the React element responsible for showing connection status, dominant
|
|
|
|
* speaker, and raised hand icons. Uses instance variables to get the necessary
|
|
|
|
* state to display. Will create the React element if not already created.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype.updateIndicators = function() {
|
2017-07-10 22:29:44 +00:00
|
|
|
const indicatorToolbar
|
|
|
|
= this.container.querySelector('.videocontainer__toptoolbar');
|
|
|
|
|
2017-12-19 06:27:57 +00:00
|
|
|
if (!indicatorToolbar) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
const iconSize = UIUtil.getIndicatorFontSize();
|
2017-09-26 16:55:09 +00:00
|
|
|
const showConnectionIndicator = this.videoIsHovered
|
|
|
|
|| !interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED;
|
2018-08-08 18:48:23 +00:00
|
|
|
const currentLayout = getCurrentLayout(APP.store.getState());
|
|
|
|
let statsPopoverPosition, tooltipPosition;
|
|
|
|
|
|
|
|
if (currentLayout === LAYOUTS.TILE_VIEW) {
|
|
|
|
statsPopoverPosition = 'right top';
|
|
|
|
tooltipPosition = 'right';
|
|
|
|
} else if (currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
|
|
|
|
statsPopoverPosition = this.statsPopoverLocation;
|
|
|
|
tooltipPosition = 'left';
|
|
|
|
} else {
|
|
|
|
statsPopoverPosition = this.statsPopoverLocation;
|
|
|
|
tooltipPosition = 'top';
|
|
|
|
}
|
2017-06-19 20:20:13 +00:00
|
|
|
|
|
|
|
ReactDOM.render(
|
2019-03-27 10:23:41 +00:00
|
|
|
<Provider store = { APP.store }>
|
2017-10-06 16:14:45 +00:00
|
|
|
<I18nextProvider i18n = { i18next }>
|
|
|
|
<div>
|
|
|
|
<AtlasKitThemeProvider mode = 'dark'>
|
|
|
|
{ this._showConnectionIndicator
|
|
|
|
? <ConnectionIndicator
|
|
|
|
alwaysVisible = { showConnectionIndicator }
|
|
|
|
connectionStatus = { this._connectionStatus }
|
|
|
|
iconSize = { iconSize }
|
|
|
|
isLocalVideo = { this.isLocal }
|
|
|
|
enableStatsDisplay
|
|
|
|
= { !interfaceConfig.filmStripOnly }
|
|
|
|
statsPopoverPosition
|
2018-08-08 18:48:23 +00:00
|
|
|
= { statsPopoverPosition }
|
2017-10-06 16:14:45 +00:00
|
|
|
userID = { this.id } />
|
|
|
|
: null }
|
2019-03-29 13:57:21 +00:00
|
|
|
<RaisedHandIndicator
|
|
|
|
iconSize = { iconSize }
|
|
|
|
participantId = { this.id }
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
2017-10-06 16:14:45 +00:00
|
|
|
{ this._showDominantSpeaker
|
|
|
|
? <DominantSpeakerIndicator
|
|
|
|
iconSize = { iconSize }
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
: null }
|
|
|
|
</AtlasKitThemeProvider>
|
|
|
|
</div>
|
2019-03-27 10:23:41 +00:00
|
|
|
</I18nextProvider>
|
|
|
|
</Provider>,
|
2017-07-10 22:29:44 +00:00
|
|
|
indicatorToolbar
|
2017-06-19 20:20:13 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2018-05-18 19:59:07 +00:00
|
|
|
/**
|
2018-11-30 22:13:39 +00:00
|
|
|
* Callback invoked when the thumbnail is double clicked. Will pin the
|
|
|
|
* participant if in tile view.
|
|
|
|
*
|
|
|
|
* @param {MouseEvent} event - The click event to intercept.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype._onContainerDoubleClick = function(event) {
|
|
|
|
if (this._pinningRequiresDoubleClick() && this._shouldTriggerPin(event)) {
|
|
|
|
APP.store.dispatch(pinParticipant(this.id));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback invoked when the thumbnail is clicked and potentially trigger
|
|
|
|
* pinning of the participant.
|
2018-05-18 19:59:07 +00:00
|
|
|
*
|
2018-11-30 22:13:39 +00:00
|
|
|
* @param {MouseEvent} event - The click event to intercept.
|
2018-05-18 19:59:07 +00:00
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-11-30 22:13:39 +00:00
|
|
|
SmallVideo.prototype._onContainerClick = function(event) {
|
|
|
|
const triggerPin = this._shouldTriggerPin(event)
|
|
|
|
&& !this._pinningRequiresDoubleClick();
|
|
|
|
|
|
|
|
if (event.stopPropagation && triggerPin) {
|
|
|
|
event.stopPropagation();
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (triggerPin) {
|
|
|
|
this.togglePin();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether or not a click event is targeted at certain elements which
|
|
|
|
* should not trigger a pin.
|
|
|
|
*
|
|
|
|
* @param {MouseEvent} event - The click event to intercept.
|
|
|
|
* @private
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype._shouldTriggerPin = function(event) {
|
|
|
|
// TODO Checking the classes is a workround to allow events to bubble into
|
|
|
|
// the DisplayName component if it was clicked. React's synthetic events
|
|
|
|
// will fire after jQuery handlers execute, so stop propogation at this
|
|
|
|
// point will prevent DisplayName from getting click events. This workaround
|
|
|
|
// should be removeable once LocalVideo is a React Component because then
|
|
|
|
// the components share the same eventing system.
|
|
|
|
const $source = $(event.target || event.srcElement);
|
|
|
|
|
|
|
|
return $source.parents('.displayNameContainer').length === 0
|
|
|
|
&& $source.parents('.popover').length === 0
|
|
|
|
&& !event.target.classList.contains('popover');
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pins the participant displayed by this thumbnail or unpins if already pinned.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype.togglePin = function() {
|
2018-05-18 19:59:07 +00:00
|
|
|
const pinnedParticipant
|
|
|
|
= getPinnedParticipant(APP.store.getState()) || {};
|
|
|
|
const participantIdToPin
|
|
|
|
= pinnedParticipant && pinnedParticipant.id === this.id
|
|
|
|
? null : this.id;
|
|
|
|
|
|
|
|
APP.store.dispatch(pinParticipant(participantIdToPin));
|
|
|
|
};
|
|
|
|
|
2018-11-30 22:13:39 +00:00
|
|
|
/**
|
|
|
|
* Returns whether or not clicking to pin the participant needs to be a double
|
|
|
|
* click instead of a single click.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
SmallVideo.prototype._pinningRequiresDoubleClick = function() {
|
|
|
|
return shouldDisplayTileView(APP.store.getState());
|
|
|
|
};
|
|
|
|
|
2017-07-10 22:29:44 +00:00
|
|
|
/**
|
|
|
|
* Removes the React element responsible for showing connection status, dominant
|
|
|
|
* speaker, and raised hand icons.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype._unmountIndicators = function() {
|
2017-07-10 22:29:44 +00:00
|
|
|
const indicatorToolbar
|
|
|
|
= this.container.querySelector('.videocontainer__toptoolbar');
|
|
|
|
|
|
|
|
if (indicatorToolbar) {
|
|
|
|
ReactDOM.unmountComponentAtNode(indicatorToolbar);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-06-19 20:20:13 +00:00
|
|
|
/**
|
|
|
|
* Updates the current state of the connection indicator popover being hovered.
|
|
|
|
* If hovered, display the small video as if it is hovered.
|
|
|
|
*
|
|
|
|
* @param {boolean} popoverIsHovered - Whether or not the mouse cursor is
|
|
|
|
* currently over the connection indicator popover.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SmallVideo.prototype._onPopoverHover = function(popoverIsHovered) {
|
2017-06-19 20:20:13 +00:00
|
|
|
this._popoverIsHovered = popoverIsHovered;
|
|
|
|
this.updateView();
|
|
|
|
};
|
|
|
|
|
2019-01-01 21:19:34 +00:00
|
|
|
|
2015-12-14 12:26:50 +00:00
|
|
|
export default SmallVideo;
|