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

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