2017-05-24 17:01:46 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import { FixedSizeList, FixedSizeGrid } from 'react-window';
|
2019-03-19 15:42:25 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
2017-05-24 17:01:46 +00:00
|
|
|
|
2018-09-10 22:10:45 +00:00
|
|
|
import {
|
|
|
|
createShortcutEvent,
|
|
|
|
createToolbarEvent,
|
|
|
|
sendAnalytics
|
|
|
|
} from '../../../analytics';
|
2021-03-10 15:39:35 +00:00
|
|
|
import { getToolbarButtons } from '../../../base/config';
|
2021-07-22 06:37:44 +00:00
|
|
|
import { isMobileBrowser } from '../../../base/environment/utils';
|
2020-04-01 13:09:48 +00:00
|
|
|
import { translate } from '../../../base/i18n';
|
2020-05-20 10:57:03 +00:00
|
|
|
import { Icon, IconMenuDown, IconMenuUp } from '../../../base/icons';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2021-06-10 12:48:44 +00:00
|
|
|
import { showToolbox } from '../../../toolbox/actions.web';
|
|
|
|
import { isButtonEnabled, isToolboxVisible } from '../../../toolbox/functions.web';
|
2021-01-29 13:34:37 +00:00
|
|
|
import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
|
2021-05-19 23:23:40 +00:00
|
|
|
import { setFilmstripVisible, setVisibleRemoteParticipants } from '../../actions';
|
2021-07-22 06:37:44 +00:00
|
|
|
import {
|
|
|
|
ASPECT_RATIO_BREAKPOINT,
|
|
|
|
TILE_HORIZONTAL_MARGIN,
|
|
|
|
TILE_VERTICAL_MARGIN,
|
|
|
|
TOOLBAR_HEIGHT,
|
|
|
|
TOOLBAR_HEIGHT_MOBILE
|
|
|
|
} from '../../constants';
|
2018-05-10 23:01:55 +00:00
|
|
|
import { shouldRemoteVideosBeVisible } from '../../functions';
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
import AudioTracksContainer from './AudioTracksContainer';
|
2021-01-21 20:46:47 +00:00
|
|
|
import Thumbnail from './Thumbnail';
|
2021-03-26 20:23:05 +00:00
|
|
|
import ThumbnailWrapper from './ThumbnailWrapper';
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2018-09-10 22:10:45 +00:00
|
|
|
declare var APP: Object;
|
2018-03-07 00:28:19 +00:00
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
|
2021-09-14 07:43:52 +00:00
|
|
|
/**
|
|
|
|
* Fixes case in which context menu overflows and creates a scroll on the whole filmstrip videos pane.
|
|
|
|
*/
|
|
|
|
const TILEVIEW_VIDEO_PANES_STYLE = { overflow: 'visible' };
|
|
|
|
|
2018-06-25 15:33:08 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link Filmstrip}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Additional CSS class names top add to the root.
|
|
|
|
*/
|
|
|
|
_className: string,
|
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
/**
|
|
|
|
* The current layout of the filmstrip.
|
|
|
|
*/
|
|
|
|
_currentLayout: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The number of columns in tile view.
|
|
|
|
*/
|
|
|
|
_columns: number,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The width of the filmstrip.
|
|
|
|
*/
|
|
|
|
_filmstripWidth: number,
|
|
|
|
|
2020-02-25 12:06:58 +00:00
|
|
|
/**
|
2021-03-26 20:23:05 +00:00
|
|
|
* The height of the filmstrip.
|
2020-02-25 12:06:58 +00:00
|
|
|
*/
|
2021-03-26 20:23:05 +00:00
|
|
|
_filmstripHeight: number,
|
2020-02-25 12:08:04 +00:00
|
|
|
|
2021-03-10 15:39:35 +00:00
|
|
|
/**
|
|
|
|
* Whether the filmstrip button is enabled.
|
|
|
|
*/
|
|
|
|
_isFilmstripButtonEnabled: boolean,
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* The participants in the call.
|
|
|
|
*/
|
2021-03-26 20:23:05 +00:00
|
|
|
_remoteParticipants: Array<Object>,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The length of the remote participants array.
|
|
|
|
*/
|
|
|
|
_remoteParticipantsLength: number,
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
/**
|
|
|
|
* The number of rows in tile view.
|
|
|
|
*/
|
|
|
|
_rows: number,
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
/**
|
|
|
|
* The height of the thumbnail.
|
|
|
|
*/
|
|
|
|
_thumbnailHeight: number,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The width of the thumbnail.
|
|
|
|
*/
|
|
|
|
_thumbnailWidth: number,
|
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
/**
|
|
|
|
* Flag that indicates whether the thumbnails will be reordered.
|
|
|
|
*/
|
|
|
|
_thumbnailsReordered: Boolean,
|
|
|
|
|
2018-09-10 22:10:45 +00:00
|
|
|
/**
|
|
|
|
* Additional CSS class names to add to the container of all the thumbnails.
|
|
|
|
*/
|
|
|
|
_videosClassName: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the filmstrip videos should currently be displayed.
|
|
|
|
*/
|
|
|
|
_visible: boolean,
|
|
|
|
|
2021-06-10 12:48:44 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the toolbox is displayed.
|
|
|
|
*/
|
|
|
|
_isToolboxVisible: Boolean,
|
|
|
|
|
2018-06-25 15:33:08 +00:00
|
|
|
/**
|
|
|
|
* The redux {@code dispatch} function.
|
|
|
|
*/
|
2020-04-01 13:09:48 +00:00
|
|
|
dispatch: Dispatch<any>,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
2018-06-25 15:33:08 +00:00
|
|
|
};
|
|
|
|
|
2017-05-24 17:01:46 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@link Component} which represents the filmstrip on
|
|
|
|
* Web/React.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
2021-03-26 20:23:05 +00:00
|
|
|
class Filmstrip extends PureComponent <Props> {
|
2017-09-01 21:40:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a new {@code Filmstrip} instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
2018-06-25 15:33:08 +00:00
|
|
|
constructor(props: Props) {
|
2017-09-01 21:40:05 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once for every instance.
|
2020-01-24 16:28:47 +00:00
|
|
|
this._onShortcutToggleFilmstrip = this._onShortcutToggleFilmstrip.bind(this);
|
|
|
|
this._onToolbarToggleFilmstrip = this._onToolbarToggleFilmstrip.bind(this);
|
2021-06-10 12:48:44 +00:00
|
|
|
this._onTabIn = this._onTabIn.bind(this);
|
2021-03-26 20:23:05 +00:00
|
|
|
this._gridItemKey = this._gridItemKey.bind(this);
|
|
|
|
this._listItemKey = this._listItemKey.bind(this);
|
2021-05-19 23:23:40 +00:00
|
|
|
this._onGridItemsRendered = this._onGridItemsRendered.bind(this);
|
|
|
|
this._onListItemsRendered = this._onListItemsRendered.bind(this);
|
2018-09-10 22:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#componentDidMount}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
2020-11-10 22:21:07 +00:00
|
|
|
APP.keyboardshortcut.registerShortcut(
|
|
|
|
'F',
|
|
|
|
'filmstripPopover',
|
|
|
|
this._onShortcutToggleFilmstrip,
|
|
|
|
'keyboardShortcuts.toggleFilmstrip'
|
|
|
|
);
|
2018-09-10 22:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#componentDidUpdate}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentWillUnmount() {
|
|
|
|
APP.keyboardshortcut.unregisterShortcut('F');
|
2017-09-01 21:40:05 +00:00
|
|
|
}
|
|
|
|
|
2017-05-24 17:01:46 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2020-02-07 15:10:52 +00:00
|
|
|
const filmstripStyle = { };
|
2021-03-26 20:23:05 +00:00
|
|
|
const { _currentLayout } = this.props;
|
2021-01-21 20:46:47 +00:00
|
|
|
const tileViewActive = _currentLayout === LAYOUTS.TILE_VIEW;
|
2020-01-24 16:28:47 +00:00
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
switch (_currentLayout) {
|
2020-01-24 16:28:47 +00:00
|
|
|
case LAYOUTS.VERTICAL_FILMSTRIP_VIEW:
|
2020-02-07 15:10:52 +00:00
|
|
|
// Adding 18px for the 2px margins, 2px borders on the left and right and 5px padding on the left and right.
|
|
|
|
// Also adding 7px for the scrollbar.
|
|
|
|
filmstripStyle.maxWidth = (interfaceConfig.FILM_STRIP_MAX_HEIGHT || 120) + 25;
|
2020-01-24 16:28:47 +00:00
|
|
|
break;
|
2020-02-25 12:06:58 +00:00
|
|
|
}
|
|
|
|
|
2020-02-25 12:08:04 +00:00
|
|
|
let toolbar = null;
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
if (this.props._isFilmstripButtonEnabled) {
|
2020-11-10 22:21:07 +00:00
|
|
|
toolbar = this._renderToggleButton();
|
2020-02-25 12:08:04 +00:00
|
|
|
}
|
|
|
|
|
2017-05-24 17:01:46 +00:00
|
|
|
return (
|
2020-02-07 15:10:52 +00:00
|
|
|
<div
|
|
|
|
className = { `filmstrip ${this.props._className}` }
|
|
|
|
style = { filmstripStyle }>
|
2020-02-25 12:08:04 +00:00
|
|
|
{ toolbar }
|
2017-05-24 17:01:46 +00:00
|
|
|
<div
|
2018-09-10 22:10:45 +00:00
|
|
|
className = { this.props._videosClassName }
|
2020-02-07 15:10:52 +00:00
|
|
|
id = 'remoteVideos'>
|
2017-05-24 17:01:46 +00:00
|
|
|
<div
|
|
|
|
className = 'filmstrip__videos'
|
2021-01-29 13:34:37 +00:00
|
|
|
id = 'filmstripLocalVideo'>
|
2021-01-21 20:46:47 +00:00
|
|
|
<div id = 'filmstripLocalVideoThumbnail'>
|
|
|
|
{
|
|
|
|
!tileViewActive && <Thumbnail
|
2021-03-26 20:23:05 +00:00
|
|
|
key = 'local' />
|
2021-01-21 20:46:47 +00:00
|
|
|
}
|
|
|
|
</div>
|
2017-10-03 16:30:42 +00:00
|
|
|
</div>
|
2021-03-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
this._renderRemoteParticipants()
|
|
|
|
}
|
2017-05-24 17:01:46 +00:00
|
|
|
</div>
|
2021-03-26 20:23:05 +00:00
|
|
|
<AudioTracksContainer />
|
2017-05-24 17:01:46 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-09-01 21:40:05 +00:00
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
/**
|
|
|
|
* Calculates the start and stop indices based on whether the thumbnails need to be reordered in the filmstrip.
|
|
|
|
*
|
|
|
|
* @param {number} startIndex - The start index.
|
|
|
|
* @param {number} stopIndex - The stop index.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
_calculateIndices(startIndex, stopIndex) {
|
|
|
|
const { _currentLayout, _thumbnailsReordered } = this.props;
|
|
|
|
let start = startIndex;
|
|
|
|
let stop = stopIndex;
|
|
|
|
|
|
|
|
if (_thumbnailsReordered) {
|
2021-09-10 17:37:05 +00:00
|
|
|
// In tile view, the indices needs to be offset by 1 because the first thumbnail is that of the local
|
2021-08-19 21:56:45 +00:00
|
|
|
// endpoint. The remote participants start from index 1.
|
|
|
|
if (_currentLayout === LAYOUTS.TILE_VIEW) {
|
2021-09-10 17:37:05 +00:00
|
|
|
start = Math.max(startIndex - 1, 0);
|
2021-08-19 21:56:45 +00:00
|
|
|
stop = stopIndex - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
startIndex: start,
|
|
|
|
stopIndex: stop
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-06-10 12:48:44 +00:00
|
|
|
_onTabIn: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Toggle the toolbar visibility when tabbing into it.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onTabIn() {
|
|
|
|
if (!this.props._isToolboxVisible && this.props._visible) {
|
|
|
|
this.props.dispatch(showToolbox());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
_listItemKey: number => string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The key to be used for every ThumbnailWrapper element in stage view.
|
|
|
|
*
|
|
|
|
* @param {number} index - The index of the ThumbnailWrapper instance.
|
|
|
|
* @returns {string} - The key.
|
|
|
|
*/
|
|
|
|
_listItemKey(index) {
|
|
|
|
const { _remoteParticipants, _remoteParticipantsLength } = this.props;
|
|
|
|
|
|
|
|
if (typeof index !== 'number' || _remoteParticipantsLength <= index) {
|
|
|
|
return `empty-${index}`;
|
|
|
|
}
|
|
|
|
|
2021-06-23 18:53:56 +00:00
|
|
|
return _remoteParticipants[index];
|
2021-03-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_gridItemKey: Object => string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The key to be used for every ThumbnailWrapper element in tile views.
|
|
|
|
*
|
|
|
|
* @param {Object} data - An object with the indexes identifying the ThumbnailWrapper instance.
|
|
|
|
* @returns {string} - The key.
|
|
|
|
*/
|
|
|
|
_gridItemKey({ columnIndex, rowIndex }) {
|
2021-08-19 21:56:45 +00:00
|
|
|
const { _columns, _remoteParticipants, _remoteParticipantsLength, _thumbnailsReordered } = this.props;
|
2021-03-26 20:23:05 +00:00
|
|
|
const index = (rowIndex * _columns) + columnIndex;
|
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
// When the thumbnails are reordered, local participant is inserted at index 0.
|
|
|
|
const localIndex = _thumbnailsReordered ? 0 : _remoteParticipantsLength;
|
|
|
|
const remoteIndex = _thumbnailsReordered ? index - 1 : index;
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
if (index > _remoteParticipantsLength) {
|
|
|
|
return `empty-${index}`;
|
|
|
|
}
|
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
if (index === localIndex) {
|
2021-03-26 20:23:05 +00:00
|
|
|
return 'local';
|
|
|
|
}
|
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
return _remoteParticipants[remoteIndex];
|
2021-03-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
2021-05-19 23:23:40 +00:00
|
|
|
_onListItemsRendered: Object => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles items rendered changes in stage view.
|
|
|
|
*
|
|
|
|
* @param {Object} data - Information about the rendered items.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2021-07-27 23:01:18 +00:00
|
|
|
_onListItemsRendered({ visibleStartIndex, visibleStopIndex }) {
|
2021-05-19 23:23:40 +00:00
|
|
|
const { dispatch } = this.props;
|
2021-08-19 21:56:45 +00:00
|
|
|
const { startIndex, stopIndex } = this._calculateIndices(visibleStartIndex, visibleStopIndex);
|
2021-05-19 23:23:40 +00:00
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
dispatch(setVisibleRemoteParticipants(startIndex, stopIndex));
|
2021-05-19 23:23:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_onGridItemsRendered: Object => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles items rendered changes in tile view.
|
|
|
|
*
|
|
|
|
* @param {Object} data - Information about the rendered items.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onGridItemsRendered({
|
2021-07-27 23:01:18 +00:00
|
|
|
visibleColumnStartIndex,
|
|
|
|
visibleColumnStopIndex,
|
|
|
|
visibleRowStartIndex,
|
|
|
|
visibleRowStopIndex
|
2021-05-19 23:23:40 +00:00
|
|
|
}) {
|
|
|
|
const { _columns, dispatch } = this.props;
|
2021-08-19 21:56:45 +00:00
|
|
|
const start = (visibleRowStartIndex * _columns) + visibleColumnStartIndex;
|
|
|
|
const stop = (visibleRowStopIndex * _columns) + visibleColumnStopIndex;
|
|
|
|
const { startIndex, stopIndex } = this._calculateIndices(start, stop);
|
2021-05-19 23:23:40 +00:00
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
dispatch(setVisibleRemoteParticipants(startIndex, stopIndex));
|
2021-05-19 23:23:40 +00:00
|
|
|
}
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
/**
|
|
|
|
* Renders the thumbnails for remote participants.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderRemoteParticipants() {
|
|
|
|
const {
|
|
|
|
_columns,
|
|
|
|
_currentLayout,
|
|
|
|
_filmstripHeight,
|
|
|
|
_filmstripWidth,
|
|
|
|
_remoteParticipantsLength,
|
|
|
|
_rows,
|
|
|
|
_thumbnailHeight,
|
|
|
|
_thumbnailWidth
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (!_thumbnailWidth || isNaN(_thumbnailWidth) || !_thumbnailHeight
|
|
|
|
|| isNaN(_thumbnailHeight) || !_filmstripHeight || isNaN(_filmstripHeight) || !_filmstripWidth
|
|
|
|
|| isNaN(_filmstripWidth)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_currentLayout === LAYOUTS.TILE_VIEW) {
|
|
|
|
return (
|
|
|
|
<FixedSizeGrid
|
|
|
|
className = 'filmstrip__videos remote-videos'
|
|
|
|
columnCount = { _columns }
|
|
|
|
columnWidth = { _thumbnailWidth + TILE_HORIZONTAL_MARGIN }
|
|
|
|
height = { _filmstripHeight }
|
|
|
|
initialScrollLeft = { 0 }
|
|
|
|
initialScrollTop = { 0 }
|
|
|
|
itemKey = { this._gridItemKey }
|
2021-05-19 23:23:40 +00:00
|
|
|
onItemsRendered = { this._onGridItemsRendered }
|
2021-07-27 23:01:18 +00:00
|
|
|
overscanRowCount = { 1 }
|
2021-03-26 20:23:05 +00:00
|
|
|
rowCount = { _rows }
|
|
|
|
rowHeight = { _thumbnailHeight + TILE_VERTICAL_MARGIN }
|
2021-09-14 07:43:52 +00:00
|
|
|
style = { TILEVIEW_VIDEO_PANES_STYLE }
|
2021-03-26 20:23:05 +00:00
|
|
|
width = { _filmstripWidth }>
|
|
|
|
{
|
|
|
|
ThumbnailWrapper
|
|
|
|
}
|
|
|
|
</FixedSizeGrid>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
itemCount: _remoteParticipantsLength,
|
|
|
|
className: 'filmstrip__videos remote-videos',
|
|
|
|
height: _filmstripHeight,
|
|
|
|
itemKey: this._listItemKey,
|
|
|
|
itemSize: 0,
|
2021-05-19 23:23:40 +00:00
|
|
|
onItemsRendered: this._onListItemsRendered,
|
2021-07-27 23:01:18 +00:00
|
|
|
overscanCount: 1,
|
2021-03-26 20:23:05 +00:00
|
|
|
width: _filmstripWidth,
|
|
|
|
style: {
|
|
|
|
willChange: 'auto'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
|
|
|
|
const itemSize = _thumbnailWidth + TILE_HORIZONTAL_MARGIN;
|
|
|
|
const isNotOverflowing = (_remoteParticipantsLength * itemSize) <= _filmstripWidth;
|
|
|
|
|
|
|
|
props.itemSize = itemSize;
|
|
|
|
|
|
|
|
// $FlowFixMe
|
|
|
|
props.layout = 'horizontal';
|
|
|
|
if (isNotOverflowing) {
|
|
|
|
props.className += ' is-not-overflowing';
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (_currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
|
|
|
|
const itemSize = _thumbnailHeight + TILE_VERTICAL_MARGIN;
|
|
|
|
const isNotOverflowing = (_remoteParticipantsLength * itemSize) <= _filmstripHeight;
|
|
|
|
|
|
|
|
if (isNotOverflowing) {
|
|
|
|
props.className += ' is-not-overflowing';
|
|
|
|
}
|
|
|
|
|
|
|
|
props.itemSize = itemSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<FixedSizeList { ...props }>
|
|
|
|
{
|
|
|
|
ThumbnailWrapper
|
|
|
|
}
|
|
|
|
</FixedSizeList>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-09-10 22:10:45 +00:00
|
|
|
/**
|
|
|
|
* Dispatches an action to change the visibility of the filmstrip.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_doToggleFilmstrip() {
|
|
|
|
this.props.dispatch(setFilmstripVisible(!this.props._visible));
|
|
|
|
}
|
|
|
|
|
|
|
|
_onShortcutToggleFilmstrip: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an analytics keyboard shortcut event and dispatches an action for
|
|
|
|
* toggling filmstrip visibility.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onShortcutToggleFilmstrip() {
|
|
|
|
sendAnalytics(createShortcutEvent(
|
|
|
|
'toggle.filmstrip',
|
|
|
|
{
|
|
|
|
enable: this.props._visible
|
|
|
|
}));
|
|
|
|
|
|
|
|
this._doToggleFilmstrip();
|
|
|
|
}
|
|
|
|
|
|
|
|
_onToolbarToggleFilmstrip: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an analytics toolbar event and dispatches an action for opening
|
|
|
|
* the speaker stats modal.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onToolbarToggleFilmstrip() {
|
|
|
|
sendAnalytics(createToolbarEvent(
|
|
|
|
'toggle.filmstrip.button',
|
|
|
|
{
|
|
|
|
enable: this.props._visible
|
|
|
|
}));
|
|
|
|
|
|
|
|
this._doToggleFilmstrip();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a React Element for changing the visibility of the filmstrip when
|
|
|
|
* clicked.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderToggleButton() {
|
2019-08-30 16:39:06 +00:00
|
|
|
const icon = this.props._visible ? IconMenuDown : IconMenuUp;
|
2020-04-01 13:09:48 +00:00
|
|
|
const { t } = this.props;
|
2018-09-10 22:10:45 +00:00
|
|
|
|
|
|
|
return (
|
2021-06-10 12:48:44 +00:00
|
|
|
<div
|
|
|
|
className = 'filmstrip__toolbar'>
|
2018-09-10 22:10:45 +00:00
|
|
|
<button
|
2021-06-10 12:48:44 +00:00
|
|
|
aria-expanded = { this.props._visible }
|
2020-04-01 13:09:48 +00:00
|
|
|
aria-label = { t('toolbar.accessibilityLabel.toggleFilmstrip') }
|
2018-09-10 22:10:45 +00:00
|
|
|
id = 'toggleFilmstripButton'
|
2021-06-10 12:48:44 +00:00
|
|
|
onClick = { this._onToolbarToggleFilmstrip }
|
|
|
|
onFocus = { this._onTabIn }
|
|
|
|
tabIndex = { 0 }>
|
|
|
|
<Icon
|
|
|
|
aria-label = { t('toolbar.accessibilityLabel.toggleFilmstrip') }
|
|
|
|
src = { icon } />
|
2018-09-10 22:10:45 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-05-24 17:01:46 +00:00
|
|
|
}
|
2017-08-12 00:27:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated {@code Filmstrip}'s props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
2020-02-25 12:06:58 +00:00
|
|
|
* @returns {Props}
|
2017-08-12 00:27:30 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
2021-03-10 15:39:35 +00:00
|
|
|
const toolbarButtons = getToolbarButtons(state);
|
2021-09-10 17:37:05 +00:00
|
|
|
const { testing = {} } = state['features/base/config'];
|
|
|
|
const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
|
2021-03-26 20:23:05 +00:00
|
|
|
const { visible, remoteParticipants } = state['features/filmstrip'];
|
|
|
|
const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length;
|
2018-06-25 15:33:08 +00:00
|
|
|
const remoteVideosVisible = shouldRemoteVideosBeVisible(state);
|
2020-03-09 11:54:54 +00:00
|
|
|
const { isOpen: shiftRight } = state['features/chat'];
|
2021-03-26 20:23:05 +00:00
|
|
|
const {
|
|
|
|
gridDimensions = {},
|
|
|
|
filmstripHeight,
|
|
|
|
filmstripWidth,
|
|
|
|
thumbnailSize: tileViewThumbnailSize
|
|
|
|
} = state['features/filmstrip'].tileViewDimensions;
|
|
|
|
const _currentLayout = getCurrentLayout(state);
|
2021-07-22 06:37:44 +00:00
|
|
|
|
|
|
|
const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
|
|
|
|
const availableSpace = clientHeight - filmstripHeight;
|
|
|
|
let filmstripPadding = 0;
|
|
|
|
|
|
|
|
if (availableSpace > 0) {
|
|
|
|
const paddingValue = TOOLBAR_HEIGHT_MOBILE - availableSpace;
|
|
|
|
|
|
|
|
if (paddingValue > 0) {
|
|
|
|
filmstripPadding = paddingValue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
filmstripPadding = TOOLBAR_HEIGHT_MOBILE;
|
|
|
|
}
|
|
|
|
|
|
|
|
const collapseTileView = reduceHeight
|
|
|
|
&& isMobileBrowser()
|
|
|
|
&& clientWidth <= ASPECT_RATIO_BREAKPOINT;
|
|
|
|
|
|
|
|
const className = `${remoteVideosVisible ? '' : 'hide-videos'} ${
|
|
|
|
reduceHeight ? 'reduce-height' : ''
|
|
|
|
} ${shiftRight ? 'shift-right' : ''} ${collapseTileView ? 'collapse' : ''}`.trim();
|
|
|
|
const videosClassName = `filmstrip__videos${visible ? '' : ' hidden'}`;
|
2021-03-26 20:23:05 +00:00
|
|
|
let _thumbnailSize, remoteFilmstripHeight, remoteFilmstripWidth;
|
|
|
|
|
|
|
|
switch (_currentLayout) {
|
|
|
|
case LAYOUTS.TILE_VIEW:
|
|
|
|
_thumbnailSize = tileViewThumbnailSize;
|
2021-07-22 06:37:44 +00:00
|
|
|
remoteFilmstripHeight = filmstripHeight - (collapseTileView && filmstripPadding > 0 ? filmstripPadding : 0);
|
2021-03-26 20:23:05 +00:00
|
|
|
remoteFilmstripWidth = filmstripWidth;
|
|
|
|
break;
|
|
|
|
case LAYOUTS.VERTICAL_FILMSTRIP_VIEW: {
|
|
|
|
const { remote, remoteVideosContainer } = state['features/filmstrip'].verticalViewDimensions;
|
|
|
|
|
|
|
|
_thumbnailSize = remote;
|
|
|
|
remoteFilmstripHeight = remoteVideosContainer?.height - (reduceHeight ? TOOLBAR_HEIGHT : 0);
|
|
|
|
remoteFilmstripWidth = remoteVideosContainer?.width;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW: {
|
|
|
|
const { remote, remoteVideosContainer } = state['features/filmstrip'].horizontalViewDimensions;
|
|
|
|
|
|
|
|
_thumbnailSize = remote;
|
|
|
|
remoteFilmstripHeight = remoteVideosContainer?.height;
|
|
|
|
remoteFilmstripWidth = remoteVideosContainer?.width;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-01-24 16:28:47 +00:00
|
|
|
|
2017-08-12 00:27:30 +00:00
|
|
|
return {
|
2018-06-25 15:33:08 +00:00
|
|
|
_className: className,
|
2020-01-24 16:28:47 +00:00
|
|
|
_columns: gridDimensions.columns,
|
2021-03-26 20:23:05 +00:00
|
|
|
_currentLayout,
|
|
|
|
_filmstripHeight: remoteFilmstripHeight,
|
|
|
|
_filmstripWidth: remoteFilmstripWidth,
|
2021-03-10 15:39:35 +00:00
|
|
|
_isFilmstripButtonEnabled: isButtonEnabled('filmstrip', state),
|
2021-03-26 20:23:05 +00:00
|
|
|
_remoteParticipantsLength: remoteParticipants.length,
|
|
|
|
_remoteParticipants: remoteParticipants,
|
2020-01-24 16:28:47 +00:00
|
|
|
_rows: gridDimensions.rows,
|
2021-03-26 20:23:05 +00:00
|
|
|
_thumbnailWidth: _thumbnailSize?.width,
|
|
|
|
_thumbnailHeight: _thumbnailSize?.height,
|
2021-08-19 21:56:45 +00:00
|
|
|
_thumbnailsReordered: enableThumbnailReordering,
|
2018-09-10 22:10:45 +00:00
|
|
|
_videosClassName: videosClassName,
|
2021-06-10 12:48:44 +00:00
|
|
|
_visible: visible,
|
|
|
|
_isToolboxVisible: isToolboxVisible(state)
|
2017-08-12 00:27:30 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-04-01 13:09:48 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(Filmstrip));
|