2018-08-23 19:57:12 +00:00
|
|
|
// @flow
|
2017-05-24 17:01:46 +00:00
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
import VideoLayout from '../../../../modules/UI/videolayout/VideoLayout';
|
2017-05-24 17:01:46 +00:00
|
|
|
import { Watermarks } from '../../base/react';
|
2019-10-08 09:34:25 +00:00
|
|
|
import { connect } from '../../base/redux';
|
2021-03-23 12:11:11 +00:00
|
|
|
import { setColorAlpha } from '../../base/util';
|
2022-03-29 08:45:09 +00:00
|
|
|
import { StageParticipantNameLabel } from '../../display-name';
|
2022-02-24 12:20:37 +00:00
|
|
|
import { FILMSTRIP_BREAKPOINT, isFilmstripResizable } from '../../filmstrip';
|
2022-03-04 13:10:57 +00:00
|
|
|
import { getVerticalViewMaxWidth } from '../../filmstrip/functions.web';
|
2021-04-16 09:43:34 +00:00
|
|
|
import { SharedVideo } from '../../shared-video/components/web';
|
2020-05-20 10:57:03 +00:00
|
|
|
import { Captions } from '../../subtitles/';
|
2021-10-05 09:10:50 +00:00
|
|
|
import { setTileView } from '../../video-layout/actions';
|
2018-05-16 14:00:16 +00:00
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
declare var interfaceConfig: Object;
|
2017-05-24 17:01:46 +00:00
|
|
|
|
2019-10-08 09:34:25 +00:00
|
|
|
type Props = {
|
|
|
|
|
2021-03-23 12:11:11 +00:00
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* The alpha(opacity) of the background.
|
2021-03-23 12:11:11 +00:00
|
|
|
*/
|
|
|
|
_backgroundAlpha: number,
|
|
|
|
|
2020-05-22 06:36:24 +00:00
|
|
|
/**
|
|
|
|
* The user selected background color.
|
|
|
|
*/
|
2022-02-24 12:20:37 +00:00
|
|
|
_customBackgroundColor: string,
|
2020-05-22 06:36:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The user selected background image url.
|
|
|
|
*/
|
2022-02-24 12:20:37 +00:00
|
|
|
_customBackgroundImageUrl: string,
|
2020-05-22 06:36:24 +00:00
|
|
|
|
2020-03-11 09:45:42 +00:00
|
|
|
/**
|
|
|
|
* Prop that indicates whether the chat is open.
|
|
|
|
*/
|
|
|
|
_isChatOpen: boolean,
|
|
|
|
|
2019-10-08 09:34:25 +00:00
|
|
|
/**
|
|
|
|
* Used to determine the value of the autoplay attribute of the underlying
|
|
|
|
* video element.
|
|
|
|
*/
|
2021-10-05 09:10:50 +00:00
|
|
|
_noAutoPlayVideo: boolean,
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the filmstrip is resizable.
|
|
|
|
*/
|
|
|
|
_resizableFilmstrip: boolean,
|
|
|
|
|
2022-03-04 13:10:57 +00:00
|
|
|
/**
|
|
|
|
* Whether or not to show dominant speaker badge.
|
|
|
|
*/
|
|
|
|
_showDominantSpeakerBadge: boolean,
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
/**
|
|
|
|
* The width of the vertical filmstrip (user resized).
|
|
|
|
*/
|
|
|
|
_verticalFilmstripWidth: ?number,
|
|
|
|
|
2022-03-04 13:10:57 +00:00
|
|
|
/**
|
|
|
|
* The max width of the vertical filmstrip.
|
|
|
|
*/
|
|
|
|
_verticalViewMaxWidth: number,
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the filmstrip is visible.
|
|
|
|
*/
|
|
|
|
_visibleFilmstrip: boolean,
|
|
|
|
|
2021-10-05 09:10:50 +00:00
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
|
|
|
dispatch: Function
|
2019-10-08 09:34:25 +00:00
|
|
|
}
|
|
|
|
|
2021-11-04 21:10:43 +00:00
|
|
|
/** .
|
2017-05-24 17:01:46 +00:00
|
|
|
* Implements a React {@link Component} which represents the large video (a.k.a.
|
2021-11-04 21:10:43 +00:00
|
|
|
* The conference participant who is on the local stage) on Web/React.
|
2017-05-24 17:01:46 +00:00
|
|
|
*
|
2021-11-04 21:10:43 +00:00
|
|
|
* @augments Component
|
2017-05-24 17:01:46 +00:00
|
|
|
*/
|
2019-10-08 09:34:25 +00:00
|
|
|
class LargeVideo extends Component<Props> {
|
2021-11-04 21:10:43 +00:00
|
|
|
_tappedTimeout: ?TimeoutID;
|
2021-10-05 09:10:50 +00:00
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
_containerRef: Object;
|
|
|
|
|
|
|
|
_wrapperRef: Object;
|
|
|
|
|
2021-10-05 09:10:50 +00:00
|
|
|
/**
|
|
|
|
* Constructor of the component.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
this._containerRef = React.createRef();
|
|
|
|
this._wrapperRef = React.createRef();
|
|
|
|
|
2021-10-05 09:10:50 +00:00
|
|
|
this._clearTapTimeout = this._clearTapTimeout.bind(this);
|
|
|
|
this._onDoubleTap = this._onDoubleTap.bind(this);
|
2022-02-24 12:20:37 +00:00
|
|
|
this._updateLayout = this._updateLayout.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements {@code Component#componentDidUpdate}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentDidUpdate(prevProps: Props) {
|
|
|
|
const { _visibleFilmstrip } = this.props;
|
|
|
|
|
|
|
|
if (prevProps._visibleFilmstrip !== _visibleFilmstrip) {
|
|
|
|
this._updateLayout();
|
|
|
|
}
|
2021-10-05 09:10:50 +00:00
|
|
|
}
|
2020-05-22 06:36:24 +00:00
|
|
|
|
2017-05-24 17:01:46 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
2018-08-23 19:57:12 +00:00
|
|
|
* @returns {React$Element}
|
2017-05-24 17:01:46 +00:00
|
|
|
*/
|
|
|
|
render() {
|
2021-04-16 09:43:34 +00:00
|
|
|
const {
|
|
|
|
_isChatOpen,
|
2022-03-04 13:10:57 +00:00
|
|
|
_noAutoPlayVideo,
|
|
|
|
_showDominantSpeakerBadge
|
2021-04-16 09:43:34 +00:00
|
|
|
} = this.props;
|
2020-05-22 06:36:24 +00:00
|
|
|
const style = this._getCustomSyles();
|
2021-04-16 09:43:34 +00:00
|
|
|
const className = `videocontainer${_isChatOpen ? ' shift-right' : ''}`;
|
2020-05-22 06:36:24 +00:00
|
|
|
|
2017-05-24 17:01:46 +00:00
|
|
|
return (
|
|
|
|
<div
|
2020-03-11 09:45:42 +00:00
|
|
|
className = { className }
|
2020-05-22 06:36:24 +00:00
|
|
|
id = 'largeVideoContainer'
|
2022-02-24 12:20:37 +00:00
|
|
|
ref = { this._containerRef }
|
2020-05-22 06:36:24 +00:00
|
|
|
style = { style }>
|
2021-04-16 09:43:34 +00:00
|
|
|
<SharedVideo />
|
2017-05-24 17:01:46 +00:00
|
|
|
<div id = 'etherpad' />
|
|
|
|
|
|
|
|
<Watermarks />
|
|
|
|
|
2021-10-05 09:10:50 +00:00
|
|
|
<div
|
|
|
|
id = 'dominantSpeaker'
|
|
|
|
onTouchEnd = { this._onDoubleTap }>
|
2017-05-24 17:01:46 +00:00
|
|
|
<div className = 'dynamic-shadow' />
|
2019-02-07 03:19:02 +00:00
|
|
|
<div id = 'dominantSpeakerAvatarContainer' />
|
2017-05-24 17:01:46 +00:00
|
|
|
</div>
|
2017-07-31 23:33:22 +00:00
|
|
|
<div id = 'remotePresenceMessage' />
|
2017-05-24 17:01:46 +00:00
|
|
|
<span id = 'remoteConnectionMessage' />
|
2018-08-08 18:48:23 +00:00
|
|
|
<div id = 'largeVideoElementsContainer'>
|
2018-02-13 00:29:29 +00:00
|
|
|
<div id = 'largeVideoBackgroundContainer' />
|
2017-06-20 21:40:18 +00:00
|
|
|
|
2018-08-23 19:57:12 +00:00
|
|
|
{/*
|
|
|
|
* FIXME: the architecture of elements related to the large
|
|
|
|
* video and the naming. The background is not part of
|
|
|
|
* largeVideoWrapper because we are controlling the size of
|
|
|
|
* the video through largeVideoWrapper. That's why we need
|
|
|
|
* another container for the background and the
|
|
|
|
* largeVideoWrapper in order to hide/show them.
|
|
|
|
*/}
|
2021-06-10 12:48:44 +00:00
|
|
|
<div
|
|
|
|
id = 'largeVideoWrapper'
|
2021-10-05 09:10:50 +00:00
|
|
|
onTouchEnd = { this._onDoubleTap }
|
2022-02-24 12:20:37 +00:00
|
|
|
ref = { this._wrapperRef }
|
2021-06-10 12:48:44 +00:00
|
|
|
role = 'figure' >
|
2017-06-20 21:40:18 +00:00
|
|
|
<video
|
2021-04-16 09:43:34 +00:00
|
|
|
autoPlay = { !_noAutoPlayVideo }
|
2017-06-20 21:40:18 +00:00
|
|
|
id = 'largeVideo'
|
2020-04-14 16:05:03 +00:00
|
|
|
muted = { true }
|
|
|
|
playsInline = { true } /* for Safari on iOS to work */ />
|
2017-06-20 21:40:18 +00:00
|
|
|
</div>
|
2017-05-24 17:01:46 +00:00
|
|
|
</div>
|
2018-07-17 17:31:12 +00:00
|
|
|
{ interfaceConfig.DISABLE_TRANSCRIPTION_SUBTITLES
|
2018-08-23 19:57:12 +00:00
|
|
|
|| <Captions /> }
|
2022-03-29 08:45:09 +00:00
|
|
|
{_showDominantSpeakerBadge && <StageParticipantNameLabel />}
|
2017-05-24 17:01:46 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2020-05-22 06:36:24 +00:00
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
_updateLayout: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Refreshes the video layout to determine the dimensions of the stage view.
|
|
|
|
* If the filmstrip is toggled it adds CSS transition classes and removes them
|
|
|
|
* when the transition is done.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_updateLayout() {
|
|
|
|
const { _verticalFilmstripWidth, _resizableFilmstrip } = this.props;
|
|
|
|
|
|
|
|
if (_resizableFilmstrip && _verticalFilmstripWidth >= FILMSTRIP_BREAKPOINT) {
|
|
|
|
this._containerRef.current.classList.add('transition');
|
|
|
|
this._wrapperRef.current.classList.add('transition');
|
|
|
|
VideoLayout.refreshLayout();
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
this._containerRef.current && this._containerRef.current.classList.remove('transition');
|
|
|
|
this._wrapperRef.current && this._wrapperRef.current.classList.remove('transition');
|
|
|
|
}, 1000);
|
|
|
|
} else {
|
|
|
|
VideoLayout.refreshLayout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-04 21:10:43 +00:00
|
|
|
_clearTapTimeout: () => void;
|
2021-10-05 09:10:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the '_tappedTimout'.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_clearTapTimeout() {
|
|
|
|
clearTimeout(this._tappedTimeout);
|
|
|
|
this._tappedTimeout = undefined;
|
|
|
|
}
|
|
|
|
|
2020-05-22 06:36:24 +00:00
|
|
|
/**
|
|
|
|
* Creates the custom styles object.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
_getCustomSyles() {
|
|
|
|
const styles = {};
|
2022-02-24 12:20:37 +00:00
|
|
|
const {
|
|
|
|
_customBackgroundColor,
|
|
|
|
_customBackgroundImageUrl,
|
|
|
|
_verticalFilmstripWidth,
|
2022-03-04 13:10:57 +00:00
|
|
|
_verticalViewMaxWidth,
|
2022-02-24 12:20:37 +00:00
|
|
|
_visibleFilmstrip
|
|
|
|
} = this.props;
|
2020-05-22 06:36:24 +00:00
|
|
|
|
|
|
|
styles.backgroundColor = _customBackgroundColor || interfaceConfig.DEFAULT_BACKGROUND;
|
|
|
|
|
2021-03-23 12:11:11 +00:00
|
|
|
if (this.props._backgroundAlpha !== undefined) {
|
|
|
|
const alphaColor = setColorAlpha(styles.backgroundColor, this.props._backgroundAlpha);
|
|
|
|
|
|
|
|
styles.backgroundColor = alphaColor;
|
|
|
|
}
|
|
|
|
|
2020-05-22 06:36:24 +00:00
|
|
|
if (_customBackgroundImageUrl) {
|
|
|
|
styles.backgroundImage = `url(${_customBackgroundImageUrl})`;
|
|
|
|
styles.backgroundSize = 'cover';
|
|
|
|
}
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
if (_visibleFilmstrip && _verticalFilmstripWidth >= FILMSTRIP_BREAKPOINT) {
|
2022-03-04 13:10:57 +00:00
|
|
|
styles.width = `calc(100% - ${_verticalViewMaxWidth || 0}px)`;
|
2022-02-24 12:20:37 +00:00
|
|
|
}
|
|
|
|
|
2020-05-22 06:36:24 +00:00
|
|
|
return styles;
|
|
|
|
}
|
2021-10-05 09:10:50 +00:00
|
|
|
|
2021-11-04 21:10:43 +00:00
|
|
|
_onDoubleTap: () => void;
|
2021-10-05 09:10:50 +00:00
|
|
|
|
|
|
|
/**
|
2021-10-05 11:12:43 +00:00
|
|
|
* Sets view to tile view on double tap.
|
2021-10-05 09:10:50 +00:00
|
|
|
*
|
|
|
|
* @param {Object} e - The event.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDoubleTap(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
if (this._tappedTimeout) {
|
|
|
|
this._clearTapTimeout();
|
|
|
|
this.props.dispatch(setTileView(true));
|
|
|
|
} else {
|
|
|
|
this._tappedTimeout = setTimeout(this._clearTapTimeout, 300);
|
|
|
|
}
|
|
|
|
}
|
2017-05-24 17:01:46 +00:00
|
|
|
}
|
2019-10-08 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated LargeVideo props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
2020-05-22 06:36:24 +00:00
|
|
|
* @returns {Props}
|
2019-10-08 09:34:25 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
const testingConfig = state['features/base/config'].testing;
|
2020-05-22 06:36:24 +00:00
|
|
|
const { backgroundColor, backgroundImageUrl } = state['features/dynamic-branding'];
|
2020-03-11 09:45:42 +00:00
|
|
|
const { isOpen: isChatOpen } = state['features/chat'];
|
2022-02-24 12:20:37 +00:00
|
|
|
const { width: verticalFilmstripWidth, visible } = state['features/filmstrip'];
|
2022-03-04 13:10:57 +00:00
|
|
|
const { hideDominantSpeakerBadge } = state['features/base/config'];
|
2019-10-08 09:34:25 +00:00
|
|
|
|
|
|
|
return {
|
2021-03-23 12:11:11 +00:00
|
|
|
_backgroundAlpha: state['features/base/config'].backgroundAlpha,
|
2020-05-22 06:36:24 +00:00
|
|
|
_customBackgroundColor: backgroundColor,
|
|
|
|
_customBackgroundImageUrl: backgroundImageUrl,
|
2020-03-11 09:45:42 +00:00
|
|
|
_isChatOpen: isChatOpen,
|
2022-02-24 12:20:37 +00:00
|
|
|
_noAutoPlayVideo: testingConfig?.noAutoPlayVideo,
|
|
|
|
_resizableFilmstrip: isFilmstripResizable(state),
|
2022-03-04 13:10:57 +00:00
|
|
|
_showDominantSpeakerBadge: !hideDominantSpeakerBadge,
|
2022-02-24 12:20:37 +00:00
|
|
|
_verticalFilmstripWidth: verticalFilmstripWidth.current,
|
2022-03-04 13:10:57 +00:00
|
|
|
_verticalViewMaxWidth: getVerticalViewMaxWidth(state),
|
2022-02-24 12:20:37 +00:00
|
|
|
_visibleFilmstrip: visible
|
2019-10-08 09:34:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-09-10 07:00:54 +00:00
|
|
|
export default connect(_mapStateToProps)(LargeVideo);
|