2018-08-23 19:57:12 +00:00
|
|
|
// @flow
|
2017-05-24 17:01:46 +00:00
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
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';
|
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
|
|
|
/**
|
|
|
|
* The alpha(opacity) of the background
|
|
|
|
*/
|
|
|
|
_backgroundAlpha: number,
|
|
|
|
|
2020-05-22 06:36:24 +00:00
|
|
|
/**
|
|
|
|
* The user selected background color.
|
|
|
|
*/
|
|
|
|
_customBackgroundColor: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The user selected background image url.
|
|
|
|
*/
|
|
|
|
_customBackgroundImageUrl: string,
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
|
|
|
dispatch: Function
|
2019-10-08 09:34:25 +00:00
|
|
|
}
|
|
|
|
|
2017-05-24 17:01:46 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@link Component} which represents the large video (a.k.a.
|
|
|
|
* the conference participant who is on the local stage) on Web/React.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
2019-10-08 09:34:25 +00:00
|
|
|
class LargeVideo extends Component<Props> {
|
2021-10-05 09:10:50 +00:00
|
|
|
_tappedTimeout: ?TimeoutID
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor of the component.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._clearTapTimeout = this._clearTapTimeout.bind(this);
|
|
|
|
this._onDoubleTap = this._onDoubleTap.bind(this);
|
|
|
|
}
|
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,
|
|
|
|
_noAutoPlayVideo
|
|
|
|
} = 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'
|
|
|
|
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 }
|
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 /> }
|
2017-05-24 17:01:46 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2020-05-22 06:36:24 +00:00
|
|
|
|
2021-10-05 09:10:50 +00:00
|
|
|
_clearTapTimeout: () => void
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 = {};
|
|
|
|
const { _customBackgroundColor, _customBackgroundImageUrl } = this.props;
|
|
|
|
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
|
|
|
return styles;
|
|
|
|
}
|
2021-10-05 09:10:50 +00:00
|
|
|
|
|
|
|
_onDoubleTap: () => void
|
|
|
|
|
|
|
|
/**
|
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'];
|
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,
|
2019-10-08 09:34:25 +00:00
|
|
|
_noAutoPlayVideo: testingConfig?.noAutoPlayVideo
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-09-10 07:00:54 +00:00
|
|
|
export default connect(_mapStateToProps)(LargeVideo);
|