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.3KB

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