2017-11-23 16:26:47 +00:00
|
|
|
// @flow
|
2017-01-10 21:55:31 +00:00
|
|
|
|
2017-10-11 05:45:20 +00:00
|
|
|
import _ from 'lodash';
|
2019-03-20 20:09:23 +00:00
|
|
|
import React from 'react';
|
2016-12-12 21:13:17 +00:00
|
|
|
|
2019-01-30 13:05:35 +00:00
|
|
|
import VideoLayout from '../../../../../modules/UI/videolayout/VideoLayout';
|
|
|
|
|
|
|
|
import { connect, disconnect } from '../../../base/connection';
|
|
|
|
import { translate } from '../../../base/i18n';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect as reactReduxConnect } from '../../../base/redux';
|
2020-04-02 07:13:07 +00:00
|
|
|
import { getBackendSafeRoomName } from '../../../base/util';
|
2019-01-30 13:05:35 +00:00
|
|
|
import { Chat } from '../../../chat';
|
|
|
|
import { Filmstrip } from '../../../filmstrip';
|
|
|
|
import { CalleeInfoContainer } from '../../../invite';
|
|
|
|
import { LargeVideo } from '../../../large-video';
|
2019-02-07 22:52:31 +00:00
|
|
|
import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
import {
|
|
|
|
Toolbox,
|
|
|
|
fullScreenChanged,
|
|
|
|
setToolboxAlwaysVisible,
|
|
|
|
showToolbox
|
2019-01-30 13:05:35 +00:00
|
|
|
} from '../../../toolbox';
|
|
|
|
|
|
|
|
import { maybeShowSuboptimalExperienceNotification } from '../../functions';
|
2017-01-31 20:58:48 +00:00
|
|
|
|
2019-02-05 10:10:15 +00:00
|
|
|
import Labels from './Labels';
|
2019-01-30 13:05:35 +00:00
|
|
|
import { default as Notice } from './Notice';
|
2019-03-12 17:45:53 +00:00
|
|
|
import { default as Subject } from './Subject';
|
2019-03-20 20:09:23 +00:00
|
|
|
import {
|
|
|
|
AbstractConference,
|
|
|
|
abstractMapStateToProps
|
|
|
|
} from '../AbstractConference';
|
2019-02-07 22:52:31 +00:00
|
|
|
import type { AbstractProps } from '../AbstractConference';
|
2018-01-03 22:14:17 +00:00
|
|
|
|
2017-02-07 14:45:51 +00:00
|
|
|
declare var APP: Object;
|
core: refactor routing
Unfortunately, as the Jitsi Meet development evolved the routing mechanism
became more complex and thre logic ended up spread across multiple parts of the
codebase, which made it hard to follow and extend.
This change aims to fix that by rewriting the routing logic and centralizing it
in (pretty much) a single place, with no implicit inter-dependencies.
In order to arrive there, however, some extra changes were needed, which were
not caught early enough and are thus part of this change:
- JitsiMeetJS initialization is now synchronous: there is nothing async about
it, and the only async requirement (Temasys support) was lifted. See [0].
- WebRTC support can be detected early: building on top of the above, WebRTC
support can now be detected immediately, so take advantage of this to simplify
how we handle unsupported browsers. See [0].
The new router takes decissions based on the Redux state at the time of
invocation. A route can be represented by either a component or a URl reference,
with the latter taking precedence. On mobile, obviously, there is no concept of
URL reference so routing is based solely on components.
[0]: https://github.com/jitsi/lib-jitsi-meet/pull/779
2018-06-29 07:58:31 +00:00
|
|
|
declare var config: Object;
|
2017-07-06 02:07:00 +00:00
|
|
|
declare var interfaceConfig: Object;
|
2017-02-07 14:45:51 +00:00
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
/**
|
|
|
|
* DOM events for when full screen mode has changed. Different browsers need
|
|
|
|
* different vendor prefixes.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {Array<string>}
|
|
|
|
*/
|
|
|
|
const FULL_SCREEN_EVENTS = [
|
|
|
|
'webkitfullscreenchange',
|
|
|
|
'mozfullscreenchange',
|
|
|
|
'fullscreenchange'
|
|
|
|
];
|
|
|
|
|
2018-07-25 20:00:00 +00:00
|
|
|
/**
|
|
|
|
* The CSS class to apply to the root element of the conference so CSS can
|
|
|
|
* modify the app layout.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
2018-08-08 18:48:23 +00:00
|
|
|
const LAYOUT_CLASSNAMES = {
|
|
|
|
[LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW]: 'horizontal-filmstrip',
|
|
|
|
[LAYOUTS.TILE_VIEW]: 'tile-view',
|
|
|
|
[LAYOUTS.VERTICAL_FILMSTRIP_VIEW]: 'vertical-filmstrip'
|
2018-07-25 20:00:00 +00:00
|
|
|
};
|
|
|
|
|
2016-11-23 21:46:46 +00:00
|
|
|
/**
|
2017-11-23 16:26:47 +00:00
|
|
|
* The type of the React {@code Component} props of {@link Conference}.
|
2016-11-23 21:46:46 +00:00
|
|
|
*/
|
2019-02-07 22:52:31 +00:00
|
|
|
type Props = AbstractProps & {
|
2017-01-10 21:55:31 +00:00
|
|
|
|
2017-11-23 16:26:47 +00:00
|
|
|
/**
|
2018-02-12 17:42:38 +00:00
|
|
|
* Whether the local participant is recording the conference.
|
2017-11-23 16:26:47 +00:00
|
|
|
*/
|
2018-02-12 17:42:38 +00:00
|
|
|
_iAmRecorder: boolean,
|
2017-11-23 16:26:47 +00:00
|
|
|
|
2018-07-25 20:00:00 +00:00
|
|
|
/**
|
|
|
|
* The CSS class to apply to the root of {@link Conference} to modify the
|
|
|
|
* application layout.
|
|
|
|
*/
|
2018-08-08 18:48:23 +00:00
|
|
|
_layoutClassName: string,
|
2018-07-25 20:00:00 +00:00
|
|
|
|
2020-04-02 07:13:07 +00:00
|
|
|
/**
|
|
|
|
* Name for this conference room.
|
|
|
|
*/
|
|
|
|
_roomName: string,
|
|
|
|
|
2018-01-03 22:14:17 +00:00
|
|
|
dispatch: Function,
|
|
|
|
t: Function
|
2017-11-23 16:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The conference page of the Web application.
|
|
|
|
*/
|
2019-03-20 20:09:23 +00:00
|
|
|
class Conference extends AbstractConference<Props, *> {
|
2018-03-07 00:28:19 +00:00
|
|
|
_onFullScreenChange: Function;
|
2017-11-23 16:26:47 +00:00
|
|
|
_onShowToolbar: Function;
|
|
|
|
_originalOnShowToolbar: Function;
|
2017-01-10 21:55:31 +00:00
|
|
|
|
2017-10-11 05:45:20 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new Conference instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Throttle and bind this component's mousemove handler to prevent it
|
|
|
|
// from firing too often.
|
|
|
|
this._originalOnShowToolbar = this._onShowToolbar;
|
|
|
|
this._onShowToolbar = _.throttle(
|
|
|
|
() => this._originalOnShowToolbar(),
|
|
|
|
100,
|
|
|
|
{
|
|
|
|
leading: true,
|
|
|
|
trailing: false
|
|
|
|
});
|
2018-03-07 00:28:19 +00:00
|
|
|
|
|
|
|
// Bind event handler so it is only bound once for every instance.
|
|
|
|
this._onFullScreenChange = this._onFullScreenChange.bind(this);
|
2017-10-11 05:45:20 +00:00
|
|
|
}
|
|
|
|
|
2016-12-12 21:13:17 +00:00
|
|
|
/**
|
core: refactor routing
Unfortunately, as the Jitsi Meet development evolved the routing mechanism
became more complex and thre logic ended up spread across multiple parts of the
codebase, which made it hard to follow and extend.
This change aims to fix that by rewriting the routing logic and centralizing it
in (pretty much) a single place, with no implicit inter-dependencies.
In order to arrive there, however, some extra changes were needed, which were
not caught early enough and are thus part of this change:
- JitsiMeetJS initialization is now synchronous: there is nothing async about
it, and the only async requirement (Temasys support) was lifted. See [0].
- WebRTC support can be detected early: building on top of the above, WebRTC
support can now be detected immediately, so take advantage of this to simplify
how we handle unsupported browsers. See [0].
The new router takes decissions based on the Redux state at the time of
invocation. A route can be represented by either a component or a URl reference,
with the latter taking precedence. On mobile, obviously, there is no concept of
URL reference so routing is based solely on components.
[0]: https://github.com/jitsi/lib-jitsi-meet/pull/779
2018-06-29 07:58:31 +00:00
|
|
|
* Start the connection and get the UI ready for the conference.
|
2016-12-12 21:13:17 +00:00
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
2020-04-02 07:13:07 +00:00
|
|
|
document.title = `${this.props._roomName} | ${interfaceConfig.APP_NAME}`;
|
2019-10-09 12:35:09 +00:00
|
|
|
this._start();
|
2016-12-12 21:13:17 +00:00
|
|
|
}
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
/**
|
|
|
|
* Calls into legacy UI to update the application layout, if necessary.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* returns {void}
|
|
|
|
*/
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
if (this.props._shouldDisplayTileView
|
|
|
|
=== prevProps._shouldDisplayTileView) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: For now VideoLayout is being called as LargeVideo and Filmstrip
|
|
|
|
// sizing logic is still handled outside of React. Once all components
|
|
|
|
// are in react they should calculate size on their own as much as
|
|
|
|
// possible and pass down sizings.
|
|
|
|
VideoLayout.refreshLayout();
|
|
|
|
}
|
|
|
|
|
2016-12-12 21:13:17 +00:00
|
|
|
/**
|
|
|
|
* Disconnect from the conference when component will be
|
|
|
|
* unmounted.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentWillUnmount() {
|
2017-02-15 21:39:16 +00:00
|
|
|
APP.UI.unbindEvents();
|
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
FULL_SCREEN_EVENTS.forEach(name =>
|
|
|
|
document.removeEventListener(name, this._onFullScreenChange));
|
|
|
|
|
2017-02-02 16:01:03 +00:00
|
|
|
APP.conference.isJoined() && this.props.dispatch(disconnect());
|
2016-12-12 21:13:17 +00:00
|
|
|
}
|
|
|
|
|
2016-11-23 21:46:46 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2018-03-07 00:28:19 +00:00
|
|
|
const {
|
|
|
|
VIDEO_QUALITY_LABEL_DISABLED,
|
2018-05-03 17:36:29 +00:00
|
|
|
|
|
|
|
// XXX The character casing of the name filmStripOnly utilized by
|
|
|
|
// interfaceConfig is obsolete but legacy support is required.
|
|
|
|
filmStripOnly: filmstripOnly
|
2018-03-07 00:28:19 +00:00
|
|
|
} = interfaceConfig;
|
2018-02-12 17:42:38 +00:00
|
|
|
const hideVideoQualityLabel
|
2018-05-03 17:36:29 +00:00
|
|
|
= filmstripOnly
|
2018-02-12 17:42:38 +00:00
|
|
|
|| VIDEO_QUALITY_LABEL_DISABLED
|
|
|
|
|| this.props._iAmRecorder;
|
2017-07-06 02:07:00 +00:00
|
|
|
|
2016-11-23 21:46:46 +00:00
|
|
|
return (
|
2017-10-11 05:45:20 +00:00
|
|
|
<div
|
2018-08-08 18:48:23 +00:00
|
|
|
className = { this.props._layoutClassName }
|
2017-10-11 05:45:20 +00:00
|
|
|
id = 'videoconference_page'
|
|
|
|
onMouseMove = { this._onShowToolbar }>
|
2018-07-24 13:08:26 +00:00
|
|
|
<Notice />
|
2019-03-12 17:45:53 +00:00
|
|
|
<Subject />
|
2016-11-23 21:46:46 +00:00
|
|
|
<div id = 'videospace'>
|
2019-02-05 10:10:15 +00:00
|
|
|
<LargeVideo />
|
|
|
|
{ hideVideoQualityLabel
|
|
|
|
|| <Labels /> }
|
2018-05-03 17:36:29 +00:00
|
|
|
<Filmstrip filmstripOnly = { filmstripOnly } />
|
2016-11-23 21:46:46 +00:00
|
|
|
</div>
|
2017-02-16 23:02:40 +00:00
|
|
|
|
2018-05-03 17:36:29 +00:00
|
|
|
{ filmstripOnly || <Toolbox /> }
|
2018-08-29 17:24:25 +00:00
|
|
|
{ filmstripOnly || <Chat /> }
|
2017-05-24 17:01:46 +00:00
|
|
|
|
2019-03-20 20:09:23 +00:00
|
|
|
{ this.renderNotificationsContainer() }
|
2017-05-17 21:05:48 +00:00
|
|
|
|
2017-12-13 03:58:33 +00:00
|
|
|
<CalleeInfoContainer />
|
2017-05-17 21:05:48 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-10-11 05:45:20 +00:00
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
/**
|
|
|
|
* Updates the Redux state when full screen mode has been enabled or
|
|
|
|
* disabled.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onFullScreenChange() {
|
|
|
|
this.props.dispatch(fullScreenChanged(APP.UI.isFullScreen()));
|
|
|
|
}
|
|
|
|
|
2017-10-11 05:45:20 +00:00
|
|
|
/**
|
|
|
|
* Displays the toolbar.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onShowToolbar() {
|
|
|
|
this.props.dispatch(showToolbox());
|
|
|
|
}
|
core: refactor routing
Unfortunately, as the Jitsi Meet development evolved the routing mechanism
became more complex and thre logic ended up spread across multiple parts of the
codebase, which made it hard to follow and extend.
This change aims to fix that by rewriting the routing logic and centralizing it
in (pretty much) a single place, with no implicit inter-dependencies.
In order to arrive there, however, some extra changes were needed, which were
not caught early enough and are thus part of this change:
- JitsiMeetJS initialization is now synchronous: there is nothing async about
it, and the only async requirement (Temasys support) was lifted. See [0].
- WebRTC support can be detected early: building on top of the above, WebRTC
support can now be detected immediately, so take advantage of this to simplify
how we handle unsupported browsers. See [0].
The new router takes decissions based on the Redux state at the time of
invocation. A route can be represented by either a component or a URl reference,
with the latter taking precedence. On mobile, obviously, there is no concept of
URL reference so routing is based solely on components.
[0]: https://github.com/jitsi/lib-jitsi-meet/pull/779
2018-06-29 07:58:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Until we don't rewrite UI using react components
|
|
|
|
* we use UI.start from old app. Also method translates
|
|
|
|
* component right after it has been mounted.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
_start() {
|
|
|
|
APP.UI.start();
|
|
|
|
|
|
|
|
APP.UI.registerListeners();
|
|
|
|
APP.UI.bindEvents();
|
|
|
|
|
|
|
|
FULL_SCREEN_EVENTS.forEach(name =>
|
|
|
|
document.addEventListener(name, this._onFullScreenChange));
|
|
|
|
|
|
|
|
const { dispatch, t } = this.props;
|
|
|
|
|
|
|
|
dispatch(connect());
|
|
|
|
|
|
|
|
maybeShowSuboptimalExperienceNotification(dispatch, t);
|
|
|
|
|
|
|
|
interfaceConfig.filmStripOnly
|
|
|
|
&& dispatch(setToolboxAlwaysVisible(true));
|
|
|
|
}
|
2016-11-23 21:46:46 +00:00
|
|
|
}
|
2016-12-12 21:13:17 +00:00
|
|
|
|
2017-11-22 10:18:08 +00:00
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated props for the
|
|
|
|
* {@code Conference} component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
2019-02-07 22:52:31 +00:00
|
|
|
* @returns {Props}
|
2017-11-22 10:18:08 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
2018-08-08 18:48:23 +00:00
|
|
|
const currentLayout = getCurrentLayout(state);
|
2020-04-02 07:13:07 +00:00
|
|
|
const roomName = getBackendSafeRoomName(state['features/base/conference'].room);
|
2018-03-07 00:28:19 +00:00
|
|
|
|
2017-11-22 10:18:08 +00:00
|
|
|
return {
|
2019-02-07 22:52:31 +00:00
|
|
|
...abstractMapStateToProps(state),
|
2018-08-08 18:48:23 +00:00
|
|
|
_iAmRecorder: state['features/base/config'].iAmRecorder,
|
2020-04-02 07:13:07 +00:00
|
|
|
_layoutClassName: LAYOUT_CLASSNAMES[currentLayout],
|
|
|
|
_roomName: roomName
|
2017-11-22 10:18:08 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-01-03 22:14:17 +00:00
|
|
|
export default reactReduxConnect(_mapStateToProps)(translate(Conference));
|