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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 { translate } from '../../base/i18n';
  8. import { CalleeInfoContainer } from '../../base/jwt';
  9. import { Filmstrip } from '../../filmstrip';
  10. import { LargeVideo } from '../../large-video';
  11. import { NotificationsContainer } from '../../notifications';
  12. import { showToolbox, Toolbox } from '../../toolbox';
  13. import { HideNotificationBarStyle } from '../../unsupported-browser';
  14. import { maybeShowSuboptimalExperienceNotification } from '../functions';
  15. declare var APP: Object;
  16. declare var interfaceConfig: Object;
  17. /**
  18. * The type of the React {@code Component} props of {@link Conference}.
  19. */
  20. type Props = {
  21. /**
  22. * Whether the local participant is recording the conference.
  23. */
  24. _iAmRecorder: boolean,
  25. dispatch: Function,
  26. t: Function
  27. }
  28. /**
  29. * The conference page of the Web application.
  30. */
  31. class Conference extends Component<Props> {
  32. _onShowToolbar: Function;
  33. _originalOnShowToolbar: Function;
  34. /**
  35. * Initializes a new Conference instance.
  36. *
  37. * @param {Object} props - The read-only properties with which the new
  38. * instance is to be initialized.
  39. */
  40. constructor(props) {
  41. super(props);
  42. // Throttle and bind this component's mousemove handler to prevent it
  43. // from firing too often.
  44. this._originalOnShowToolbar = this._onShowToolbar;
  45. this._onShowToolbar = _.throttle(
  46. () => this._originalOnShowToolbar(),
  47. 100,
  48. {
  49. leading: true,
  50. trailing: false
  51. });
  52. }
  53. /**
  54. * Until we don't rewrite UI using react components
  55. * we use UI.start from old app. Also method translates
  56. * component right after it has been mounted.
  57. *
  58. * @inheritdoc
  59. */
  60. componentDidMount() {
  61. APP.UI.start();
  62. APP.UI.registerListeners();
  63. APP.UI.bindEvents();
  64. const { dispatch, t } = this.props;
  65. dispatch(connect());
  66. maybeShowSuboptimalExperienceNotification(dispatch, t);
  67. }
  68. /**
  69. * Disconnect from the conference when component will be
  70. * unmounted.
  71. *
  72. * @inheritdoc
  73. */
  74. componentWillUnmount() {
  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
  88. = filmStripOnly
  89. || VIDEO_QUALITY_LABEL_DISABLED
  90. || this.props._iAmRecorder;
  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. <CalleeInfoContainer />
  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. * _iAmRecorder: boolean
  133. * }}
  134. */
  135. function _mapStateToProps(state) {
  136. return {
  137. /**
  138. * Whether the local participant is recording the conference.
  139. *
  140. * @private
  141. */
  142. _iAmRecorder: state['features/base/config'].iAmRecorder
  143. };
  144. }
  145. export default reactReduxConnect(_mapStateToProps)(translate(Conference));