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

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