You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Conference.web.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* @flow */
  2. import _ from 'lodash';
  3. import PropTypes from 'prop-types';
  4. import React, { Component } from 'react';
  5. import { connect as reactReduxConnect } from 'react-redux';
  6. import { connect, disconnect } from '../../base/connection';
  7. import { DialogContainer } from '../../base/dialog';
  8. import { Filmstrip } from '../../filmstrip';
  9. import { LargeVideo } from '../../large-video';
  10. import { NotificationsContainer } from '../../notifications';
  11. import { OverlayContainer } from '../../overlay';
  12. import { showToolbox, Toolbox } from '../../toolbox';
  13. import { HideNotificationBarStyle } from '../../unsupported-browser';
  14. declare var $: Function;
  15. declare var APP: Object;
  16. declare var interfaceConfig: Object;
  17. /**
  18. * The conference page of the Web application.
  19. */
  20. class Conference extends Component<*> {
  21. _onShowToolbar: Function;
  22. _originalOnShowToolbar: Function;
  23. /**
  24. * Conference component's property types.
  25. *
  26. * @static
  27. */
  28. static propTypes = {
  29. /**
  30. * Whether or not the current local user is recording the conference.
  31. *
  32. */
  33. _isRecording: PropTypes.bool,
  34. dispatch: PropTypes.func
  35. };
  36. /**
  37. * Initializes a new Conference instance.
  38. *
  39. * @param {Object} props - The read-only properties with which the new
  40. * instance is to be initialized.
  41. */
  42. constructor(props) {
  43. super(props);
  44. // Throttle and bind this component's mousemove handler to prevent it
  45. // from firing too often.
  46. this._originalOnShowToolbar = this._onShowToolbar;
  47. this._onShowToolbar = _.throttle(
  48. () => this._originalOnShowToolbar(),
  49. 100,
  50. {
  51. leading: true,
  52. trailing: false
  53. });
  54. }
  55. /**
  56. * Until we don't rewrite UI using react components
  57. * we use UI.start from old app. Also method translates
  58. * component right after it has been mounted.
  59. *
  60. * @inheritdoc
  61. */
  62. componentDidMount() {
  63. APP.UI.start();
  64. APP.UI.registerListeners();
  65. APP.UI.bindEvents();
  66. this.props.dispatch(connect());
  67. }
  68. /**
  69. * Disconnect from the conference when component will be
  70. * unmounted.
  71. *
  72. * @inheritdoc
  73. */
  74. componentWillUnmount() {
  75. APP.UI.stopDaemons();
  76. APP.UI.unregisterListeners();
  77. APP.UI.unbindEvents();
  78. APP.conference.isJoined() && this.props.dispatch(disconnect());
  79. }
  80. /**
  81. * Implements React's {@link Component#render()}.
  82. *
  83. * @inheritdoc
  84. * @returns {ReactElement}
  85. */
  86. render() {
  87. const { filmStripOnly, VIDEO_QUALITY_LABEL_DISABLED } = interfaceConfig;
  88. const hideVideoQualityLabel = filmStripOnly
  89. || VIDEO_QUALITY_LABEL_DISABLED
  90. || this.props._isRecording;
  91. return (
  92. <div
  93. id = 'videoconference_page'
  94. onMouseMove = { this._onShowToolbar }>
  95. <div id = 'videospace'>
  96. <LargeVideo
  97. hideVideoQualityLabel = { hideVideoQualityLabel } />
  98. <Filmstrip filmstripOnly = { filmStripOnly } />
  99. </div>
  100. { filmStripOnly ? null : <Toolbox /> }
  101. <DialogContainer />
  102. <NotificationsContainer />
  103. <OverlayContainer />
  104. {/*
  105. * Temasys automatically injects a notification bar, if
  106. * necessary, displayed at the top of the page notifying that
  107. * WebRTC is not installed or supported. We do not need/want
  108. * the notification bar in question because we have whole pages
  109. * dedicated to the respective scenarios.
  110. */}
  111. <HideNotificationBarStyle />
  112. </div>
  113. );
  114. }
  115. /**
  116. * Displays the toolbar.
  117. *
  118. * @private
  119. * @returns {void}
  120. */
  121. _onShowToolbar() {
  122. this.props.dispatch(showToolbox());
  123. }
  124. }
  125. /**
  126. * Maps (parts of) the Redux state to the associated props for the
  127. * {@code Conference} component.
  128. *
  129. * @param {Object} state - The Redux state.
  130. * @private
  131. * @returns {{
  132. * _isRecording: boolean
  133. * }}
  134. */
  135. function _mapStateToProps(state) {
  136. return {
  137. _isRecording: state['features/base/config'].iAmRecorder
  138. };
  139. }
  140. export default reactReduxConnect(_mapStateToProps)(Conference);